#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*/ copy_bootsect(char const *, char *);
int /*<<< orphan*/ copy_setup(char const *, char *);
int /*<<< orphan*/ copy_system(char const *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char const *argv[]) {
  char buf[1024];
  if (argc != 4)
    usage();
  copy_bootsect(argv[1], buf);
  copy_setup(argv[2], buf);
  copy_system(argv[3], buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     116a <main+0x2a>
mov    $0x0,%al
call   1060 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x410(%rbp),%rsi
call   1040 <copy_bootsect@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <copy_setup@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    -0x410(%rbp),%rsi
call   1050 <copy_system@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%rbx
cmp    $0x4,%edi
je     1159 <main+0x19>
xor    %eax,%eax
call   1060 <usage@plt>
mov    0x8(%rbx),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1040 <copy_bootsect@plt>
mov    0x10(%rbx),%rdi
mov    %r14,%rsi
call   1030 <copy_setup@plt>
mov    0x18(%rbx),%rdi
mov    %r14,%rsi
call   1050 <copy_system@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 4
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @usage()
br label %11
11: ; preds = %9, %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%16 = call i32 @copy_bootsect(i8* %14, i8* %15)
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%21 = call i32 @copy_setup(i8* %19, i8* %20)
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 3
%24 = load i8*, i8** %23
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%26 = call i32 @copy_system(i8* %24, i8* %25)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 4
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (...) @usage()
br label %8
8: ; preds = %6, %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @copy_bootsect(i8* %10, i8* %4)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = call i32 @copy_setup(i8* %13, i8* %4)
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = call i32 @copy_system(i8* %16, i8* %4)
ret i32 0
}