#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 fgetn();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ system(char *);
int idevicedebugserverproxy() {
  int port;
  char buildCommand[1024];
  system("clear");
  printf("Port : ");
  port = fgetn();
  sprintf(buildCommand, "idevicedebugserverproxy -d %d", port);
  system(buildCommand);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<idevicedebugserverproxy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
lea    0xeae(%rip),%rdi
call   1030 <system@plt>
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <fgetn@plt>
mov    %eax,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe90(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idevicedebugserverproxy>:
push   %rbx
sub    $0x400,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <system@plt>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <fgetn@plt>
lea    0xea0(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %eax,%edx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [8 x i8] c"Port : \00"
@.str.2 = [30 x i8] c"idevicedebugserverproxy -d %d\00"
@EXIT_SUCCESS = global i32 0
define i32 @idevicedebugserverproxy() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (...) @fgetn()
store i32 %5, i32* %1
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* %1
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%10 = call i32 @system(i8* %9)
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [8 x i8] c"Port : \00"
@.str.2 = [30 x i8] c"idevicedebugserverproxy -d %d\00"
@EXIT_SUCCESS = global i32 0
define i32 @idevicedebugserverproxy() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (...) @fgetn()
%6 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = call i32 @system(i8* %2)
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}