#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 fgetn();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
int idevicenotificationproxy() {
  char choice[80];
  int ID;
  char buildCommand[1024];
  printf("1) POST ID\n");
  printf("2) Observe ID\n");
  fget(choice, 80);
  if (strcmp(choice, "post") == 0 || strcmp(choice, "1") == 0) {
    printf("ID : ");
    ID = fgetn();
    sprintf(buildCommand, "idevicenotificationproxy -d post %d", ID);
    system(buildCommand);
  }
  if (strcmp(choice, "observe") == 0 || strcmp(choice, "2") == 0) {
    printf("ID : ");
    ID = fgetn();
    sprintf(buildCommand, "idevicenotificationproxy -d observe %d", ID);
    system(buildCommand);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<idevicenotificationproxy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x50,%esi
call   1050 <fget@plt>
lea    -0x50(%rbp),%rdi
lea    0xe7f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11c5 <idevicenotificationproxy+0x65>
lea    -0x50(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11fd <idevicenotificationproxy+0x9d>
lea    0xe56(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <fgetn@plt>
mov    %eax,-0x54(%rbp)
lea    -0x460(%rbp),%rdi
mov    -0x54(%rbp),%edx
lea    0xe3c(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x460(%rbp),%rdi
call   1030 <system@plt>
lea    -0x50(%rbp),%rdi
lea    0xe44(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1231 <idevicenotificationproxy+0xd1>
lea    -0x50(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1269 <idevicenotificationproxy+0x109>
lea    0xdea(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <fgetn@plt>
mov    %eax,-0x54(%rbp)
lea    -0x460(%rbp),%rdi
mov    -0x54(%rbp),%edx
lea    0xdfe(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x460(%rbp),%rdi
call   1030 <system@plt>
mov    0x2d70(%rip),%rax
mov    (%rax),%eax
add    $0x460,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idevicenotificationproxy>:
push   %rbx
sub    $0x450,%rsp
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1060 <fget@plt>
lea    0xe59(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11c8 <idevicenotificationproxy+0x58>
lea    0xe4a(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    11f9 <idevicenotificationproxy+0x89>
lea    0xe38(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <fgetn@plt>
lea    0xe2b(%rip),%rsi
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    %eax,%edx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xe31(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1221 <idevicenotificationproxy+0xb1>
lea    0xe25(%rip),%rsi
mov    %rsp,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1252 <idevicenotificationproxy+0xe2>
lea    0xddf(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <fgetn@plt>
lea    0xe00(%rip),%rsi
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    %eax,%edx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
mov    0x2d87(%rip),%rax
mov    (%rax),%eax
add    $0x450,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"1) POST ID\0A\00"
@.str.1 = [15 x i8] c"2) Observe ID\0A\00"
@.str.2 = [5 x i8] c"post\00"
@.str.3 = [2 x i8] c"1\00"
@.str.4 = [6 x i8] c"ID : \00"
@.str.5 = [36 x i8] c"idevicenotificationproxy -d post %d\00"
@.str.6 = [8 x i8] c"observe\00"
@.str.7 = [2 x i8] c"2\00"
@.str.8 = [39 x i8] c"idevicenotificationproxy -d observe %d\00"
@EXIT_SUCCESS = global i32 0
define i32 @idevicenotificationproxy() {
%1 = alloca [80 x i8]
%2 = alloca i32
%3 = alloca [1024 x i8]
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%7 = call i32 @fget(i8* %6, i32 80)
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%9 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %0
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %11, %0
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 (...) @fgetn()
store i32 %17, i32* %2
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%19 = load i32, i32* %2
%20 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%22 = call i32 @system(i8* %21)
br label %23
23: ; preds = %15, %11
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %31, label %27
27: ; preds = %23
%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.7, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %39
31: ; preds = %27, %23
%32 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%33 = call i32 (...) @fgetn()
store i32 %33, i32* %2
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%35 = load i32, i32* %2
%36 = call i32 @sprintf(i8* %34, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%38 = call i32 @system(i8* %37)
br label %39
39: ; preds = %31, %27
%40 = load i32, i32* @EXIT_SUCCESS
ret i32 %40
}

LLVM IR (-O2):
@.str.2 = [5 x i8] c"post\00"
@.str.3 = [2 x i8] c"1\00"
@.str.4 = [6 x i8] c"ID : \00"
@.str.5 = [36 x i8] c"idevicenotificationproxy -d post %d\00"
@.str.6 = [8 x i8] c"observe\00"
@.str.7 = [2 x i8] c"2\00"
@.str.8 = [39 x i8] c"idevicenotificationproxy -d observe %d\00"
@EXIT_SUCCESS = global i32 0
@str = [11 x i8] c"1) POST ID\00"
@str.9 = [14 x i8] c"2) Observe ID\00"
define i32 @idevicenotificationproxy() {
%1 = alloca [80 x i8]
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.9, i64 0, i64 0))
%7 = call i32 @fget(i8* %3, i32 80)
%8 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %0
%11 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %10, %0
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 (...) @fgetn()
%16 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %15)
%17 = call i32 @system(i8* %4)
br label %18
18: ; preds = %13, %10
%19 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %21, %18
%25 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%26 = call i32 (...) @fgetn()
%27 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i32 %26)
%28 = call i32 @system(i8* %4)
br label %29
29: ; preds = %24, %21
%30 = load i32, i32* @EXIT_SUCCESS
ret i32 %30
}