#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*/ fget(char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
int unziper() {
  char choice[10];
  char firmware[1024];
  char buildCommand[1024];
  printf("\n\nDecompress firmware ?\n");
  printf("1) YES\n");
  printf("2) NO\n");
  fget(choice, 10);
  if (strcmp(choice, "yes") == 0 || strcmp(choice, "1") == 0) {
    printf("Drag the ipsw here : ");
    fget(firmware, 1024);
    printf("Extracting firmware in the IPSW folder...\n");
    sprintf(buildCommand, "bin\\7z.exe x -oIPSW %s", firmware);
    system(buildCommand);
  } else if (strcmp(choice, "no") == 0 || strcmp(choice, "2") == 0) {
  }
  return 0;
}


x86 assembly (clang, -O0):
<unziper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
lea    -0xa(%rbp),%rdi
mov    $0xa,%esi
call   1050 <fget@plt>
lea    -0xa(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11c1 <unziper+0x71>
lea    -0xa(%rbp),%rdi
lea    0xe7a(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1215 <unziper+0xc5>
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   1050 <fget@plt>
lea    0xe5f(%rip),%rdi
call   1040 <printf@plt>
lea    -0x810(%rbp),%rdi
lea    -0x410(%rbp),%rdx
lea    0xe70(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x810(%rbp),%rdi
call   1030 <system@plt>
jmp    1253 <unziper+0x103>
lea    -0xa(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1249 <unziper+0xf9>
lea    -0xa(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    124e <unziper+0xfe>
jmp    124e <unziper+0xfe>
jmp    1253 <unziper+0x103>
xor    %eax,%eax
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unziper>:
push   %r14
push   %rbx
sub    $0x818,%rsp
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <fget@plt>
lea    0xe59(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11f3 <unziper+0x93>
lea    0xe49(%rip),%rsi
lea    0x6(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11f3 <unziper+0x93>
lea    0xe62(%rip),%rsi
lea    0x6(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     123f <unziper+0xdf>
lea    0xe4f(%rip),%rsi
lea    0x6(%rsp),%rdi
call   1070 <strcmp@plt>
jmp    123f <unziper+0xdf>
lea    0xe0c(%rip),%rdi
call   1050 <printf@plt>
lea    0x410(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1060 <fget@plt>
lea    0xe42(%rip),%rdi
call   1030 <puts@plt>
lea    0xdf5(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x818,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0A\0ADecompress firmware ?\0A\00"
@.str.1 = [8 x i8] c"1) YES\0A\00"
@.str.2 = [7 x i8] c"2) NO\0A\00"
@.str.3 = [4 x i8] c"yes\00"
@.str.4 = [2 x i8] c"1\00"
@.str.5 = [22 x i8] c"Drag the ipsw here : \00"
@.str.6 = [43 x i8] c"Extracting firmware in the IPSW folder...\0A\00"
@.str.7 = [23 x i8] c"bin\\7z.exe x -oIPSW %s\00"
@.str.8 = [3 x i8] c"no\00"
@.str.9 = [2 x i8] c"2\00"
define i32 @unziper() {
%1 = alloca [10 x i8]
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%8 = call i32 @fget(i8* %7, i32 10)
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %0
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %26
16: ; preds = %12, %0
%17 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%19 = call i32 @fget(i8* %18, i32 1024)
%20 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0))
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%23 = call i32 @sprintf(i8* %21, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%25 = call i32 @system(i8* %24)
br label %36
26: ; preds = %12
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %26
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %30, %26
br label %35
35: ; preds = %34, %30
br label %36
36: ; preds = %35, %16
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [4 x i8] c"yes\00"
@.str.4 = [2 x i8] c"1\00"
@.str.5 = [22 x i8] c"Drag the ipsw here : \00"
@.str.7 = [23 x i8] c"bin\\7z.exe x -oIPSW %s\00"
@.str.8 = [3 x i8] c"no\00"
@.str.9 = [2 x i8] c"2\00"
@str = [24 x i8] c"\0A\0ADecompress firmware ?\00"
@str.10 = [7 x i8] c"1) YES\00"
@str.11 = [6 x i8] c"2) NO\00"
@str.12 = [42 x i8] c"Extracting firmware in the IPSW folder...\00"
define i32 @unziper() {
%1 = alloca [10 x i8]
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.10, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.11, i64 0, i64 0))
%10 = call i32 @fget(i8* %4, i32 10)
%11 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %0
%14 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %13, %0
%17 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 @fget(i8* %5, i32 1024)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.12, i64 0, i64 0))
%20 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %5)
%21 = call i32 @system(i8* %6)
br label %27
22: ; preds = %13
%23 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %27
27: ; preds = %25, %22, %16
ret i32 0
}