#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 *);
int /*<<< orphan*/ system(char *);
int idevicescreenshot() {
  char path[1024];
  char buildCommand[1024];
  system("clear");
  printf("Enter the directory to copy the screenshot : ");
  fget(path, 1024);
  sprintf(buildCommand, "idevicescreenshot %s", path);
  system(buildCommand);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<idevicescreenshot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%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    -0x800(%rbp),%rdi
lea    -0x400(%rbp),%rdx
lea    0xeab(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x800(%rbp),%rdi
call   1030 <system@plt>
mov    0x2e3f(%rip),%rax
mov    (%rax),%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idevicescreenshot>:
push   %r14
push   %rbx
sub    $0x808,%rsp
lea    0xeaf(%rip),%rdi
call   1030 <system@plt>
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
lea    0x400(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1050 <fget@plt>
lea    0xeb6(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%eax
add    $0x808,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [46 x i8] c"Enter the directory to copy the screenshot : \00"
@.str.2 = [21 x i8] c"idevicescreenshot %s\00"
@EXIT_SUCCESS = global i32 0
define i32 @idevicescreenshot() {
%1 = alloca [1024 x i8]
%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 ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%6 = call i32 @fget(i8* %5, i32 1024)
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%11 = call i32 @system(i8* %10)
%12 = load i32, i32* @EXIT_SUCCESS
ret i32 %12
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [46 x i8] c"Enter the directory to copy the screenshot : \00"
@.str.2 = [21 x i8] c"idevicescreenshot %s\00"
@EXIT_SUCCESS = global i32 0
define i32 @idevicescreenshot() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 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 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @fget(i8* %3, i32 1024)
%8 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%9 = call i32 @system(i8* %4)
%10 = load i32, i32* @EXIT_SUCCESS
ret i32 %10
}