#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 EXIT_SUCCESS;
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 idevicerestore() {
  char choice[80];
  char ipsw[10];
  char path[1024];
  char buildCommand[1024];
  system("clear");
  printf("1) Restore and keep DATA\n");
  printf("2) Restore device\n");
  printf("3) Restore using a Custom Firmware\n");
  fget(choice, 80);
  if (strcmp(choice, "keep") == 0 || strcmp(choice, "1") == 0) {
    printf("Do you want to use an IPSW file ?\n");
    printf("1) YES\n");
    printf("2) NO\n");
    fget(choice, 10);
    if (strcmp(choice, "yes") == 0 || strcmp(choice, "1") == 0) {
      printf("Drag IPSW here : ");
      fget(path, 1024);
      sprintf(buildCommand, "idevicerestore -d %s", path);
      printf("%s\n", buildCommand);
      system(buildCommand);
    } else {
      printf("Restoring with the latest signed iOS firmware...\n");
      system("idevicerestore -d -l");
    }
  }
  if (strcmp(choice, "restore") == 0 || strcmp(choice, "2") == 0) {
    printf("Do you have an ipsw ?\n");
    printf("1) YES\n");
    printf("2) NO\n");
    fget(ipsw, 80);
    if (strcmp(ipsw, "yes") == 0 || strcmp(ipsw, "1") == 0) {
      printf("Drag IPSW here : ");
      fget(path, 1024);
      sprintf(buildCommand, "idevicerestore -d -e %s", path);
      printf("%s\n", buildCommand);
      system(buildCommand);
    }
    if (strcmp(ipsw, "no") == 0 || strcmp(ipsw, "2") == 0) {
      system("idevicerestore -d  -e -l");
    }
  }
  if (strcmp(choice, "custom") == 0 || strcmp(choice, "3") == 0) {
    printf("Drag custom IPSW here : ");
    fget(path, 1024);
    sprintf(buildCommand, "idevicerestore -d -c %s", path);
    system(buildCommand);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<idevicerestore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x860,%rsp
lea    0xe9e(%rip),%rdi
call   1030 <system@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x50,%esi
call   1050 <fget@plt>
lea    -0x50(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11d3 <idevicerestore+0x83>
lea    -0x50(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12bd <idevicerestore+0x16d>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0xa,%esi
call   1050 <fget@plt>
lea    -0x50(%rbp),%rdi
lea    0xe7a(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     123f <idevicerestore+0xef>
lea    -0x50(%rbp),%rdi
lea    0xe2c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    129e <idevicerestore+0x14e>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x460(%rbp),%rdi
mov    $0x400,%esi
call   1050 <fget@plt>
lea    -0x860(%rbp),%rdi
lea    -0x460(%rbp),%rdx
lea    0xe33(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x860(%rbp),%rsi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x860(%rbp),%rdi
call   1030 <system@plt>
jmp    12b8 <idevicerestore+0x168>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe3e(%rip),%rdi
call   1030 <system@plt>
jmp    12bd <idevicerestore+0x16d>
lea    -0x50(%rbp),%rdi
lea    0xe3e(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     12f1 <idevicerestore+0x1a1>
lea    -0x50(%rbp),%rdi
lea    0xe2c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    13fc <idevicerestore+0x2ac>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x5a(%rbp),%rdi
mov    $0x50,%esi
call   1050 <fget@plt>
lea    -0x5a(%rbp),%rdi
lea    0xd5c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     135d <idevicerestore+0x20d>
lea    -0x5a(%rbp),%rdi
lea    0xd0e(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    13b7 <idevicerestore+0x267>
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x460(%rbp),%rdi
mov    $0x400,%esi
call   1050 <fget@plt>
lea    -0x860(%rbp),%rdi
lea    -0x460(%rbp),%rdx
lea    0xd96(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x860(%rbp),%rsi
lea    0xd17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x860(%rbp),%rdi
call   1030 <system@plt>
lea    -0x5a(%rbp),%rdi
lea    0xd7d(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     13eb <idevicerestore+0x29b>
lea    -0x5a(%rbp),%rdi
lea    0xd32(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    13f7 <idevicerestore+0x2a7>
lea    0xd50(%rip),%rdi
call   1030 <system@plt>
jmp    13fc <idevicerestore+0x2ac>
lea    -0x50(%rbp),%rdi
lea    0xd54(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1430 <idevicerestore+0x2e0>
lea    -0x50(%rbp),%rdi
lea    0xd41(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1475 <idevicerestore+0x325>
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x460(%rbp),%rdi
mov    $0x400,%esi
call   1050 <fget@plt>
lea    -0x860(%rbp),%rdi
lea    -0x460(%rbp),%rdx
lea    0xd19(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x860(%rbp),%rdi
call   1030 <system@plt>
mov    0x2b64(%rip),%rax
mov    (%rax),%eax
add    $0x860,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idevicerestore>:
push   %r14
push   %rbx
sub    $0x868,%rsp
lea    0xe8f(%rip),%rdi
call   1040 <system@plt>
lea    0xf48(%rip),%rdi
call   1030 <puts@plt>
lea    0xf55(%rip),%rdi
call   1030 <puts@plt>
lea    0xf5b(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1060 <fget@plt>
lea    0xe53(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11da <idevicerestore+0x7a>
lea    0xe44(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1299 <idevicerestore+0x139>
lea    0xf48(%rip),%rdi
call   1030 <puts@plt>
lea    0xf5e(%rip),%rdi
call   1030 <puts@plt>
lea    0xf59(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <fget@plt>
lea    0xdf6(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     124f <idevicerestore+0xef>
lea    0xde0(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     124f <idevicerestore+0xef>
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
lea    0xdeb(%rip),%rdi
jmp    1294 <idevicerestore+0x134>
lea    0xdbb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x460(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1060 <fget@plt>
lea    0xdaa(%rip),%rsi
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xdad(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12c9 <idevicerestore+0x169>
lea    0xd9f(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    13ab <idevicerestore+0x24b>
lea    0xe43(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6a(%rip),%rdi
call   1030 <puts@plt>
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1060 <fget@plt>
lea    0xd07(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1329 <idevicerestore+0x1c9>
lea    0xcf1(%rip),%rsi
lea    0x6(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1373 <idevicerestore+0x213>
lea    0xce1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x460(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1060 <fget@plt>
lea    0xd04(%rip),%rsi
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xcf5(%rip),%rsi
lea    0x6(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     139f <idevicerestore+0x23f>
lea    0xcc5(%rip),%rsi
lea    0x6(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    13ab <idevicerestore+0x24b>
lea    0xccc(%rip),%rdi
call   1040 <system@plt>
lea    0xcd9(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     13d7 <idevicerestore+0x277>
lea    0xcca(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1419 <idevicerestore+0x2b9>
lea    0xcb6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x460(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1060 <fget@plt>
lea    0xcac(%rip),%rsi
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
mov    0x2bc0(%rip),%rax
mov    (%rax),%eax
add    $0x868,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [26 x i8] c"1) Restore and keep DATA\0A\00"
@.str.2 = [19 x i8] c"2) Restore device\0A\00"
@.str.3 = [36 x i8] c"3) Restore using a Custom Firmware\0A\00"
@.str.4 = [5 x i8] c"keep\00"
@.str.5 = [2 x i8] c"1\00"
@.str.6 = [35 x i8] c"Do you want to use an IPSW file ?\0A\00"
@.str.7 = [8 x i8] c"1) YES\0A\00"
@.str.8 = [7 x i8] c"2) NO\0A\00"
@.str.9 = [4 x i8] c"yes\00"
@.str.10 = [18 x i8] c"Drag IPSW here : \00"
@.str.11 = [21 x i8] c"idevicerestore -d %s\00"
@.str.12 = [4 x i8] c"%s\0A\00"
@.str.13 = [50 x i8] c"Restoring with the latest signed iOS firmware...\0A\00"
@.str.14 = [21 x i8] c"idevicerestore -d -l\00"
@.str.15 = [8 x i8] c"restore\00"
@.str.16 = [2 x i8] c"2\00"
@.str.17 = [23 x i8] c"Do you have an ipsw ?\0A\00"
@.str.18 = [24 x i8] c"idevicerestore -d -e %s\00"
@.str.19 = [3 x i8] c"no\00"
@.str.20 = [25 x i8] c"idevicerestore -d -e -l\00"
@.str.21 = [7 x i8] c"custom\00"
@.str.22 = [2 x i8] c"3\00"
@.str.23 = [25 x i8] c"Drag custom IPSW here : \00"
@.str.24 = [24 x i8] c"idevicerestore -d -c %s\00"
@EXIT_SUCCESS = global i32 0
define i32 @idevicerestore() {
%1 = alloca [80 x i8]
%2 = alloca [10 x i8]
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%10 = call i32 @fget(i8* %9, i32 80)
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %0
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %46
18: ; preds = %14, %0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%23 = call i32 @fget(i8* %22, i32 10)
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %31, label %27
27: ; preds = %18
%28 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %42
31: ; preds = %27, %18
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%34 = call i32 @fget(i8* %33, i32 1024)
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%37 = call i32 @sprintf(i8* %35, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i8* %36)
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %38)
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%41 = call i32 @system(i8* %40)
br label %45
42: ; preds = %27
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.13, i64 0, i64 0))
%44 = call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0))
br label %45
45: ; preds = %42, %31
br label %46
46: ; preds = %45, %14
%47 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %46
%51 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %89
54: ; preds = %50, %46
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.17, i64 0, i64 0))
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%58 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%59 = call i32 @fget(i8* %58, i32 80)
%60 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%61 = call i64 @strcmp(i8* %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%62 = icmp eq i64 %61, 0
br i1 %62, label %67, label %63
63: ; preds = %54
%64 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%65 = call i64 @strcmp(i8* %64, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %78
67: ; preds = %63, %54
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%70 = call i32 @fget(i8* %69, i32 1024)
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%73 = call i32 @sprintf(i8* %71, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), i8* %72)
%74 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %74)
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%77 = call i32 @system(i8* %76)
br label %78
78: ; preds = %67, %63
%79 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%80 = call i64 @strcmp(i8* %79, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0))
%81 = icmp eq i64 %80, 0
br i1 %81, label %86, label %82
82: ; preds = %78
%83 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%84 = call i64 @strcmp(i8* %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %82, %78
%87 = call i32 @system(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.20, i64 0, i64 0))
br label %88
88: ; preds = %86, %82
br label %89
89: ; preds = %88, %50
%90 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%91 = call i64 @strcmp(i8* %90, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0))
%92 = icmp eq i64 %91, 0
br i1 %92, label %97, label %93
93: ; preds = %89
%94 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%95 = call i64 @strcmp(i8* %94, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0))
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %106
97: ; preds = %93, %89
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.23, i64 0, i64 0))
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%100 = call i32 @fget(i8* %99, i32 1024)
%101 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%102 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%103 = call i32 @sprintf(i8* %101, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.24, i64 0, i64 0), i8* %102)
%104 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%105 = call i32 @system(i8* %104)
br label %106
106: ; preds = %97, %93
%107 = load i32, i32* @EXIT_SUCCESS
ret i32 %107
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.4 = [5 x i8] c"keep\00"
@.str.5 = [2 x i8] c"1\00"
@.str.9 = [4 x i8] c"yes\00"
@.str.10 = [18 x i8] c"Drag IPSW here : \00"
@.str.11 = [21 x i8] c"idevicerestore -d %s\00"
@.str.14 = [21 x i8] c"idevicerestore -d -l\00"
@.str.15 = [8 x i8] c"restore\00"
@.str.16 = [2 x i8] c"2\00"
@.str.18 = [24 x i8] c"idevicerestore -d -e %s\00"
@.str.19 = [3 x i8] c"no\00"
@.str.20 = [25 x i8] c"idevicerestore -d -e -l\00"
@.str.21 = [7 x i8] c"custom\00"
@.str.22 = [2 x i8] c"3\00"
@.str.23 = [25 x i8] c"Drag custom IPSW here : \00"
@.str.24 = [24 x i8] c"idevicerestore -d -c %s\00"
@EXIT_SUCCESS = global i32 0
@str = [25 x i8] c"1) Restore and keep DATA\00"
@str.25 = [18 x i8] c"2) Restore device\00"
@str.26 = [35 x i8] c"3) Restore using a Custom Firmware\00"
@str.27 = [22 x i8] c"Do you have an ipsw ?\00"
@str.30 = [34 x i8] c"Do you want to use an IPSW file ?\00"
@str.31 = [7 x i8] c"1) YES\00"
@str.32 = [6 x i8] c"2) NO\00"
@str.33 = [49 x i8] c"Restoring with the latest signed iOS firmware...\00"
define i32 @idevicerestore() {
%1 = alloca [80 x i8]
%2 = alloca [10 x i8]
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.25, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.26, i64 0, i64 0))
%13 = call i32 @fget(i8* %5, i32 80)
%14 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %0
%17 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %38
19: ; preds = %16, %0
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.30, i64 0, i64 0))
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.31, i64 0, i64 0))
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.32, i64 0, i64 0))
%23 = call i32 @fget(i8* %5, i32 10)
%24 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %19
%27 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %26, %19
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
%31 = call i32 @fget(i8* %7, i32 1024)
%32 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i8* %7)
%33 = call i32 @puts(i8* %8)
%34 = call i32 @system(i8* %8)
br label %38
35: ; preds = %26
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.33, i64 0, i64 0))
%37 = call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0))
br label %38
38: ; preds = %29, %35, %16
%39 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %38
%42 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %68
44: ; preds = %41, %38
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.27, i64 0, i64 0))
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.31, i64 0, i64 0))
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.32, i64 0, i64 0))
%48 = call i32 @fget(i8* %6, i32 80)
%49 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %44
%52 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %60
54: ; preds = %51, %44
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
%56 = call i32 @fget(i8* %7, i32 1024)
%57 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), i8* %7)
%58 = call i32 @puts(i8* %8)
%59 = call i32 @system(i8* %8)
br label %60
60: ; preds = %54, %51
%61 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0))
%62 = icmp eq i64 %61, 0
br i1 %62, label %66, label %63
63: ; preds = %60
%64 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %63, %60
%67 = call i32 @system(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.20, i64 0, i64 0))
br label %68
68: ; preds = %63, %66, %41
%69 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0))
%70 = icmp eq i64 %69, 0
br i1 %70, label %74, label %71
71: ; preds = %68
%72 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0))
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %79
74: ; preds = %71, %68
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.23, i64 0, i64 0))
%76 = call i32 @fget(i8* %7, i32 1024)
%77 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.24, i64 0, i64 0), i8* %7)
%78 = call i32 @system(i8* %8)
br label %79
79: ; preds = %74, %71
%80 = load i32, i32* @EXIT_SUCCESS
ret i32 %80
}