#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 *, char *);
int /*<<< orphan*/ system(char *);
int idevicedebug() {
  char cmd[1024];
  char option[1024];
  char buildCommand[1024];
  system("clear");
  printf("Enter command : ");
  fget(cmd, 1024);
  printf("Entrer option : ");
  fget(option, 1024);
  sprintf(buildCommand, "idevicedebug -d %s %s", option, cmd);
  system(buildCommand);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<idevicedebug>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc00,%rsp
lea    0xeae(%rip),%rdi
call   1030 <system@plt>
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
lea    -0x400(%rbp),%rdi
mov    $0x400,%esi
call   1050 <fget@plt>
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
lea    -0x800(%rbp),%rdi
mov    $0x400,%esi
call   1050 <fget@plt>
lea    -0xc00(%rbp),%rdi
lea    -0x800(%rbp),%rdx
lea    -0x400(%rbp),%rcx
lea    0xe7b(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0xc00(%rbp),%rdi
call   1030 <system@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%eax
add    $0xc00,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idevicedebug>:
push   %r15
push   %r14
push   %rbx
sub    $0xc00,%rsp
lea    0xead(%rip),%rdi
call   1030 <system@plt>
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
lea    0x800(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1050 <fget@plt>
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
lea    0x400(%rsp),%r15
mov    %r15,%rdi
mov    $0x400,%esi
call   1050 <fget@plt>
lea    0xe87(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%eax
add    $0xc00,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [17 x i8] c"Enter command : \00"
@.str.2 = [17 x i8] c"Entrer option : \00"
@.str.3 = [22 x i8] c"idevicedebug -d %s %s\00"
@EXIT_SUCCESS = global i32 0
define i32 @idevicedebug() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 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 ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%7 = call i32 @fget(i8* %6, i32 1024)
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%10 = call i32 @fget(i8* %9, i32 1024)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%14 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %12, i8* %13)
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%16 = call i32 @system(i8* %15)
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [17 x i8] c"Enter command : \00"
@.str.2 = [17 x i8] c"Entrer option : \00"
@.str.3 = [22 x i8] c"idevicedebug -d %s %s\00"
@EXIT_SUCCESS = global i32 0
define i32 @idevicedebug() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 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 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @fget(i8* %4, i32 1024)
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @fget(i8* %5, i32 1024)
%12 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %5, i8* %4)
%13 = call i32 @system(i8* %6)
%14 = load i32, i32* @EXIT_SUCCESS
ret i32 %14
}