#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ a2h(char *, char **);
int /*<<< orphan*/ nfc_utf8_to_gbk(char *, char **);
int /*<<< orphan*/ strNormal(char *);
scalar_t__ strlen(char *);
int ui_getint(char *);
char *ui_gettext(char *);
int /*<<< orphan*/ ui_settext(char *, char *);
void btnAsc_Click() {
  char *h = ui_gettext("txtHex");
  int do_conv = ui_getint("chkAsUTF8");
  if (strlen(h) == 0)
    return;
  char *s = 0;
  strNormal(h);
  a2h(h, &s);
  if (do_conv) {
    char *u;
    nfc_utf8_to_gbk(s, &u);
    ui_settext("txtAsc", u);
  } else {
    ui_settext("txtAsc", s);
  }
}


x86 assembly (clang, -O0):
<btnAsc_Click>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe81(%rip),%rdi
call   1030 <ui_gettext@plt>
mov    %rax,-0x8(%rbp)
lea    0xe78(%rip),%rdi
call   1070 <ui_getint@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
jne    11af <btnAsc_Click+0x3f>
jmp    1209 <btnAsc_Click+0x99>
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strNormal@plt>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1080 <a2h@plt>
cmpl   $0x0,-0xc(%rbp)
je     11f9 <btnAsc_Click+0x89>
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <nfc_utf8_to_gbk@plt>
mov    -0x20(%rbp),%rsi
lea    0xe22(%rip),%rdi
call   1090 <ui_settext@plt>
jmp    1209 <btnAsc_Click+0x99>
mov    -0x18(%rbp),%rsi
lea    0xe0d(%rip),%rdi
call   1090 <ui_settext@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btnAsc_Click>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xe93(%rip),%rdi
call   1030 <ui_gettext@plt>
mov    %rax,%rbx
lea    0xe8b(%rip),%rdi
call   1060 <ui_getint@plt>
cmpb   $0x0,(%rbx)
je     11d1 <btnAsc_Click+0x71>
mov    %eax,%ebp
movq   $0x0,0x8(%rsp)
mov    %rbx,%rdi
call   1040 <strNormal@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <a2h@plt>
test   %ebp,%ebp
je     11c0 <btnAsc_Click+0x60>
mov    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1050 <nfc_utf8_to_gbk@plt>
mov    0x10(%rsp),%rsi
jmp    11c5 <btnAsc_Click+0x65>
mov    0x8(%rsp),%rsi
lea    0xe45(%rip),%rdi
call   1080 <ui_settext@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"txtHex\00"
@.str.1 = [10 x i8] c"chkAsUTF8\00"
@.str.2 = [7 x i8] c"txtAsc\00"
define void @btnAsc_Click() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = call i8* @ui_gettext(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %1
%6 = call i32 @ui_getint(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i32 %6, i32* %2
%7 = load i8*, i8** %1
%8 = call i64 @strlen(i8* %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %0
br label %26
11: ; preds = %0
store i8* null, i8** %3
%12 = load i8*, i8** %1
%13 = call i32 @strNormal(i8* %12)
%14 = load i8*, i8** %1
%15 = call i32 @a2h(i8* %14, i8** %3)
%16 = load i32, i32* %2
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %11
%19 = load i8*, i8** %3
%20 = call i32 @nfc_utf8_to_gbk(i8* %19, i8** %4)
%21 = load i8*, i8** %4
%22 = call i32 @ui_settext(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %26
23: ; preds = %11
%24 = load i8*, i8** %3
%25 = call i32 @ui_settext(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %10, %23, %18
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"txtHex\00"
@.str.1 = [10 x i8] c"chkAsUTF8\00"
@.str.2 = [7 x i8] c"txtAsc\00"
define void @btnAsc_Click() {
%1 = alloca i8*
%2 = alloca i8*
%3 = tail call i8* @ui_gettext(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @ui_getint(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %22, label %7
7: ; preds = %0
%8 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%9 = tail call i32 @strNormal(i8* %3)
%10 = call i32 @a2h(i8* %3, i8** %1)
%11 = icmp eq i32 %4, 0
br i1 %11, label %18, label %12
12: ; preds = %7
%13 = bitcast i8** %2 to i8*
%14 = load i8*, i8** %1
%15 = call i32 @nfc_utf8_to_gbk(i8* %14, i8** %2)
%16 = load i8*, i8** %2
%17 = call i32 @ui_settext(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %16)
br label %21
18: ; preds = %7
%19 = load i8*, i8** %1
%20 = call i32 @ui_settext(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %18, %12
br label %22
22: ; preds = %0, %21
ret void
}