Jae-Yoon Sim

192 papers A* 1A 5C 1Journal 119Unranked 66
YearRankTypeTitle / Venue / Authors
2026 conf
ISSCC
Ji-Won Moon, TaeHyeon Kim, Minwook Kim, Hyeonwoo Seong, Jewon Lee, Jeongbin Park, Dongjun Park, Jaehoon Lee, Jung-June Park, Chiweon Yoon, Jae-Yoon Sim, Seon-Kyoo Lee
2026 conf
ISSCC
Byeong-Chan Kim, Kyongsu Lee, Dongjun Park, Jung-June Park, Chiweon Yoon, Jae-Yoon Sim, Seon-Kyoo Lee
2026 J jnl
IEEE J. Solid State Circuits
Jaeho Lee, Kyongsu Lee, Jae-Yoon Sim, Seon-Kyoo Lee
2026 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Jahyun Koo, Jae-Yoon Sim, Luke Theogarajan
2026 J jnl
IEEE J. Solid State Circuits
Youngwoo Ji, Jiawei Liao, Sina Arjmandpour, Alessandro Novello, Jae-Yoon Sim, Taekwang Jang
2026 J jnl
IEEE Robotics Autom. Lett.
Eui-Chan Kim, JaeYun Sim, Eunseop Song, Seung Yeon Lee, Jae-Yoon Sim, Hyouk Ryeol Choi
2025 J jnl
IEEE Access
Jiho Lee, Jae-Yoon Sim
2025 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Jaeho Lee, Sungbin Park, Jae-Yoon Sim, Youngwoo Ji
2025 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Donggyu Minn, Kiseo Kang, Jaeho Lee, Seongchan Bae, Byungjun Kim, Jaehoon Lee, Jae-Yoon Sim
2025 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Seongchan Bae, Myunghun Kim, Junhee Cho, Moonjoo Lee, Jae-Yoon Sim
2025 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Jahyun Koo, Hyunwoo Son, Jae-Yoon Sim
2025 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Jahyun Koo, Cheonhoo Jeon, Jae-Yoon Sim
2025 J jnl
IEEE J. Solid State Circuits
Kiseo Kang, Seongchan Bae, Donggyu Minn, Jaeho Lee, Jae-Yoon Sim
2025 J jnl
IEICE Electron. Express
Joon-Pyo Hong, Minseob Lee, Jahyun Koo, Jae-Yoon Sim
2025 A conf
ISLPED
Ho-jin Lee, Kyeong-Jun Lee, Jae-Hoon Lee, Kyu-Jin Choi, Geunyong Choi, Youngchang Choi, Kyongsu Lee, Seokhyeong Kang, Jae-Yoon Sim
2025 conf
ASP-DAC
Youngchang Choi, Sejin Park, Ho-jin Lee, Kyongsu Lee, Jae-Yoon Sim, Seokhyeong Kang
2024 conf
VLSI Technology and Circuits
Dongjun Park, Heesung Roh, Seon-Kyoo Lee, Jae-Yoon Sim
2024 conf
VLSI Technology and Circuits
Jaeho Lee, Kyongsu Lee, Jae-Yoon Sim, Seon-Kyoo Lee
2024 conf
VLSI Technology and Circuits
Heesung Roh, Hyun Jin Yoo, Si-Youl Yoo, Seung Hee Pyen, Cheonhoo Jeon, Jae-Yoon Sim
2024 J jnl
IEEE J. Solid State Circuits
Seunghyun Moon, Han-Gyeol Mun, Hyunwoo Son, Jae-Yoon Sim
2024 A conf
DATE
Ho-jin Lee, Kyeong-Jun Lee, Youngchang Choi, Kyongsu Lee, Seokhyeong Kang, Jae-Yoon Sim
2023 conf
VLSI Technology and Circuits
Kyu-Jin Choi, Seungnam Choi, Jae-Yoon Sim
2023 conf
ISSCC
Seunghyun Moon, Han-Gyeol Mun, Hyunwoo Son, Jae-Yoon Sim
2023 conf
VLSI Technology and Circuits
Han-Gyeol Mun, Hyunwoo Son, Seunghyun Moon, Jaehyun Park, Byungjun Kim, Jae-Yoon Sim
2023 conf
VLSI Technology and Circuits
Jaehan Park, Cheonhoo Jeon, Donggyu Minn, Heesung Roh, Jae-Yoon Sim
2023 conf
ESSCIRC
Jaeho Lee, Kiseo Kang, Donggyu Minn, Jae-Yoon Sim
2023 conf
ISSCC
Kiseo Kang, Donggyu Minn, Jaeho Lee, Ho-Jin Song, Moonjoo Lee, Jae-Yoon Sim
2023 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Jaehan Park, Jae-Yoon Sim
2023 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Seongun Bae, Minseob Lee, Sang-Min Yoo, Jae-Yoon Sim
2023 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Han-Gyeol Mun, Seunghyun Moon, Byungjun Kim, Kyeong-Jun Lee, Jae-Yoon Sim
2023 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Jahyun Koo, Jae-Yoon Sim
2023 A conf
ISLPED
Kyeong-Jun Lee, Byungjun Kim, Han-Gyeol Mun, Seunghyun Moon, Jae-Yoon Sim
2022 conf
VLSI Technology and Circuits
Goeun Baek, Seunghun Bae, Minki Lee, Hyuncheol Park, Kangseop Lee, Jae-Yoon Sim, Moonjoo Lee, Ho-Jin Song
2022 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Hwan-Seok Ku, Seungnam Choi, Jae-Yoon Sim
2022 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Youngwoo Ji, Jae-Yoon Sim
2022 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Kyeong-Jun Lee, Seunghyun Moon, Jae-Yoon Sim
2022 J jnl
IEEE J. Solid State Circuits
Kiseo Kang, Donggyu Minn, Seongun Bae, Jaeho Lee, Seokhyeong Kang, Moonjoo Lee, Ho-Jin Song, Jae-Yoon Sim
2022 J jnl
IEEE J. Solid State Circuits
Jaehan Park, Byungjun Kim, Jae-Yoon Sim
2022 conf
ISSCC
Kiseo Kang, Donggyu Minn, Seunghun Bae, Jaeho Lee, Seongun Bae, Gichang Jung, Seokhyeong Kang, Moonjoo Lee, Ho-Jin Song, Jae-Yoon Sim
2022 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Jaehan Park, Byungjun Kim, Jae-Yoon Sim
2022 conf
ISSCC
Youngwoo Ji, Jiawei Liao, Sina Arjmandpour, Alessandro Novello, Jae-Yoon Sim, Taekwang Jang
2022 conf
ISSCC
Kyu-Jin Choi, Jae-Yoon Sim
2022 A* conf
DAC
Sunghye Park, Daeyeon Kim, Minhyuk Kweon, Jae-Yoon Sim, Seokhyeong Kang
2022 J jnl
IEEE Trans. Biomed. Circuits Syst.
Kyu-Jin Choi, Jae-Yoon Sim
2022 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Seunghyun Moon, Kyeong-Jun Lee, Han-Gyeol Mun, Byungjun Kim, Jae-Yoon Sim
2022 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Heesung Roh, Youngwoo Ji, Jae-Yoon Sim
2022 conf
ESSCIRC
Byungjun Kim, Jaehan Park, Seunghyun Moon, Kiseo Kang, Jae-Yoon Sim
2022 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Jahyun Koo, Jae-Yoon Sim
2022 A conf
ICCAD
Sunghye Park, Dohun Kim, Jae-Yoon Sim, Seokhyeong Kang
2022 J jnl
IEEE Trans. Ind. Electron.
Jaeyun Kim, Yong Bum Kim, Dong-Yeop Seok, Seung Yeon Lee, Jae-Yoon Sim, Hyouk Ryeol Choi
2021 J jnl
IEEE J. Solid State Circuits
Cheonhoo Jeon, Jae-Yoon Sim
2021 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Seongun Bae, Minseob Lee, Hwasuk Cho, Jae-Yoon Sim
2021 conf
VLSI Circuits
Kiseo Kang, Byungjun Kim, Gahyun Choi, Sun-Kyung Lee, Jisoo Choi, Jaeho Lee, Seokhyeong Kang, Moonjoo Lee, Ho-Jin Song, Yonuk Chong, Jae-Yoon Sim
2021 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Sooeun Lee, Jaeyoung Seo, Changyoon Han, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2021 conf
ISSCC
Jaehan Park, Jae-Yoon Sim
2020 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Bumjin Park, Youngwoo Ji, Jae-Yoon Sim
2020 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Sooeun Lee, Jaeyoung Seo, Kyunghyun Lim, Jahyun Koo, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2020 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Jaeyoung Seo, Jaehyun Ko, Kyunghyun Lim, Sooeun Lee, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2020 J jnl
IEEE Access
Ji-Hoon Lee, Jaehyun Ko, Kwangmin Kim, Minsoo Choi, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2020 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Jaehan Park, Cheolmin Ahn, Jaehyeong Hong, Jae-Yoon Sim
2020 J jnl
IEEE J. Solid State Circuits
Cheonhoo Jeon, Jahyun Koo, Kyongsu Lee, Minseob Lee, Su-Kyoung Kim, Sangbaie Shin, Sei Kwang Hahn, Jae-Yoon Sim
2020 J jnl
Microelectron. J.
Jaehyeong Hong, Dong Hoon Baek, Hyunwoo Son, Cheolmin Ahn, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2020 J jnl
IEEE Trans. Circuits Syst.
Cheolmin Ahn, Jaehyeong Hong, Jongshin Shin, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2020 conf
ISOCC
Kyongsu Lee, Jae-Yoon Sim
2020 J jnl
IEEE Trans. Circuits Syst.
Seong-Eun Cho, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2019 J jnl
IEEE J. Solid State Circuits
Minseob Lee, Shinwoong Kim, Hong-June Park, Jae-Yoon Sim
2019 conf
VLSI Circuits
Cheonhoo Jeon, Jahyun Koo, Kyongsu Lee, Su-Kyoung Kim, Sei Kwang Hahn, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2019 J jnl
IEEE J. Solid State Circuits
Youngwoo Ji, Jungho Lee, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2019 conf
ISSCC
Youngwoo Ji, Jungho Lee, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2019 J jnl
IEICE Trans. Electron.
Kyongsu Lee, Jae-Yoon Sim
2019 J jnl
IEEE Trans. Biomed. Circuits Syst.
Hyunwoo Son, Hwasuk Cho, Jungho Lee, Seongun Bae, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2019 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Jahyun Koo, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2019 J jnl
IEEE J. Solid State Circuits
Hong-June Park, Jae-Yoon Sim, Robert Chen-Hao Chang
2018 conf
ISSCC
Minseob Lee, Shinwoong Kim, Hwasuk Cho, Jahyun Koo, Kwang-Hee Choi, Jin-Hyeok Choi, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2018 conf
ASP-DAC
Ji-Hoon Lee, Kwangmin Kim, Minsoo Choi, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2018 conf
ISSCC
Sooeun Lee, Jaeyoung Seo, Kyunghyun Lim, Jaehyun Ko, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2018 conf
ASP-DAC
Youngwoo Ji, Cheonhoo Jeon, Hyunwoo Son, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2018 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Kwangmin Kim, Seokjoon Kang, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2018 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Youngwoo Ji, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2018 J jnl
IEEE J. Solid State Circuits
Il-Min Yi, Min-Kyun Chae, Seok-Hun Hyun, Seung-Jun Bae, Jung-Hwan Choi, Seong-Jin Jang, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2018 conf
ASP-DAC
Hyunwoo Son, Hwasuk Cho, Jahyun Koo, Youngwoo Ji, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2018 J jnl
IEEE J. Solid State Circuits
Seungnam Choi, Hwan-Seok Ku, Hyunwoo Son, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2018 J jnl
IEEE J. Solid State Circuits
Minsoo Choi, Sooeun Lee, Myungguk Lee, Ji-Hoon Lee, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2018 J jnl
IEEE Trans. Biomed. Circuits Syst.
Hwasuk Cho, Hyunwoo Son, Kihwan Seong, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2017 conf
ISSCC
Il-Min Yi, Min-Kyun Chae, Seok-Hun Hyun, Seung-Jun Bae, Jung-Hwan Choi, Seong-Jin Jang, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2017 conf
ISSCC
Jahyun Koo, Kyoung-sik Moon, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2017 conf
ISSCC
Youngwoo Ji, Cheonhoo Jeon, Hyunwoo Son, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2017 conf
ISSCC
Hwasuk Cho, Kihwan Seong, Kwang-Hee Choi, Jin-Hyeok Choi, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2017 conf
A-SSCC
Myungguk Lee, Seungho Han, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2017 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Seunghwan Hong, Shinwoong Kim, Seungnam Choi, Hwasuk Cho, Jaehyeong Hong, Young Hun Seo, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2017 J jnl
IEEE Trans. Biomed. Circuits Syst.
Hyunwoo Son, Hwasuk Cho, Jahyun Koo, Youngwoo Ji, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2017 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Young-Ho Choi, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2017 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Seungnam Choi, Yunjae Suh, Joohyun Lee, Jinkyu Kim, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2017 J jnl
IEEE Trans. Biomed. Circuits Syst.
Yoon-Jee Kim, Sung-Eun Cho, Ji-Yong Um, Min-Kyun Chae, Jihoon Bang, Jongkeun Song, Taeho Jeon, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2017 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Kihwan Seong, Won-Cheol Lee, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2017 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Jaeyoung Seo, Minsoo Choi, Sanquan Song, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2017 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Yelim Youn, Kwangmin Kim, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2016 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Seungnam Choi, Hyunwoo Son, Jongshin Shin, Sang-Hyun Lee, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2016 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Kyongsu Lee, Jae-Yoon Sim
2016 J jnl
IEEE J. Solid State Circuits
Shinwoong Kim, Seunghwan Hong, Kapseok Chang, Hyungsik Ju, Jaewook Shin, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2016 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Il-Min Yi, Soo-Min Lee, Seung-Jun Bae, Young-Soo Sohn, Jung-Hwan Choi, Seong-Jin Jang, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2016 J jnl
IEEE J. Solid State Circuits
Seungho Han, Sooeun Lee, Minsoo Choi, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2016 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Ji-Hoon Lim, Jun-Hyun Bae, Jaemin Jang, Hae-Kang Jung, Hyunbae Lee, Yongju Kim, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2016 J jnl
J. Circuits Syst. Comput.
Dong-Woo Jee, Yunjae Suh, Hong-June Park, Jae-Yoon Sim
2016 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Yunjae Suh, Seungnam Choi, Jae-Yoon Sim
2016 J jnl
IEEE J. Solid State Circuits
Soo-Min Lee, Ji-Hoon Lim, Il-Min Yi, Young Jae Jang, Hae-Kang Jung, Kyunghoon Kim, Dae-Han Kwon, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2016 conf
VLSI Circuits
Il-Min Yi, Seung-Jun Bae, Min-Kyun Chae, Soo-Min Lee, Young Jae Jang, Young-Chul Cho, Young-Soo Sohn, Jung-Hwan Choi, Seong-Jin Jang, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2016 conf
APCCAS
Young Jae Jang, Seong-Eun Cho, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2016 conf
A-SSCC
Young-Ho Choi, Kihwan Seong, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2016 conf
ISOCC
Kihwan Seong, Won-Cheol Lee, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2015 conf
ISSCC
Jongmi Lee, Youngwoo Ji, Seungnam Choi, Young-Chul Cho, Seong-Jin Jang, Joo-Sun Choi, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2015 A conf
ICCAD
Sooeun Lee, Gunbok Lee, Jae-Yoon Sim, Hong-June Park, Wee Sang Park, Byungsub Kim
2015 J jnl
IEEE Trans. Biomed. Circuits Syst.
Ji-Yong Um, Yoon-Jee Kim, Seong-Eun Cho, Min-Kyun Chae, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2015 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Minsoo Choi, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2015 conf
BioCAS
Inhee Lee, Wanyeong Jung, Hyunsoo Ha, Seokhyeon Jeong, Yejoong Kim, Gyouho Kim, Zhiyoong Foo, Jae-Yoon Sim, Dennis Sylvester, David T. Blaauw
2015 J jnl
IEEE J. Solid State Circuits
Dong-Woo Jee, Dennis Sylvester, David T. Blaauw, Jae-Yoon Sim
2014 conf
ISSCC
Hyunsoo Ha, Dennis Sylvester, David T. Blaauw, Jae-Yoon Sim
2014 conf
ISSCC
Dong Hoon Baek, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2014 conf
ISSCC
Seungho Han, Sooeun Lee, Minsoo Choi, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2014 conf
ISSCC
Ji-Yong Um, Eun-Woo Song, Yoon-Jee Kim, Seong-Eun Cho, Min-Kyun Chae, Jongkeun Song, Bae-Hyung Kim, Seunghun Lee, Jihoon Bang, Youngil Kim, Kyungil Cho, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2014 C conf
ISCAS
Jae-Seung Lee, Dong-Hee Yeo, Sang-Soo Lee, Hye-Jung Kwon, Jae-Yoon Sim, Byungsub Kim, Hong-June Park
2014 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Hyunsoo Ha, Seon-Kyoo Lee, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2014 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Il-Min Yi, Soo-Min Lee, Seung-Jun Bae, Young-Soo Sohn, Jung-Hwan Choi, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2014 J jnl
IEEE J. Solid State Circuits
Seokhyeon Jeong, Zhiyoong Foo, Yoonmyung Lee, Jae-Yoon Sim, David T. Blaauw, Dennis Sylvester
2014 conf
CICC
Yunjae Suh, Seungnam Choi, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2014 J jnl
IEEE J. Solid State Circuits
Soo-Min Lee, Il-Min Yi, Hae-Kang Jung, Hyunbae Lee, Yong-Ju Kim, Yunsaing Kim, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2014 J jnl
IEEE Trans. Biomed. Circuits Syst.
Ji-Yong Um, Yoon-Jee Kim, Seong-Eun Cho, Min-Kyun Chae, Jongkeun Song, Bae-Hyung Kim, Seung-Hun Lee, Jihoon Bang, Youngil Kim, Kyungil Cho, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2014 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Minsoo Choi, Jae-Yoon Sim, Hong-June Park, Byungsub Kim
2014 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Hye-Jung Kwon, Jae-Seung Lee, Byungsub Kim, Jae-Yoon Sim, Hong-June Park
2014 conf
CICC
Inhee Lee, Yejoong Kim, Suyoung Bang, Gyouho Kim, Hyunsoo Ha, Yen-Po Chen, Dongsuk Jeon, Seokhyun Jeong, Wanyeong Jung, Mohammad Hassan Ghaed, Zhiyoong Foo, Yoonmyung Lee, Jae-Yoon Sim, Dennis Sylvester, David T. Blaauw
2014 J jnl
IEEE J. Solid State Circuits
Seung-Hun Lee, Seon-Kyoo Lee, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2014 J jnl
IEEE Trans. Very Large Scale Integr. Syst.
Kyongsu Lee, Jae-Yoon Sim
2013 conf
CICC
Yen-Po Chen, Yoonmyung Lee, Jae-Yoon Sim, Massimo Alioto, David T. Blaauw, Dennis Sylvester
2013 conf
CICC
Seokhyeon Jeong, Jae-Yoon Sim, David T. Blaauw, Dennis Sylvester
2013 conf
ISSCC
Dong-Woo Jee, Dennis Sylvester, David T. Blaauw, Jae-Yoon Sim
2013 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Yunjae Suh, Jongmi Lee, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2013 conf
ISSCC
Soo-Min Lee, Jong-Hoon Kim, Jong-Sam Kim, Yunsaing Kim, Hyunbae Lee, Jae-Yoon Sim, Hong-June Park
2013 J jnl
IEEE J. Solid State Circuits
Jun-Seok Kim, Young Hun Seo, Yunjae Suh, Hong-June Park, Jae-Yoon Sim
2013 J jnl
IEEE J. Solid State Circuits
Seon-Kyoo Lee, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2013 conf
ISSCC
Seon-Kyoo Lee, Seung-Hun Lee, Dennis Sylvester, David T. Blaauw, Jae-Yoon Sim
2013 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Ji-Yong Um, Yoon-Jee Kim, Eun-Woo Song, Jae-Yoon Sim, Hong-June Park
2013 J jnl
IEEE J. Solid State Circuits
Dong-Woo Jee, Yunjae Suh, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2013 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Seon-Kyoo Lee, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2012 conf
CICC
Hyunsoo Ha, Yunjae Suh, Seon-Kyoo Lee, Hong-June Park, Jae-Yoon Sim
2012 J jnl
IEEE J. Solid State Circuits
Young Hun Seo, Jun-Seok Kim, Hong-June Park, Jae-Yoon Sim
2012 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Dong-Woo Jee, Byungsub Kim, Hong-June Park, Jae-Yoon Sim
2012 J jnl
IEEE J. Solid State Circuits
Dong-Woo Jee, Young Hun Seo, Hong-June Park, Jae-Yoon Sim
2012 conf
ISSCC
Seon-Kyoo Lee, Hyunsoo Ha, Hong-June Park, Jae-Yoon Sim
2012 J jnl
IEEE J. Solid State Circuits
Hae-Kang Jung, Il-Min Yi, Soo-Min Lee, Jae-Yoon Sim, Hong-June Park
2012 conf
ISOCC
Young-Ho Choi, Jae-Yoon Sim, Hong-June Park
2012 conf
ISSCC
Young-Sik Kim, Seon-Kyoo Lee, Seung-Jun Bae, Young-Soo Sohn, Jung-Bae Lee, Joo-Sun Choi, Hong-June Park, Jae-Yoon Sim
2012 conf
ISOCC
Il-Min Yi, Seung-Jun Bae, Young-Soo Sohn, Jae-Yoon Sim, Hong-June Park
2012 J jnl
J. Electr. Comput. Eng.
Woogeun Rhee, Antonio Liscidini, Jae-Yoon Sim, Kenichi Okada, Sudhakar Pamarti
2011 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Jong-Hoon Kim, Jung-Bum Shin, Jae-Yoon Sim, Hong-June Park
2011 conf
ISSCC
Dong-Woo Jee, Yunjae Suh, Hong-June Park, Jae-Yoon Sim
2011 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Young Hun Seo, Seon-Kyoo Lee, Jae-Yoon Sim
2011 J jnl
IEEE J. Solid State Circuits
Young-Sang Kim, Seon-Kyoo Lee, Hong-June Park, Jae-Yoon Sim
2011 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Hyung-Joon Chi, Young-Ho Choi, Soo-Min Lee, Jae-Yoon Sim, Hong-June Park, Jong-Jin Lim, Pil-Sung Kang, Bu-Yeol Lee, Jin-Cheol Hong, Hee-Sub Lee
2011 J jnl
IEEE J. Solid State Circuits
Seon-Kyoo Lee, Seung-Jin Park, Hong-June Park, Jae-Yoon Sim
2011 J jnl
IEEE J. Solid State Circuits
Hyung-Joon Chi, Jae-Seung Lee, Seong-Hwan Jeon, Seung-Jun Bae, Young-Soo Sohn, Jae-Yoon Sim, Hong-June Park
2011 J jnl
J. Electr. Comput. Eng.
Seon-Kyoo Lee, Young-Sang Kim, Hong-June Park, Jae-Yoon Sim
2011 conf
A-SSCC
Hye-Jung Kwon, Jae-Seung Lee, Jae-Yoon Sim, Hong-June Park
2011 conf
A-SSCC
Ji-Yong Um, Jae-Hwan Kim, Jae-Yoon Sim, Hong-June Park
2011 conf
ISOCC
Jae-Hwan Kim, Ji-Yong Um, Jae-Yoon Sim, Hong-June Park
2010 J jnl
IEEE J. Solid State Circuits
Seon-Kyoo Lee, Young Hun Seo, Hong-June Park, Jae-Yoon Sim
2010 conf
ISSCC
Seon-Kyoo Lee, Young Hun Seo, Yunjae Suh, Hong-June Park, Jae-Yoon Sim
2010 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Young Hun Seo, Young-Sang Kim, Hong-June Park, Jae-Yoon Sim
2010 J jnl
IEICE Trans. Electron.
Jun-Hyun Bae, Sang-Hune Park, Jae-Yoon Sim, Hong-June Park
2010 J jnl
IEICE Trans. Electron.
Jae-Seung Lee, Jae-Yoon Sim, Hong-June Park
2010 conf
CICC
Jun-Hyun Bae, Young-Soo Sohn, Seung-Jun Bae, Kwang-Il Park, Joo-Sun Choi, Young-Hyun Jun, Jae-Yoon Sim, Hong-June Park
2010 conf
CICC
Hae-Kang Jung, Soo-Min Lee, Jae-Yoon Sim, Hong-June Park
2010 J jnl
IEICE Trans. Electron.
Young-Sang Kim, Yunjae Suh, Hong-June Park, Jae-Yoon Sim
2009 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Seung-Jun Bae, Hyung-Joon Chi, Young-Soo Sohn, Jae-Seung Lee, Jae-Yoon Sim, Hong-June Park
2009 J jnl
IEEE J. Solid State Circuits
Hae-Kang Jung, Kyoungho Lee, Jong-Sam Kim, Jae-Jin Lee, Jae-Yoon Sim, Hong-June Park
2009 conf
ISSCC
Seon-Kyoo Lee, Young-Sang Kim, Hyunsoo Ha, Young Hun Seo, Hong-June Park, Jae-Yoon Sim
2009 J jnl
IEICE Trans. Electron.
Seung-Jin Park, Young Hun Seo, Hong-June Park, Jae-Yoon Sim
2009 J jnl
IEEE Trans. Circuits Syst. I Regul. Pap.
Kwang-Hee Choi, Jung-Bum Shin, Jae-Yoon Sim, Hong-June Park
2008 conf
ISSCC
Hyung-Joon Chi, Jae-Seung Lee, Seong-Hwan Jeon, Seung-Jun Bae, Jae-Yoon Sim, Hong-June Park
2008 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Sang-Hune Park, Kwang-Hee Choi, Jung-Bum Shin, Jae-Yoon Sim, Hong-June Park
2008 conf
CICC
Dong-Woo Jee, Seung-Jin Park, Hong-June Park, Jae-Yoon Sim
2008 J jnl
IEICE Trans. Electron.
Young-Sang Kim, Yunjae Suh, Hong-June Park, Jae-Yoon Sim
2007 conf
ISSCC
Young-Sang Kim, Seung-Jin Park, Yong-Sub Kim, Dong-Bi Jang, Seh-Woong Jeong, Hong-June Park, Jae-Yoon Sim
2007 J jnl
IEICE Trans. Electron.
Young-Chan Jang, Jun-Hyun Bae, Sang-Hune Park, Jae-Yoon Sim, Hong-June Park
2007 conf
CICC
Jun-Hyun Bae, Jin-Ho Seo, Hwan-Seok Yeo, Jae-Whui Kim, Jae-Yoon Sim, Hong-June Park
2007 J jnl
IEEE Trans. Circuits Syst. II Express Briefs
Jae-Yoon Sim
2006 J jnl
IEICE Trans. Electron.
Jae-Yoon Sim
2005 J jnl
IEEE J. Solid State Circuits
Jae-Yoon Sim, Won Namgoong
2004 J jnl
IEEE J. Solid State Circuits
Jae-Yoon Sim, Kee-Won Kwon, Ki-Chul Chun
2003 J jnl
IEEE J. Solid State Circuits
Jae-Yoon Sim, Hongil Yoon, Ki-Chul Chun, Hyun-Seok Lee, Sang-Pyo Hong, Kyu-Chan Lee, Jei-Hwan Yoo, Dong-Il Seo, Soo-In Cho
2002 J jnl
IEEE J. Solid State Circuits
Jae-Yoon Sim, Jang-Jin Nam, Young-Soo Sohn, Hong-June Park, Chang-Hyun Kim, Soo-In Cho
1999 J jnl
IEEE J. Solid State Circuits
Jae-Yoon Sim, Young-Soo Sohn, Seung-Chan Heo, Hong-June Park, Soo-In Cho
1997 J jnl
IEEE J. Solid State Circuits
Young-Hee Kim, Jae-Yoon Sim, Hong June Park, Jae-Ik Doh, Kun-Woo Park, Hyun-Woong Chung, Jong-Hoon Oh, Choon-Sik Oh, Seung-Han Ahn
tests/unit/test_apk_process_method.py
← Index tests/unit/test_apk_process_method.py python
"""Mock-based tests for APKCodeAnalyzer._process_method and androguard integration.

Tests the boundary between our code and androguard objects, covering:
- xref extraction (get_xref_from / get_xref_to) for both 4.x and 3.x APIs
- external method skipping
- library method filtering
- smali lookup and androguard fallback disassembly
- deduplication of content hashes
- full output population (all result dict keys)
- minimum instruction filtering
"""
from dataclasses import dataclass
from typing import List
from unittest.mock import MagicMock, Mock, patch, PropertyMock

import pytest

pytestmark = [pytest.mark.unit, pytest.mark.apk, pytest.mark.decompile]


# ---------------------------------------------------------------------------
# Helpers: build mock androguard objects
# ---------------------------------------------------------------------------

SAMPLE_SMALI_BODY = """\
.locals 2
const/4 v0, 0x0
invoke-virtual {p0, v0}, Lcom/example/Foo;->bar(I)V
iget-object v1, p0, Lcom/example/Foo;->name:Ljava/lang/String;
add-int v0, v0, v1
return-void
"""

SAMPLE_JAVA_SOURCE = """\
public void doStuff() {
    int x = 0;
    bar(x);
    String n = this.name;
    x = x + n;
}
"""


def _make_encoded_method(
    class_name="Lcom/example/Foo;",
    method_name="doStuff",
    descriptor="()V",
    code=None,
):
    """Create a mock EncodedMethod."""
    enc = MagicMock()
    enc.get_class_name.return_value = class_name
    enc.get_name.return_value = method_name
    enc.get_descriptor.return_value = descriptor
    enc.get_code.return_value = code
    return enc


def _make_xref_entry_4x(class_name, method_name, offset=0):
    """Create a mock xref tuple in androguard 4.x format.

    4.x: (ClassAnalysis, MethodAnalysis, offset)
    MethodAnalysis has .get_method() returning the EncodedMethod.
    """
    ref_class = MagicMock()
    ref_method = MagicMock()
    inner_enc = MagicMock()
    inner_enc.get_class_name.return_value = class_name
    inner_enc.get_name.return_value = method_name
    ref_method.get_method.return_value = inner_enc
    # Remove direct get_class_name/get_name to simulate 4.x behavior
    del ref_method.get_class_name
    del ref_method.get_name
    return (ref_class, ref_method, offset)


def _make_xref_entry_3x(class_name, method_name, offset=0):
    """Create a mock xref tuple in androguard 3.x format.

    3.x: (ClassAnalysis, EncodedMethod, offset)
    EncodedMethod has .get_class_name() and .get_name() directly.
    """
    ref_class = MagicMock()
    ref_method = MagicMock(spec=[
        "get_class_name", "get_name",
    ])
    ref_method.get_class_name.return_value = class_name
    ref_method.get_name.return_value = method_name
    return (ref_class, ref_method, offset)


def _make_method_analysis(
    encoded=None,
    is_external=False,
    xref_from=None,
    xref_to=None,
):
    """Create a mock MethodAnalysis."""
    method = MagicMock()
    method.is_external.return_value = is_external
    method.get_method.return_value = encoded or _make_encoded_method()
    method.get_xref_from.return_value = xref_from or []
    method.get_xref_to.return_value = xref_to or []
    return method


def _make_analyzer(min_instructions=1):
    """Create an APKCodeAnalyzer with mocked dependencies."""
    with patch(
        "redb.extractors.decompiler.apk.analyzer.JADXDecompiler"
    ), patch(
        "redb.extractors.decompiler.apk.analyzer.ApktoolDisassembler"
    ):
        from redb.extractors.decompiler.apk.analyzer import APKCodeAnalyzer
        analyzer = APKCodeAnalyzer("/fake/path.apk")
        analyzer.min_instructions = min_instructions
        analyzer.library_filter = MagicMock()
        analyzer.library_filter.is_library.return_value = False
        return analyzer


def _empty_results():
    """Create a fresh empty results dict."""
    return {
        "decompiled_content": [],
        "decompiled_refs": [],
        "smali_content": [],
        "smali_refs": [],
        "similarity_metrics": [],
        "cfg": [],
        "analysis_errors": [],
    }


def _make_smali_method(body=SAMPLE_SMALI_BODY, instruction_count=5):
    """Create a mock SmaliMethod."""
    m = MagicMock()
    m.body = body
    m.instruction_count = instruction_count
    m.register_count = 2
    return m


# ---------------------------------------------------------------------------
# Tests: xref extraction
# ---------------------------------------------------------------------------

class TestXrefExtraction:
    """Tests that xrefs are correctly extracted from androguard objects."""

    def test_xref_from_androguard_4x(self):
        """4.x: ref_method.get_method().get_class_name() path."""
        analyzer = _make_analyzer()
        results = _empty_results()
        method_key = "Lcom/example/Foo;->doStuff()V"

        xref_from = [
            _make_xref_entry_4x("Lcom/example/Caller;", "init", 42),
            _make_xref_entry_4x("Lcom/example/Other;", "run", 100),
        ]
        method = _make_method_analysis(xref_from=xref_from)

        smali_methods = {method_key: _make_smali_method()}
        java_methods = {"com.example.Foo.doStuff": SAMPLE_JAVA_SOURCE}

        analyzer._process_method(
            method, smali_methods, java_methods,
            results, set(), set(),
        )

        assert len(results["decompiled_refs"]) == 1
        ref = results["decompiled_refs"][0]
        assert ref["functions_caller"] == [
            "Lcom/example/Caller;->init",
            "Lcom/example/Other;->run",
        ]

    def test_xref_to_androguard_4x(self):
        """4.x: callees extracted via get_method() unwrap."""
        analyzer = _make_analyzer()
        results = _empty_results()
        method_key = "Lcom/example/Foo;->doStuff()V"

        xref_to = [
            _make_xref_entry_4x("Lcom/example/Dep;", "calculate", 10),
        ]
        method = _make_method_analysis(xref_to=xref_to)

        smali_methods = {method_key: _make_smali_method()}
        java_methods = {"com.example.Foo.doStuff": SAMPLE_JAVA_SOURCE}

        analyzer._process_method(
            method, smali_methods, java_methods,
            results, set(), set(),
        )

        ref = results["decompiled_refs"][0]
        assert ref["functions_call"] == ["Lcom/example/Dep;->calculate"]

    def test_xref_from_androguard_3x_fallback(self):
        """3.x: ref_method.get_class_name() direct access fallback."""
        analyzer = _make_analyzer()
        results = _empty_results()
        method_key = "Lcom/example/Foo;->doStuff()V"

        xref_from = [
            _make_xref_entry_3x("Lcom/example/OldCaller;", "legacy"),
        ]
        method = _make_method_analysis(xref_from=xref_from)

        smali_methods = {method_key: _make_smali_method()}
        java_methods = {"com.example.Foo.doStuff": SAMPLE_JAVA_SOURCE}

        analyzer._process_method(
            method, smali_methods, java_methods,
            results, set(), set(),
        )

        ref = results["decompiled_refs"][0]
        assert ref["functions_caller"] == ["Lcom/example/OldCaller;->legacy"]

    def test_xref_to_androguard_3x_fallback(self):
        """3.x: callees via direct access fallback."""
        analyzer = _make_analyzer()
        results = _empty_results()
        method_key = "Lcom/example/Foo;->doStuff()V"

        xref_to = [
            _make_xref_entry_3x("Lcom/example/OldDep;", "compute"),
        ]
        method = _make_method_analysis(xref_to=xref_to)

        smali_methods = {method_key: _make_smali_method()}
        java_methods = {"com.example.Foo.doStuff": SAMPLE_JAVA_SOURCE}

        analyzer._process_method(
            method, smali_methods, java_methods,
            results, set(), set(),
        )

        ref = results["decompiled_refs"][0]
        assert ref["functions_call"] == ["Lcom/example/OldDep;->compute"]

    def test_empty_xrefs(self):
        """No xrefs produces empty lists, not None."""
        analyzer = _make_analyzer()
        results = _empty_results()
        method_key = "Lcom/example/Foo;->doStuff()V"

        method = _make_method_analysis()
        smali_methods = {method_key: _make_smali_method()}
        java_methods = {"com.example.Foo.doStuff": SAMPLE_JAVA_SOURCE}

        analyzer._process_method(
            method, smali_methods, java_methods,
            results, set(), set(),
        )

        ref = results["decompiled_refs"][0]
        assert ref["functions_caller"] == []
        assert ref["functions_call"] == []

    def test_xref_exception_does_not_crash(self):
        """If get_xref_from() itself throws, method still processes."""
        analyzer = _make_analyzer()
        results = _empty_results()
        method_key = "Lcom/example/Foo;->doStuff()V"

        method = _make_method_analysis()
        method.get_xref_from.side_effect = RuntimeError("xref table corrupt")
        method.get_xref_to.side_effect = RuntimeError("xref table corrupt")

        smali_methods = {method_key: _make_smali_method()}
        java_methods = {"com.example.Foo.doStuff": SAMPLE_JAVA_SOURCE}

        analyzer._process_method(
            method, smali_methods, java_methods,
            results, set(), set(),
        )

        # Method should still be processed with empty xrefs
        assert len(results["smali_refs"]) == 1
        ref = results["decompiled_refs"][0]
        assert ref["functions_caller"] == []
        assert ref["functions_call"] == []

    def test_multiple_xrefs(self):
        """Multiple callers and callees are all captured."""
        analyzer = _make_analyzer()
        results = _empty_results()
        method_key = "Lcom/example/Foo;->doStuff()V"

        xref_from = [
            _make_xref_entry_4x("Lcom/A;", "a1"),
            _make_xref_entry_4x("Lcom/B;", "b1"),
            _make_xref_entry_4x("Lcom/C;", "c1"),
        ]
        xref_to = [
            _make_xref_entry_4x("Lcom/D;", "d1"),
            _make_xref_entry_4x("Lcom/E;", "e1"),
        ]
        method = _make_method_analysis(xref_from=xref_from, xref_to=xref_to)

        smali_methods = {method_key: _make_smali_method()}
        java_methods = {"com.example.Foo.doStuff": SAMPLE_JAVA_SOURCE}

        analyzer._process_method(
            method, smali_methods, java_methods,
            results, set(), set(),
        )

        ref = results["decompiled_refs"][0]
        assert len(ref["functions_caller"]) == 3
        assert len(ref["functions_call"]) == 2


# ---------------------------------------------------------------------------
# Tests: method filtering and skipping
# ---------------------------------------------------------------------------

class TestMethodFiltering:
    """Tests for external/library/min-instruction filtering."""

    def test_external_method_skipped(self):
        """External methods (no code body) produce no output."""
        analyzer = _make_analyzer()
        results = _empty_results()

        method = _make_method_analysis(is_external=True)

        analyzer._process_method(
            method, {}, {}, results, set(), set(),
        )

        assert all(len(v) == 0 for v in results.values())

    def test_library_method_skipped(self):
        """Library methods produce no output."""
        analyzer = _make_analyzer()
        analyzer.library_filter.is_library.return_value = True
        results = _empty_results()

        method = _make_method_analysis()

        analyzer._process_method(
            method, {}, {}, results, set(), set(),
        )

        assert all(len(v) == 0 for v in results.values())

    def test_min_instruction_filter(self):
        """Methods below min_instructions threshold are skipped."""
        analyzer = _make_analyzer(min_instructions=10)
        results = _empty_results()
        method_key = "Lcom/example/Foo;->doStuff()V"

        method = _make_method_analysis()
        # Only 3 instructions — below threshold of 10
        smali_methods = {method_key: _make_smali_method(instruction_count=3)}

        analyzer._process_method(
            method, smali_methods, {}, results, set(), set(),
        )

        assert all(len(v) == 0 for v in results.values())

    def test_method_above_min_instructions_processed(self):
        """Methods at or above threshold are processed."""
        analyzer = _make_analyzer(min_instructions=5)
        results = _empty_results()
        method_key = "Lcom/example/Foo;->doStuff()V"

        method = _make_method_analysis()
        smali_methods = {method_key: _make_smali_method(instruction_count=5)}

        analyzer._process_method(
            method, smali_methods, {}, results, set(), set(),
        )

        assert len(results["smali_content"]) == 1
        assert len(results["smali_refs"]) == 1


# ---------------------------------------------------------------------------
# Tests: smali body lookup and androguard fallback
# ---------------------------------------------------------------------------

class TestSmaliLookup:
    """Tests for smali body lookup from apktool and androguard fallback."""

    def test_apktool_smali_used_when_available(self):
        """When apktool smali is available, it's used."""
        analyzer = _make_analyzer()
        results = _empty_results()
        method_key = "Lcom/example/Foo;->doStuff()V"

        method = _make_method_analysis()
        smali_methods = {method_key: _make_smali_method()}

        analyzer._process_method(
            method, smali_methods, {}, results, set(), set(),
        )

        assert len(results["smali_content"]) == 1
        assert results["smali_content"][0]["smali_method"] == SAMPLE_SMALI_BODY

    def test_androguard_fallback_when_no_apktool(self):
        """When apktool smali is missing, _disassemble_with_androguard is used."""
        analyzer = _make_analyzer()
        results = _empty_results()

        # Create encoded method with code
        instruction1 = MagicMock()
        instruction1.get_name.return_value = "const/4"
        instruction1.get_output.return_value = "v0, 0x0"
        instruction2 = MagicMock()
        instruction2.get_name.return_value = "invoke-virtual"
        instruction2.get_output.return_value = "v0, Lcom/Foo;->bar()V"
        instruction3 = MagicMock()
        instruction3.get_name.return_value = "add-int"
        instruction3.get_output.return_value = "v0, v1, v2"
        instruction4 = MagicMock()
        instruction4.get_name.return_value = "sub-int"
        instruction4.get_output.return_value = "v3, v0, v1"
        instruction5 = MagicMock()
        instruction5.get_name.return_value = "return-void"
        instruction5.get_output.return_value = ""

        code = MagicMock()
        code.get_registers_size.return_value = 4
        bytecode = MagicMock()
        bytecode.get_instructions.return_value = [
            instruction1, instruction2, instruction3, instruction4, instruction5,
        ]
        code.get_bc.return_value = bytecode

        encoded = _make_encoded_method(code=code)
        method = _make_method_analysis(encoded=encoded)

        # Empty smali_methods — forces androguard fallback
        analyzer._process_method(
            method, {}, {}, results, set(), set(),
        )

        assert len(results["smali_content"]) == 1
        body = results["smali_content"][0]["smali_method"]
        assert "const/4" in body
        assert "return-void" in body

    def test_androguard_fallback_no_code(self):
        """When encoded method has no code, method is skipped."""
        analyzer = _make_analyzer()
        results = _empty_results()

        encoded = _make_encoded_method(code=None)
        method = _make_method_analysis(encoded=encoded)

        analyzer._process_method(
            method, {}, {}, results, set(), set(),
        )

        assert all(len(v) == 0 for v in results.values())

    def test_androguard_fallback_bytecode_exception(self):
        """When bytecode iteration throws, method is skipped gracefully."""
        analyzer = _make_analyzer()
        results = _empty_results()

        code = MagicMock()
        code.get_registers_size.return_value = 2
        bytecode = MagicMock()
        bytecode.get_instructions.side_effect = RuntimeError("bad bytecode")
        code.get_bc.return_value = bytecode

        encoded = _make_encoded_method(code=code)
        method = _make_method_analysis(encoded=encoded)

        analyzer._process_method(
            method, {}, {}, results, set(), set(),
        )

        # Should not crash, but no content produced
        assert len(results["smali_content"]) == 0


# ---------------------------------------------------------------------------
# Tests: output population and deduplication
# ---------------------------------------------------------------------------

class TestOutputPopulation:
    """Tests that all result dict keys are correctly populated."""

    def _process_standard_method(self, with_java=True):
        """Helper: process a standard method and return results."""
        analyzer = _make_analyzer()
        results = _empty_results()
        method_key = "Lcom/example/Foo;->doStuff()V"

        xref_from = [_make_xref_entry_4x("Lcom/Caller;", "call")]
        xref_to = [_make_xref_entry_4x("Lcom/Dep;", "dep")]
        method = _make_method_analysis(
            xref_from=xref_from, xref_to=xref_to
        )

        smali_methods = {method_key: _make_smali_method()}
        java_methods = {}
        if with_java:
            java_methods = {"com.example.Foo.doStuff": SAMPLE_JAVA_SOURCE}

        analyzer._process_method(
            method, smali_methods, java_methods,
            results, set(), set(),
        )
        return results

    def test_smali_content_populated(self):
        results = self._process_standard_method()
        assert len(results["smali_content"]) == 1
        entry = results["smali_content"][0]
        assert "smali_method_hash" in entry
        assert entry["smali_method"] == SAMPLE_SMALI_BODY
        assert entry["smali_method_type"] == "USER"
        assert entry["smali_instructions_count"] == 5
        assert isinstance(entry["smali_has_string_encryption"], bool)
        assert isinstance(entry["smali_has_reflection_calls"], bool)
        assert isinstance(entry["smali_excessive_goto_count"], bool)

    def test_smali_refs_populated(self):
        results = self._process_standard_method()
        assert len(results["smali_refs"]) == 1
        ref = results["smali_refs"][0]
        assert "smali_method_hash" in ref
        assert ref["smali_class_name"] == "com.example.Foo"
        assert ref["smali_method_name"] == "doStuff"
        assert ref["smali_method_signature"] == "()V"

    def test_decompiled_content_populated_with_java(self):
        results = self._process_standard_method(with_java=True)
        assert len(results["decompiled_content"]) == 1
        entry = results["decompiled_content"][0]
        assert "decompiled_method_hash" in entry
        assert entry["decompiled_method"] == SAMPLE_JAVA_SOURCE

    def test_decompiled_refs_populated_with_java(self):
        results = self._process_standard_method(with_java=True)
        assert len(results["decompiled_refs"]) == 1
        ref = results["decompiled_refs"][0]
        assert "decompiled_method_hash" in ref
        assert "smali_method_hash" in ref
        assert ref["decompiled_class_name"] == "com.example.Foo"
        assert ref["decompiled_method_name"] == "doStuff"
        assert "decompiled_method_prototype" in ref
        assert ref["functions_caller"] == ["Lcom/Caller;->call"]
        assert ref["functions_call"] == ["Lcom/Dep;->dep"]

    def test_no_decompiled_without_java(self):
        results = self._process_standard_method(with_java=False)
        assert len(results["decompiled_content"]) == 0
        assert len(results["decompiled_refs"]) == 0
        # Smali should still be there
        assert len(results["smali_content"]) == 1

    def test_similarity_metrics_populated(self):
        results = self._process_standard_method()
        assert len(results["similarity_metrics"]) == 1
        sim = results["similarity_metrics"][0]
        assert "smali_method_hash" in sim
        assert "cyclomatic_complexity" in sim
        assert "minhash" in sim
        assert isinstance(sim["minhash"], list)
        # block_count moved to cfg table
        assert "block_count" not in sim

    def test_cfg_entry_populated(self):
        results = self._process_standard_method()
        assert len(results["cfg"]) == 1
        cfg = results["cfg"][0]
        assert "smali_method_hash" in cfg
        assert "block_count" in cfg
        assert "cfg_topology_hash" in cfg
        assert "prime_product_smali" in cfg
        assert "wl_minhash" in cfg
        assert "bb_features" in cfg
        assert isinstance(cfg["bb_features"], list)
        for feat in cfg["bb_features"]:
            assert len(feat) == 8

    def test_smali_deduplication(self):
        """Same smali body processed twice produces one content entry."""
        analyzer = _make_analyzer()
        results = _empty_results()
        method_key = "Lcom/example/Foo;->doStuff()V"
        seen_smali = set()

        method = _make_method_analysis()
        smali_methods = {method_key: _make_smali_method()}

        # Process same method twice
        analyzer._process_method(
            method, smali_methods, {}, results, set(), seen_smali,
        )
        analyzer._process_method(
            method, smali_methods, {}, results, set(), seen_smali,
        )

        # Content deduplicated, but refs are per-call
        assert len(results["smali_content"]) == 1
        assert len(results["smali_refs"]) == 2

    def test_decompiled_deduplication(self):
        """Same Java source processed twice produces one content entry."""
        analyzer = _make_analyzer()
        results = _empty_results()
        method_key = "Lcom/example/Foo;->doStuff()V"
        seen_decompiled = set()
        seen_smali = set()

        method = _make_method_analysis()
        smali_methods = {method_key: _make_smali_method()}
        java_methods = {"com.example.Foo.doStuff": SAMPLE_JAVA_SOURCE}

        analyzer._process_method(
            method, smali_methods, java_methods,
            results, seen_decompiled, seen_smali,
        )
        analyzer._process_method(
            method, smali_methods, java_methods,
            results, seen_decompiled, seen_smali,
        )

        assert len(results["decompiled_content"]) == 1
        assert len(results["decompiled_refs"]) == 2


# ---------------------------------------------------------------------------
# Tests: _disassemble_with_androguard
# ---------------------------------------------------------------------------

class TestDisassembleWithAndroguard:
    """Tests for the androguard bytecode disassembly fallback."""

    def test_no_code_returns_none(self):
        from redb.extractors.decompiler.apk.analyzer import APKCodeAnalyzer
        encoded = _make_encoded_method(code=None)
        body, count, regs = APKCodeAnalyzer._disassemble_with_androguard(encoded)
        assert body is None
        assert count == 0
        assert regs == 0

    def test_no_bytecode_returns_none(self):
        from redb.extractors.decompiler.apk.analyzer import APKCodeAnalyzer
        code = MagicMock()
        code.get_registers_size.return_value = 3
        code.get_bc.return_value = None
        encoded = _make_encoded_method(code=code)

        body, count, regs = APKCodeAnalyzer._disassemble_with_androguard(encoded)
        assert body is None
        assert count == 0
        assert regs == 3

    def test_basic_disassembly(self):
        from redb.extractors.decompiler.apk.analyzer import APKCodeAnalyzer

        instructions = []
        for name, output in [
            ("const/4", "v0, 0x0"),
            ("invoke-virtual", "v0, Lcom/Foo;->bar()V"),
            ("return-void", ""),
        ]:
            instr = MagicMock()
            instr.get_name.return_value = name
            instr.get_output.return_value = output
            instructions.append(instr)

        code = MagicMock()
        code.get_registers_size.return_value = 2
        bytecode = MagicMock()
        bytecode.get_instructions.return_value = instructions
        code.get_bc.return_value = bytecode

        encoded = _make_encoded_method(code=code)
        body, count, regs = APKCodeAnalyzer._disassemble_with_androguard(encoded)

        assert body is not None
        assert count == 3
        assert regs == 2
        assert "const/4" in body
        assert "return-void" in body

    def test_invoke_operands_normalized(self):
        """Androguard invoke output gets braces added around registers."""
        from redb.extractors.decompiler.apk.analyzer import APKCodeAnalyzer

        instr = MagicMock()
        instr.get_name.return_value = "invoke-virtual"
        # Androguard format: no braces
        instr.get_output.return_value = "v0, v1, Lcom/Foo;->bar(I)V"

        code = MagicMock()
        code.get_registers_size.return_value = 2
        bytecode = MagicMock()
        bytecode.get_instructions.return_value = [instr]
        code.get_bc.return_value = bytecode

        encoded = _make_encoded_method(code=code)
        body, count, regs = APKCodeAnalyzer._disassemble_with_androguard(encoded)

        # Should be normalized to apktool format with braces
        assert "{v0, v1}" in body

    def test_bytecode_exception_returns_none(self):
        from redb.extractors.decompiler.apk.analyzer import APKCodeAnalyzer

        code = MagicMock()
        code.get_registers_size.return_value = 2
        bytecode = MagicMock()
        bytecode.get_instructions.side_effect = RuntimeError("corrupt")
        code.get_bc.return_value = bytecode

        encoded = _make_encoded_method(code=code)
        body, count, regs = APKCodeAnalyzer._disassemble_with_androguard(encoded)

        assert body is None
        assert regs == 2