int save_puppy(int no_of_binaries, char **binaries) {
  char xpm_filename[512];
  char directory[512];
  char subdir[512];
  char commandstr[512];
  int retval = 0;
  xpm_filename[0] = 0;
  get_setting("directory", directory);
  sprintf(subdir, "%s%c%s", directory, '/', "puppypackage");
  if (directory_exists(subdir) == 0) {
    sprintf(commandstr, "%s %s", "mkdir", subdir);
    retval = system(commandstr);
  }
  save_spec(directory);
  copy_mini_icon(directory, no_of_binaries, binaries, xpm_filename);
  save_install(directory);
  save_uninstall(directory);
  save_script(directory, xpm_filename);
  return retval;
}


x86 assembly (clang, -O0):
<save_puppy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x814(%rbp)
movb   $0x0,-0x210(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1080 <get_setting@plt>
lea    -0x610(%rbp),%rdi
lea    -0x410(%rbp),%rdx
lea    0xe2d(%rip),%rsi
mov    $0x2f,%ecx
lea    0xe28(%rip),%r8
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x610(%rbp),%rdi
mov    $0x0,%al
call   1070 <directory_exists@plt>
cmp    $0x0,%eax
jne    123e <save_puppy+0xae>
lea    -0x810(%rbp),%rdi
lea    -0x610(%rbp),%rcx
lea    0xe02(%rip),%rsi
lea    0xe01(%rip),%rdx
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x810(%rbp),%rdi
mov    $0x0,%al
call   1050 <system@plt>
mov    %eax,-0x814(%rbp)
lea    -0x410(%rbp),%rdi
mov    $0x0,%al
call   10b0 <save_spec@plt>
lea    -0x410(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    -0x210(%rbp),%rcx
mov    $0x0,%al
call   1040 <copy_mini_icon@plt>
lea    -0x410(%rbp),%rdi
mov    $0x0,%al
call   1030 <save_install@plt>
lea    -0x410(%rbp),%rdi
mov    $0x0,%al
call   1060 <save_uninstall@plt>
lea    -0x410(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    $0x0,%al
call   1090 <save_script@plt>
mov    -0x814(%rbp),%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_puppy>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x800,%rsp
mov    %rsi,%r14
mov    %edi,%r15d
movb   $0x0,0x400(%rsp)
lea    0xe4c(%rip),%rdi
xor    %r12d,%r12d
lea    0x200(%rsp),%rbp
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <get_setting@plt>
lea    0xe3a(%rip),%rsi
lea    0xe3a(%rip),%r8
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rbp,%rdx
mov    $0x2f,%ecx
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <directory_exists@plt>
test   %eax,%eax
jne    122a <save_puppy+0x9a>
lea    0xe1d(%rip),%rsi
lea    0xe1c(%rip),%rdx
lea    0x600(%rsp),%rbx
mov    %rsp,%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <system@plt>
mov    %eax,%r12d
lea    0x200(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10b0 <save_spec@plt>
lea    0x400(%rsp),%rbp
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1040 <copy_mini_icon@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <save_install@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <save_uninstall@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1090 <save_script@plt>
mov    %r12d,%eax
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
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 = [13 x i8] c"puppypackage\00"
@.str.3 = [6 x i8] c"%s %s\00"
@.str.4 = [6 x i8] c"mkdir\00"
define i32 @save_puppy(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [512 x i8]
%6 = alloca [512 x i8]
%7 = alloca [512 x i8]
%8 = alloca [512 x i8]
%9 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %9
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
store i8 0, i8* %10
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%12 = 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* %11)
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %14, i32 47, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @directory_exists to i32 (i8*, ...)*)(i8* %16)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %2
%20 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%21 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%22 = call i32 (i8*, i8*, ...) @sprintf(i8* %20, 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* %21)
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%24 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %23)
store i32 %24, i32* %9
br label %25
25: ; preds = %19, %2
%26 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%27 = call i32 (i8*, ...) bitcast (i32 (...)* @save_spec to i32 (i8*, ...)*)(i8* %26)
%28 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%29 = load i32, i32* %3
%30 = load i8**, i8*** %4
%31 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%32 = call i32 (i8*, i32, i8**, i8*, ...) bitcast (i32 (...)* @copy_mini_icon to i32 (i8*, i32, i8**, i8*, ...)*)(i8* %28, i32 %29, i8** %30, i8* %31)
%33 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%34 = call i32 (i8*, ...) bitcast (i32 (...)* @save_install to i32 (i8*, ...)*)(i8* %33)
%35 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%36 = call i32 (i8*, ...) bitcast (i32 (...)* @save_uninstall to i32 (i8*, ...)*)(i8* %35)
%37 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%38 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%39 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @save_script to i32 (i8*, i8*, ...)*)(i8* %37, i8* %38)
%40 = load i32, i32* %9
ret i32 %40
}

LLVM IR (-O2):
@.str = [10 x i8] c"directory\00"
@.str.1 = [7 x i8] c"%s%c%s\00"
@.str.2 = [13 x i8] c"puppypackage\00"
@.str.3 = [6 x i8] c"%s %s\00"
@.str.4 = [6 x i8] c"mkdir\00"
define i32 @save_puppy(i32 %0, i8** %1) {
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = alloca [512 x i8]
%6 = alloca [512 x i8]
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
store i8 0, i8* %7
%11 = 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* %8)
%12 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %8, i32 47, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @directory_exists to i32 (i8*, ...)*)(i8* %9)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* %10, 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* %9)
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %10)
br label %18
18: ; preds = %15, %2
%19 = phi i32 [ %17, %15 ], [ 0, %2 ]
%20 = call i32 (i8*, ...) bitcast (i32 (...)* @save_spec to i32 (i8*, ...)*)(i8* %8)
%21 = call i32 (i8*, i32, i8**, i8*, ...) bitcast (i32 (...)* @copy_mini_icon to i32 (i8*, i32, i8**, i8*, ...)*)(i8* %8, i32 %0, i8** %1, i8* %7)
%22 = call i32 (i8*, ...) bitcast (i32 (...)* @save_install to i32 (i8*, ...)*)(i8* %8)
%23 = call i32 (i8*, ...) bitcast (i32 (...)* @save_uninstall to i32 (i8*, ...)*)(i8* %8)
%24 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @save_script to i32 (i8*, i8*, ...)*)(i8* %8, i8* %7)
ret i32 %19
}