int save_ebuild() {
  char directory[512];
  char subdir[512];
  char commandstr[512];
  int retval = 0;
  get_setting("directory", directory);
  sprintf(subdir, "%s%c%s", directory, '/', "ebuildpackage");
  if (directory_exists(subdir) == 0) {
    sprintf(commandstr, "%s %s", "mkdir", subdir);
    retval = system(commandstr);
  }
  save_file(directory);
  save_script(directory);
  return retval;
}


x86 assembly (clang, -O0):
<save_ebuild>:
push   %rbp
mov    %rsp,%rbp
sub    $0x610,%rsp
movl   $0x0,-0x604(%rbp)
lea    -0x200(%rbp),%rsi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1050 <get_setting@plt>
lea    -0x400(%rbp),%rdi
lea    -0x200(%rbp),%rdx
lea    0xe6b(%rip),%rsi
mov    $0x2f,%ecx
lea    0xe66(%rip),%r8
mov    $0x0,%al
call   1080 <sprintf@plt>
lea    -0x400(%rbp),%rdi
mov    $0x0,%al
call   1040 <directory_exists@plt>
cmp    $0x0,%eax
jne    1200 <save_ebuild+0xa0>
lea    -0x600(%rbp),%rdi
lea    -0x400(%rbp),%rcx
lea    0xe41(%rip),%rsi
lea    0xe40(%rip),%rdx
mov    $0x0,%al
call   1080 <sprintf@plt>
lea    -0x600(%rbp),%rdi
mov    $0x0,%al
call   1030 <system@plt>
mov    %eax,-0x604(%rbp)
lea    -0x200(%rbp),%rdi
mov    $0x0,%al
call   1070 <save_file@plt>
lea    -0x200(%rbp),%rdi
mov    $0x0,%al
call   1060 <save_script@plt>
mov    -0x604(%rbp),%eax
add    $0x610,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_ebuild>:
push   %rbp
push   %r14
push   %rbx
sub    $0x600,%rsp
lea    0xe8e(%rip),%rdi
xor    %r14d,%r14d
lea    0x200(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <get_setting@plt>
lea    0xe7c(%rip),%rsi
lea    0xe7c(%rip),%r8
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    $0x2f,%ecx
xor    %eax,%eax
call   1080 <sprintf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <directory_exists@plt>
test   %eax,%eax
jne    11e8 <save_ebuild+0x88>
lea    0xe60(%rip),%rsi
lea    0xe5f(%rip),%rdx
lea    0x400(%rsp),%rbx
mov    %rsp,%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <sprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <system@plt>
mov    %eax,%r14d
lea    0x200(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <save_file@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <save_script@plt>
mov    %r14d,%eax
add    $0x600,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"directory\00"
@.str.1 = [7 x i8] c"%s%c%s\00"
@.str.2 = [14 x i8] c"ebuildpackage\00"
@.str.3 = [6 x i8] c"%s %s\00"
@.str.4 = [6 x i8] c"mkdir\00"
define i32 @save_ebuild() {
%1 = alloca [512 x i8]
%2 = alloca [512 x i8]
%3 = alloca [512 x i8]
%4 = alloca i32
store i32 0, i32* %4
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%6 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @get_setting to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%9 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %8, i32 47, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @directory_exists to i32 (i8*, ...)*)(i8* %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %0
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%18 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %17)
store i32 %18, i32* %4
br label %19
19: ; preds = %13, %0
%20 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%21 = call i32 (i8*, ...) bitcast (i32 (...)* @save_file to i32 (i8*, ...)*)(i8* %20)
%22 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%23 = call i32 (i8*, ...) bitcast (i32 (...)* @save_script to i32 (i8*, ...)*)(i8* %22)
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
@.str = [10 x i8] c"directory\00"
@.str.1 = [7 x i8] c"%s%c%s\00"
@.str.2 = [14 x i8] c"ebuildpackage\00"
@.str.3 = [6 x i8] c"%s %s\00"
@.str.4 = [6 x i8] c"mkdir\00"
define i32 @save_ebuild() {
%1 = alloca [512 x i8]
%2 = alloca [512 x i8]
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%7 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @get_setting to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %4)
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 47, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @directory_exists to i32 (i8*, ...)*)(i8* %5)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %5)
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %6)
br label %14
14: ; preds = %11, %0
%15 = phi i32 [ %13, %11 ], [ 0, %0 ]
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @save_file to i32 (i8*, ...)*)(i8* %4)
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @save_script to i32 (i8*, ...)*)(i8* %4)
ret i32 %15
}