#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 /*<<< orphan*/ fget(char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ system(char *);
int get_keybags() {
  char file_here[1024], buildCommand[1024];
  printf("Drag file here : ");
  fget(file_here, 1024);
  sprintf(buildCommand, "bin\\xpwntool %s nul | cut -f2 -d ' '", file_here);
  system(buildCommand);
  remove("nul");
  return 0;
}


x86 assembly (clang, -O0):
<get_keybags>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
lea    0xe9e(%rip),%rdi
call   1050 <printf@plt>
lea    -0x400(%rbp),%rdi
mov    $0x400,%esi
call   1060 <fget@plt>
lea    -0x800(%rbp),%rdi
lea    -0x400(%rbp),%rdx
lea    0xe85(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x800(%rbp),%rdi
call   1040 <system@plt>
lea    0xe92(%rip),%rdi
call   1030 <remove@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_keybags>:
push   %r14
push   %rbx
sub    $0x808,%rsp
lea    0xe9f(%rip),%rdi
call   1050 <printf@plt>
lea    0x400(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1060 <fget@plt>
lea    0xe90(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xe98(%rip),%rdi
call   1030 <remove@plt>
xor    %eax,%eax
add    $0x808,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Drag file here : \00"
@.str.1 = [37 x i8] c"bin\\xpwntool %s nul | cut -f2 -d ' '\00"
@.str.2 = [4 x i8] c"nul\00"
define i32 @get_keybags() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%5 = call i32 @fget(i8* %4, i32 1024)
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%10 = call i32 @system(i8* %9)
%11 = call i32 @remove(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Drag file here : \00"
@.str.1 = [37 x i8] c"bin\\xpwntool %s nul | cut -f2 -d ' '\00"
@.str.2 = [4 x i8] c"nul\00"
define i32 @get_keybags() {
%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 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @fget(i8* %3, i32 1024)
%7 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%8 = call i32 @system(i8* %4)
%9 = call i32 @remove(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}