#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 idevicediagnostics() {
  char choice[80];
  char cmd[80];
  char buildCommand[1024];
  system("clear");
  printf("1) Print diagnostics informations from device by TYPE (All, WiFi, "
         "GasGauge, NAND)\n");
  printf("2) print mobilegestalt keys passed as arguments seperated by a "
         "space.\n");
  printf("3) print IORegistry of device, optionally by PLANE (IODeviceTree, "
         "IOPower, IOService) (iOS 5+ only)\n");
  printf("4) Shutdown device\n");
  printf("5) Restart device\n");
  printf("6) Put device into sleep mode\n");
  fget(choice, 80);
  if (strcmp(choice, "diagnostics") == 0 || strcmp(choice, "1") == 0) {
    printf("Enter the type of the command : ");
    fget(cmd, 80);
    sprintf(buildCommand, "idevicediagnostics diagnostics -d %s", cmd);
    system(buildCommand);
  }
  if (strcmp(choice, "mobilegestalt") == 0 || strcmp(choice, "2") == 0) {
    printf("Enter the keys : ");
    fget(cmd, 80);
    sprintf(buildCommand, "idevicediagnostics mobilegestalt -d KEY %s", cmd);
    system(buildCommand);
  }
  if (strcmp(choice, "ioreg") == 0 || strcmp(choice, "3") == 0) {
    printf("Enter command : ");
    fget(cmd, 80);
    sprintf(buildCommand, "idevicediagnostics ioreg %s", cmd);
    system(buildCommand);
  }
  if (strcmp(choice, "shutdown") == 0 || strcmp(choice, "4") == 0) {
    printf("The device will shutdown...\n");
    system("idevicediagnostics shutdown");
  }
  if (strcmp(choice, "restart") == 0 || strcmp(choice, "5") == 0) {
    printf("The device will restart...\n");
    system("idevicediagnostics restart");
  }
  if (strcmp(choice, "sleep") == 0 || strcmp(choice, "6") == 0) {
    printf("Putting device into sleep mode...\n");
    system("idevicediagnostics sleep");
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<idevicediagnostics>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4a0,%rsp
lea    0xe9e(%rip),%rdi
call   1030 <system@plt>
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
call   1040 <printf@plt>
lea    0xf1a(%rip),%rdi
call   1040 <printf@plt>
lea    0xf73(%rip),%rdi
call   1040 <printf@plt>
lea    0xf7b(%rip),%rdi
call   1040 <printf@plt>
lea    0xf82(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x50,%esi
call   1050 <fget@plt>
lea    -0x50(%rbp),%rdi
lea    0xf83(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11f1 <idevicediagnostics+0xa1>
lea    -0x50(%rbp),%rdi
lea    0xf75(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1234 <idevicediagnostics+0xe4>
lea    0xf61(%rip),%rdi
call   1040 <printf@plt>
lea    -0xa0(%rbp),%rdi
mov    $0x50,%esi
call   1050 <fget@plt>
lea    -0x4a0(%rbp),%rdi
lea    -0xa0(%rbp),%rdx
lea    0xf57(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x4a0(%rbp),%rdi
call   1030 <system@plt>
lea    -0x50(%rbp),%rdi
lea    0xf60(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1268 <idevicediagnostics+0x118>
lea    -0x50(%rbp),%rdi
lea    0xf54(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12ab <idevicediagnostics+0x15b>
lea    0xf40(%rip),%rdi
call   1040 <printf@plt>
lea    -0xa0(%rbp),%rdi
mov    $0x50,%esi
call   1050 <fget@plt>
lea    -0x4a0(%rbp),%rdi
lea    -0xa0(%rbp),%rdx
lea    0xf27(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x4a0(%rbp),%rdi
call   1030 <system@plt>
lea    -0x50(%rbp),%rdi
lea    0xf36(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     12df <idevicediagnostics+0x18f>
lea    -0x50(%rbp),%rdi
lea    0xf22(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1322 <idevicediagnostics+0x1d2>
lea    0xf0e(%rip),%rdi
call   1040 <printf@plt>
lea    -0xa0(%rbp),%rdi
mov    $0x50,%esi
call   1050 <fget@plt>
lea    -0x4a0(%rbp),%rdi
lea    -0xa0(%rbp),%rdx
lea    0xef4(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x4a0(%rbp),%rdi
call   1030 <system@plt>
lea    -0x50(%rbp),%rdi
lea    0xf26(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1356 <idevicediagnostics+0x206>
lea    -0x50(%rbp),%rdi
lea    0xeda(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    136e <idevicediagnostics+0x21e>
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
call   1030 <system@plt>
lea    -0x50(%rbp),%rdi
lea    0xf14(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     13a2 <idevicediagnostics+0x252>
lea    -0x50(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    13ba <idevicediagnostics+0x26a>
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
call   1030 <system@plt>
lea    -0x50(%rbp),%rdi
lea    0xf08(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     13ee <idevicediagnostics+0x29e>
lea    -0x50(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1406 <idevicediagnostics+0x2b6>
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
call   1030 <system@plt>
mov    0x2bd3(%rip),%rax
mov    (%rax),%eax
add    $0x4a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idevicediagnostics>:
push   %r14
push   %rbx
sub    $0x4a8,%rsp
lea    0xe8f(%rip),%rdi
call   1040 <system@plt>
lea    0xfb5(%rip),%rdi
call   1030 <puts@plt>
lea    0xffb(%rip),%rdi
call   1030 <puts@plt>
lea    0x1035(%rip),%rdi
call   1030 <puts@plt>
lea    0x108d(%rip),%rdi
call   1030 <puts@plt>
lea    0x1094(%rip),%rdi
call   1030 <puts@plt>
lea    0x109a(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1060 <fget@plt>
lea    0xe31(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11f6 <idevicediagnostics+0x96>
lea    0xe29(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1236 <idevicediagnostics+0xd6>
lea    0xe17(%rip),%rdi
call   1050 <printf@plt>
lea    0x50(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
call   1060 <fget@plt>
lea    0xe1a(%rip),%rsi
lea    0xa0(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xe1d(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     125e <idevicediagnostics+0xfe>
lea    0xe17(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    129e <idevicediagnostics+0x13e>
lea    0xe05(%rip),%rdi
call   1050 <printf@plt>
lea    0x50(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
call   1060 <fget@plt>
lea    0xdf9(%rip),%rsi
lea    0xa0(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xe02(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12c6 <idevicediagnostics+0x166>
lea    0xdf4(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1306 <idevicediagnostics+0x1a6>
lea    0xde2(%rip),%rdi
call   1050 <printf@plt>
lea    0x50(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
call   1060 <fget@plt>
lea    0xdd5(%rip),%rsi
lea    0xa0(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xde4(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     132e <idevicediagnostics+0x1ce>
lea    0xdbb(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1346 <idevicediagnostics+0x1e6>
lea    0xf79(%rip),%rdi
call   1030 <puts@plt>
lea    0xd9d(%rip),%rdi
call   1040 <system@plt>
lea    0xdc2(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     136e <idevicediagnostics+0x20e>
lea    0xd99(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1386 <idevicediagnostics+0x226>
lea    0xf1e(%rip),%rdi
call   1030 <puts@plt>
lea    0xd7b(%rip),%rdi
call   1040 <system@plt>
lea    0xd9f(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     13ae <idevicediagnostics+0x24e>
lea    0xd76(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    13c6 <idevicediagnostics+0x266>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
lea    0xd58(%rip),%rdi
call   1040 <system@plt>
mov    0x2c13(%rip),%rax
mov    (%rax),%eax
add    $0x4a8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [83 x i8] c"1) Print diagnostics informations from device by TYPE (All, WiFi, GasGauge, NAND)\0A\00"
@.str.2 = [71 x i8] c"2) print mobilegestalt keys passed as arguments seperated by a space.\0A\00"
@.str.3 = [101 x i8] c"3) print IORegistry of device, optionally by PLANE (IODeviceTree, IOPower, IOService) (iOS 5+ only)\0A\00"
@.str.4 = [20 x i8] c"4) Shutdown device\0A\00"
@.str.5 = [19 x i8] c"5) Restart device\0A\00"
@.str.6 = [31 x i8] c"6) Put device into sleep mode\0A\00"
@.str.7 = [12 x i8] c"diagnostics\00"
@.str.8 = [2 x i8] c"1\00"
@.str.9 = [33 x i8] c"Enter the type of the command : \00"
@.str.10 = [37 x i8] c"idevicediagnostics diagnostics -d %s\00"
@.str.11 = [14 x i8] c"mobilegestalt\00"
@.str.12 = [2 x i8] c"2\00"
@.str.13 = [18 x i8] c"Enter the keys : \00"
@.str.14 = [43 x i8] c"idevicediagnostics mobilegestalt -d KEY %s\00"
@.str.15 = [6 x i8] c"ioreg\00"
@.str.16 = [2 x i8] c"3\00"
@.str.17 = [17 x i8] c"Enter command : \00"
@.str.18 = [28 x i8] c"idevicediagnostics ioreg %s\00"
@.str.19 = [9 x i8] c"shutdown\00"
@.str.20 = [2 x i8] c"4\00"
@.str.21 = [29 x i8] c"The device will shutdown...\0A\00"
@.str.22 = [28 x i8] c"idevicediagnostics shutdown\00"
@.str.23 = [8 x i8] c"restart\00"
@.str.24 = [2 x i8] c"5\00"
@.str.25 = [28 x i8] c"The device will restart...\0A\00"
@.str.26 = [27 x i8] c"idevicediagnostics restart\00"
@.str.27 = [6 x i8] c"sleep\00"
@.str.28 = [2 x i8] c"6\00"
@.str.29 = [35 x i8] c"Putting device into sleep mode...\0A\00"
@.str.30 = [25 x i8] c"idevicediagnostics sleep\00"
@EXIT_SUCCESS = global i32 0
define i32 @idevicediagnostics() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = alloca [1024 x i8]
%4 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%12 = call i32 @fget(i8* %11, i32 80)
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %0
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %29
20: ; preds = %16, %0
%21 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0))
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%23 = call i32 @fget(i8* %22, i32 80)
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%26 = call i32 @sprintf(i8* %24, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%28 = call i32 @system(i8* %27)
br label %29
29: ; preds = %20, %16
%30 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %37, label %33
33: ; preds = %29
%34 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %46
37: ; preds = %33, %29
%38 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0))
%39 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%40 = call i32 @fget(i8* %39, i32 80)
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%42 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%43 = call i32 @sprintf(i8* %41, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.14, i64 0, i64 0), i8* %42)
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%45 = call i32 @system(i8* %44)
br label %46
46: ; preds = %37, %33
%47 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([6 x i8], [6 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 %63
54: ; preds = %50, %46
%55 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0))
%56 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%57 = call i32 @fget(i8* %56, i32 80)
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%59 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%60 = call i32 @sprintf(i8* %58, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.18, i64 0, i64 0), i8* %59)
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%62 = call i32 @system(i8* %61)
br label %63
63: ; preds = %54, %50
%64 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%65 = call i64 @strcmp(i8* %64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.19, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %71, label %67
67: ; preds = %63
%68 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%69 = call i64 @strcmp(i8* %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0))
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %67, %63
%72 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.21, i64 0, i64 0))
%73 = call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.22, i64 0, i64 0))
br label %74
74: ; preds = %71, %67
%75 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%76 = call i64 @strcmp(i8* %75, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.23, i64 0, i64 0))
%77 = icmp eq i64 %76, 0
br i1 %77, label %82, label %78
78: ; preds = %74
%79 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%80 = call i64 @strcmp(i8* %79, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.24, i64 0, i64 0))
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %78, %74
%83 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.25, i64 0, i64 0))
%84 = call i32 @system(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.26, i64 0, i64 0))
br label %85
85: ; preds = %82, %78
%86 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%87 = call i64 @strcmp(i8* %86, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.27, i64 0, i64 0))
%88 = icmp eq i64 %87, 0
br i1 %88, label %93, label %89
89: ; preds = %85
%90 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%91 = call i64 @strcmp(i8* %90, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.28, i64 0, i64 0))
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %96
93: ; preds = %89, %85
%94 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.29, i64 0, i64 0))
%95 = call i32 @system(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.30, i64 0, i64 0))
br label %96
96: ; preds = %93, %89
%97 = load i32, i32* @EXIT_SUCCESS
ret i32 %97
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.7 = [12 x i8] c"diagnostics\00"
@.str.8 = [2 x i8] c"1\00"
@.str.9 = [33 x i8] c"Enter the type of the command : \00"
@.str.10 = [37 x i8] c"idevicediagnostics diagnostics -d %s\00"
@.str.11 = [14 x i8] c"mobilegestalt\00"
@.str.12 = [2 x i8] c"2\00"
@.str.13 = [18 x i8] c"Enter the keys : \00"
@.str.14 = [43 x i8] c"idevicediagnostics mobilegestalt -d KEY %s\00"
@.str.15 = [6 x i8] c"ioreg\00"
@.str.16 = [2 x i8] c"3\00"
@.str.17 = [17 x i8] c"Enter command : \00"
@.str.18 = [28 x i8] c"idevicediagnostics ioreg %s\00"
@.str.19 = [9 x i8] c"shutdown\00"
@.str.20 = [2 x i8] c"4\00"
@.str.22 = [28 x i8] c"idevicediagnostics shutdown\00"
@.str.23 = [8 x i8] c"restart\00"
@.str.24 = [2 x i8] c"5\00"
@.str.26 = [27 x i8] c"idevicediagnostics restart\00"
@.str.27 = [6 x i8] c"sleep\00"
@.str.28 = [2 x i8] c"6\00"
@.str.30 = [25 x i8] c"idevicediagnostics sleep\00"
@EXIT_SUCCESS = global i32 0
@str = [82 x i8] c"1) Print diagnostics informations from device by TYPE (All, WiFi, GasGauge, NAND)\00"
@str.31 = [70 x i8] c"2) print mobilegestalt keys passed as arguments seperated by a space.\00"
@str.32 = [100 x i8] c"3) print IORegistry of device, optionally by PLANE (IODeviceTree, IOPower, IOService) (iOS 5+ only)\00"
@str.33 = [19 x i8] c"4) Shutdown device\00"
@str.34 = [18 x i8] c"5) Restart device\00"
@str.35 = [30 x i8] c"6) Put device into sleep mode\00"
@str.36 = [34 x i8] c"Putting device into sleep mode...\00"
@str.37 = [27 x i8] c"The device will restart...\00"
@str.38 = [28 x i8] c"The device will shutdown...\00"
define i32 @idevicediagnostics() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [80 x i8], [80 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 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([82 x i8], [82 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str.31, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @str.32, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.33, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.34, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.35, i64 0, i64 0))
%14 = call i32 @fget(i8* %4, i32 80)
%15 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %0
%18 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %17, %0
%21 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0))
%22 = call i32 @fget(i8* %5, i32 80)
%23 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0), i8* %5)
%24 = call i32 @system(i8* %6)
br label %25
25: ; preds = %20, %17
%26 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %28, %25
%32 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0))
%33 = call i32 @fget(i8* %5, i32 80)
%34 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.14, i64 0, i64 0), i8* %5)
%35 = call i32 @system(i8* %6)
br label %36
36: ; preds = %31, %28
%37 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %36
%40 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %39, %36
%43 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0))
%44 = call i32 @fget(i8* %5, i32 80)
%45 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.18, i64 0, i64 0), i8* %5)
%46 = call i32 @system(i8* %6)
br label %47
47: ; preds = %42, %39
%48 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.19, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %53, label %50
50: ; preds = %47
%51 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %50, %47
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.38, i64 0, i64 0))
%55 = call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.22, i64 0, i64 0))
br label %56
56: ; preds = %53, %50
%57 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.23, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %62, label %59
59: ; preds = %56
%60 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.24, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %59, %56
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.37, i64 0, i64 0))
%64 = call i32 @system(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.26, i64 0, i64 0))
br label %65
65: ; preds = %62, %59
%66 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.27, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %71, label %68
68: ; preds = %65
%69 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.28, i64 0, i64 0))
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %68, %65
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.36, i64 0, i64 0))
%73 = call i32 @system(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.30, i64 0, i64 0))
br label %74
74: ; preds = %71, %68
%75 = load i32, i32* @EXIT_SUCCESS
ret i32 %75
}