xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ log_debug(char *);
int /*<<< orphan*/ log_error(char *);
int /*<<< orphan*/ log_info(char *);
int /*<<< orphan*/ log_warning(char *);
void example_whithinFct(void) {
  log_debug("Debug message within function");
  log_info("Info message within function");
  log_warning("Warning message within function");
  log_error("Error message within function");
}


x86 assembly (clang, -O0):
<example_whithinFct>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1050 <log_debug@plt>
lea    0xec7(%rip),%rdi
call   1030 <log_info@plt>
lea    0xed8(%rip),%rdi
call   1060 <log_warning@plt>
lea    0xeec(%rip),%rdi
call   1040 <log_error@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<example_whithinFct>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1050 <log_debug@plt>
lea    0xeca(%rip),%rdi
call   1030 <log_info@plt>
lea    0xedb(%rip),%rdi
call   1060 <log_warning@plt>
lea    0xeef(%rip),%rdi
pop    %rax
jmp    1040 <log_error@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Debug message within function\00"
@.str.1 = [29 x i8] c"Info message within function\00"
@.str.2 = [32 x i8] c"Warning message within function\00"
@.str.3 = [30 x i8] c"Error message within function\00"
define void @example_whithinFct() {
%1 = call i32 @log_debug(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @log_info(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @log_warning(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @log_error(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Debug message within function\00"
@.str.1 = [29 x i8] c"Info message within function\00"
@.str.2 = [32 x i8] c"Warning message within function\00"
@.str.3 = [30 x i8] c"Error message within function\00"
define void @example_whithinFct() {
%1 = tail call i32 @log_debug(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @log_info(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @log_warning(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @log_error(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
ret void
}
void minisat_add(int lit) {}


x86 assembly (clang, -O0):
<minisat_add>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<minisat_add>:
ret

LLVM IR (-O0):
define void @minisat_add(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @minisat_add(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, unsigned char);
void serial_write(const char *data, size_t size) {
  for (size_t i = 0; i < size; i++) {
    outb((0x3F8), (unsigned char)data[i]);
  }
}


x86 assembly (clang, -O0):
<serial_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    115d <serial_write+0x4d>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    $0x3f8,%edi
movzbl (%rax,%rcx,1),%esi
call   1030 <outb@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <serial_write+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_write>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
je     1148 <serial_write+0x38>
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%r14,%rbx,1),%esi
mov    $0x3f8,%edi
call   1030 <outb@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <serial_write+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @serial_write(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %16, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %19
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i64, i64* %5
%13 = getelementptr inbounds i8, i8* %11, i64 %12
%14 = load i8, i8* %13
%15 = call i32 @outb(i32 1016, i8 zeroext %14)
br label %16
16: ; preds = %10
%17 = load i64, i64* %5
%18 = add i64 %17, 1
store i64 %18, i64* %5
br label %6
19: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @serial_write(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i64 [ %10, %5 ], [ 0, %2 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = tail call i32 @outb(i32 1016, i8 zeroext %8)
%10 = add nuw i64 %6, 1
%11 = icmp eq i64 %10, %1
br i1 %11, label %4, label %5
}
int *am_malloc_ints(int size) {
  int *result = ((int *)malloc((size) * sizeof(int)));
  return (result);
}


x86 assembly (clang, -O0):
<am_malloc_ints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
shl    $0x2,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<am_malloc_ints>:
movslq %edi,%rdi
shl    $0x2,%rdi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i32* @am_malloc_ints(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = mul i64 %5, 4
%7 = call i8* @malloc(i64 %6)
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %3
%9 = load i32*, i32** %3
ret i32* %9
}

LLVM IR (-O2):
define noalias i32* @am_malloc_ints(i32 %0) {
%2 = sext i32 %0 to i64
%3 = shl nsw i64 %2, 2
%4 = tail call i8* @malloc(i64 %3)
%5 = bitcast i8* %4 to i32*
ret i32* %5
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ stdout;
void WriteHex_Real(unsigned int x) {
  printf("%.8X", x);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<WriteHex_Real>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteHex_Real>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%.8X\00"
@stdout = global i32 0
define void @WriteHex_Real(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @stdout
%6 = call i32 @fflush(i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.8X\00"
@stdout = global i32 0
define void @WriteHex_Real(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  sleep(1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
call   1030 <sleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @sleep(i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @sleep(i32 1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
struct _info {
  int dummy;
};

/* Variables and functions */
int scan_infos(struct _info const *, int /*<<< orphan*/, int);
int keepgecos(const struct _info *lst, uid_t id) {
  return scan_infos(lst, id, 0x0004);
}


x86 assembly (clang, -O0):
<keepgecos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x4,%edx
call   1030 <scan_infos@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keepgecos>:
mov    $0x4,%edx
jmp    1030 <scan_infos@plt>

LLVM IR (-O0):
%struct._info = type { i32 }
define i32 @keepgecos(%struct._info* %0, i32 %1) {
%3 = alloca %struct._info*
%4 = alloca i32
store %struct._info* %0, %struct._info** %3
store i32 %1, i32* %4
%5 = load %struct._info*, %struct._info** %3
%6 = load i32, i32* %4
%7 = call i32 @scan_infos(%struct._info* %5, i32 %6, i32 4)
ret i32 %7
}

LLVM IR (-O2):
%struct._info = type { i32 }
define i32 @keepgecos(%struct._info* %0, i32 %1) {
%3 = tail call i32 @scan_infos(%struct._info* %0, i32 %1, i32 4)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ EmulatedHardwareZap();
int /*<<< orphan*/ Sony_EjectAllDisks();
void DoMacReset(void) {
  Sony_EjectAllDisks();
  EmulatedHardwareZap();
}


x86 assembly (clang, -O0):
<DoMacReset>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <Sony_EjectAllDisks@plt>
mov    $0x0,%al
call   1030 <EmulatedHardwareZap@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoMacReset>:
push   %rax
xor    %eax,%eax
call   1040 <Sony_EjectAllDisks@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <EmulatedHardwareZap@plt>

LLVM IR (-O0):
define void @DoMacReset() {
%1 = call i32 (...) @Sony_EjectAllDisks()
%2 = call i32 (...) @EmulatedHardwareZap()
ret void
}

LLVM IR (-O2):
define void @DoMacReset() {
%1 = tail call i32 (...) @Sony_EjectAllDisks()
%2 = tail call i32 (...) @EmulatedHardwareZap()
ret void
}
/* Type definitions */
struct clickos_domain {
  int dummy;
};

/* Variables and functions */
int ENOTSUP;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int domain_create(struct clickos_domain *dom_info) {
  fprintf(stderr, "Compile with DOMLIB=xl or DOMLIB=xcl to enable this\n");
  return -ENOTSUP;
}


x86 assembly (clang, -O0):
<domain_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
mov    0x2eae(%rip),%rcx
sub    (%rcx),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<domain_create>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ebb(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.clickos_domain = type { i32 }
@stderr = global i32 0
@.str = [53 x i8] c"Compile with DOMLIB=xl or DOMLIB=xcl to enable this\0A\00"
@ENOTSUP = global i32 0
define i32 @domain_create(%struct.clickos_domain* %0) {
%2 = alloca %struct.clickos_domain*
store %struct.clickos_domain* %0, %struct.clickos_domain** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @ENOTSUP
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
%struct.clickos_domain = type { i32 }
@stderr = global i32 0
@.str = [53 x i8] c"Compile with DOMLIB=xl or DOMLIB=xcl to enable this\0A\00"
@ENOTSUP = global i32 0
define i32 @domain_create(%struct.clickos_domain* nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @ENOTSUP
%5 = sub nsw i32 0, %4
ret i32 %5
}
/* Type definitions */
struct MD5Context {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ MD5Init(struct MD5Context *);
void auth_md5_init(struct MD5Context *context) { MD5Init(context); }


x86 assembly (clang, -O0):
<auth_md5_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <MD5Init@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<auth_md5_init>:
jmp    1030 <MD5Init@plt>

LLVM IR (-O0):
%struct.MD5Context = type { i32 }
define void @auth_md5_init(%struct.MD5Context* %0) {
%2 = alloca %struct.MD5Context*
store %struct.MD5Context* %0, %struct.MD5Context** %2
%3 = load %struct.MD5Context*, %struct.MD5Context** %2
%4 = call i32 @MD5Init(%struct.MD5Context* %3)
ret void
}

LLVM IR (-O2):
%struct.MD5Context = type { i32 }
define void @auth_md5_init(%struct.MD5Context* %0) {
%2 = tail call i32 @MD5Init(%struct.MD5Context* %0)
ret void
}
int gcd(int m, int n) {
  while (m != n) {
    if (m > n)
      m -= n;
    else
      n -= m;
  }
  return (m);
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     1142 <gcd+0x42>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1132 <gcd+0x32>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <gcd+0x3d>
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    110a <gcd+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %edi,%eax
cmp    %esi,%edi
je     1127 <gcd+0x27>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmp    %eax,%esi
mov    $0x0,%edx
cmovl  %esi,%edx
mov    %eax,%edi
cmovl  %ecx,%edi
sub    %edx,%eax
sub    %edi,%esi
cmp    %esi,%eax
jne    1110 <gcd+0x10>
ret

LLVM IR (-O0):
define i32 @gcd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %5
5: ; preds = %21, %2
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %22
9: ; preds = %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = icmp sgt i32 %10, %11
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = sub nsw i32 %15, %14
store i32 %16, i32* %3
br label %21
17: ; preds = %9
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, %18
store i32 %20, i32* %4
br label %21
21: ; preds = %17, %13
br label %5
22: ; preds = %5
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ %1, %2 ]
%6 = phi i32 [ %9, %4 ], [ %0, %2 ]
%7 = icmp slt i32 %5, %6
%8 = select i1 %7, i32 %5, i32 0
%9 = sub nsw i32 %6, %8
%10 = select i1 %7, i32 0, i32 %6
%11 = sub nsw i32 %5, %10
%12 = icmp eq i32 %9, %11
br i1 %12, label %13, label %4
13: ; preds = %4, %2
%14 = phi i32 [ %0, %2 ], [ %9, %4 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ ft_find_queens(int *, int /*<<< orphan*/);
void ft_queens_puzzle() {
  int table[8] = {0};
  ft_find_queens(table, 0);
}


x86 assembly (clang, -O0):
<ft_queens_puzzle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1040 <ft_find_queens@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_queens_puzzle>:
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <ft_find_queens@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define void @ft_queens_puzzle() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = call i32 @ft_find_queens(i32* %3, i32 0)
ret void
}

LLVM IR (-O2):
define void @ft_queens_puzzle() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = call i32 @ft_find_queens(i32* %3, i32 0)
ret void
}
int user_logout(char **args, int argc, int flags) {
  if (argc < 2 + 1)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<user_logout>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1124 <user_logout+0x24>
movl   $0x1,-0x4(%rbp)
jmp    112b <user_logout+0x2b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_logout>:
xor    %eax,%eax
cmp    $0x3,%esi
setl   %al
ret

LLVM IR (-O0):
define i32 @user_logout(i8** %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i8** %0, i8*** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %11
10: ; preds = %3
store i32 1, i32* %4
br label %12
11: ; preds = %3
store i32 0, i32* %4
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %4
ret i32 %13
}

LLVM IR (-O2):
define i32 @user_logout(i8** nocapture readnone %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, 3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int isPrime(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int prime;
  scanf("%d", &prime);
  printf("%d", isPrime(prime));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <isPrime@plt>
mov    %eax,%esi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
call   1040 <isPrime@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = call i32 @isPrime(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @isPrime(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int foo(int, int /*<<< orphan*/);
int main() { return foo(2, 0); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x2,%edi
xor    %esi,%esi
jmp    1030 <foo@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i32 2, i32 0)
ret i32 %2
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 2, i32 0)
ret i32 %1
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
bool QEIErrorGet(uint32_t ui32Base) {
  ;
  return (((*((volatile unsigned long *)(ui32Base + 0x00000004))) & 0x00000001)
              ? 1
              : 0);
}


x86 assembly (clang, -O0):
<QEIErrorGet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%rdx
and    $0x1,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<QEIErrorGet>:
mov    0x4(%rdi),%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @QEIErrorGet(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, 4
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, 1
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 1, i32 0
ret i32 %10
}

LLVM IR (-O2):
define i32 @QEIErrorGet(i64 %0) {
%2 = add nsw i64 %0, 4
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = trunc i64 %4 to i32
%6 = and i32 %5, 1
ret i32 %6
}
/* Variables and functions */
char *getcwd(char *, size_t);
char *octave_getcwd_wrapper(char *nm, size_t len) { return getcwd(nm, len); }


x86 assembly (clang, -O0):
<octave_getcwd_wrapper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <getcwd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<octave_getcwd_wrapper>:
jmp    1030 <getcwd@plt>

LLVM IR (-O0):
define i8* @octave_getcwd_wrapper(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @getcwd(i8* %5, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @octave_getcwd_wrapper(i8* %0, i64 %1) {
%3 = tail call i8* @getcwd(i8* %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void header_done(void *data, const char *at, size_t length) {
  printf("HEADER_DONE.\n");
}


x86 assembly (clang, -O0):
<header_done>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<header_done>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"HEADER_DONE.\0A\00"
define void @header_done(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"HEADER_DONE.\00"
define void @header_done(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
scalar_t__ word_break(char *);
void main() {
  if (word_break("hihowicreamx"))
    printf("Yes");
  else
    printf("No");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <word_break@plt>
cmp    $0x0,%rax
je     114b <main+0x2b>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
jmp    1157 <main+0x37>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <word_break@plt>
test   %rax,%rax
lea    0xeda(%rip),%rax
lea    0xecf(%rip),%rdi
cmove  %rax,%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"hihowicreamx\00"
@.str.1 = [4 x i8] c"Yes\00"
@.str.2 = [3 x i8] c"No\00"
define void @main() {
%1 = call i64 @word_break(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %7
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"hihowicreamx\00"
@.str.1 = [4 x i8] c"Yes\00"
@.str.2 = [3 x i8] c"No\00"
define void @main() {
%1 = tail call i64 @word_break(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @printf(i8* dereferenceable(1) %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ setenv(char *, char *, int);
void csub_(int *i, float *r) {
  if (*i == 257 && *r == 1.0)
    setenv("MOSTF90CALL", "csub_", 1);
}


x86 assembly (clang, -O0):
<csub_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x101,(%rax)
jne    116c <csub_+0x5c>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xebc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    116c <csub_+0x5c>
jp     116c <csub_+0x5c>
lea    0xead(%rip),%rdi
lea    0xeb2(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csub_>:
cmpl   $0x101,(%rdi)
jne    113f <csub_+0x2f>
movss  (%rsi),%xmm0
ucomiss 0xedd(%rip),%xmm0
jne    113f <csub_+0x2f>
jp     113f <csub_+0x2f>
lea    0xed6(%rip),%rdi
lea    0xedb(%rip),%rsi
mov    $0x1,%edx
jmp    1030 <setenv@plt>
ret

LLVM IR (-O0):
@.str = [12 x i8] c"MOSTF90CALL\00"
@.str.1 = [6 x i8] c"csub_\00"
define void @csub_(i32* %0, float* %1) {
%3 = alloca i32*
%4 = alloca float*
store i32* %0, i32** %3
store float* %1, float** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 257
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load float*, float** %4
%10 = load float, float* %9
%11 = fpext float %10 to double
%12 = fcmp oeq double %11, 1.000000e+00
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = call i32 @setenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %15
15: ; preds = %13, %8, %2
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"MOSTF90CALL\00"
@.str.1 = [6 x i8] c"csub_\00"
define void @csub_(i32* nocapture %0, float* nocapture %1) {
%3 = load i32, i32* %0
%4 = icmp eq i32 %3, 257
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = load float, float* %1
%7 = fcmp oeq float %6, 1.000000e+00
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @setenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %10
10: ; preds = %8, %5, %2
ret void
}
/* Variables and functions */
char *ltoa(int, char *, int);
extern char *itoa(int value, char *string, int radix) {
  return ltoa(value, string, radix);
}


x86 assembly (clang, -O0):
<itoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <ltoa@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<itoa>:
jmp    1030 <ltoa@plt>

LLVM IR (-O0):
define i8* @itoa(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i8* @ltoa(i32 %7, i8* %8, i32 %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @itoa(i32 %0, i8* %1, i32 %2) {
%4 = tail call i8* @ltoa(i32 %0, i8* %1, i32 %2)
ret i8* %4
}
/* Variables and functions */
double ceil(double);
double hl_math_fceil(double d) { return ceil(d); }


x86 assembly (clang, -O0):
<hl_math_fceil>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <ceil@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hl_math_fceil>:
jmp    1030 <ceil@plt>

LLVM IR (-O0):
define double @hl_math_fceil(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.ceil.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @hl_math_fceil(double %0) {
%2 = tail call double @llvm.ceil.f64(double %0)
ret double %2
}
unsigned long strlen(const char *s) {
  int l = 0;
  while (*(s++))
    l++;
  return l;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1135 <strlen+0x35>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
movslq -0xc(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111f <strlen+0x1f>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
mov    %rax,%rcx
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @strlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %9, %1
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i32 1
store i8* %6, i8** %2
%7 = load i8, i8* %5
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
ret i64 %14
}

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4
%12 = zext i32 %8 to i64
br label %13
13: ; preds = %11, %1
%14 = phi i64 [ 0, %1 ], [ %12, %11 ]
ret i64 %14
}
int ls_cost_nm5_n_out(void) { return 2; }


x86 assembly (clang, -O0):
<ls_cost_nm5_n_out>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_cost_nm5_n_out>:
mov    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @ls_cost_nm5_n_out() {
ret i32 2
}

LLVM IR (-O2):
define i32 @ls_cost_nm5_n_out() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
int main() {
  system("nohup ./initd > /dev/null");
  system("/bin/share/ls");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <system@plt>
lea    0xee8(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <system@plt>
lea    0xef6(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"nohup ./initd > /dev/null\00"
@.str.1 = [14 x i8] c"/bin/share/ls\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"nohup ./initd > /dev/null\00"
@.str.1 = [14 x i8] c"/bin/share/ls\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
void *thr(void *v) { return 0; }


x86 assembly (clang, -O0):
<thr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<thr>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @thr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @thr(i8* nocapture readnone %0) {
ret i8* null
}
__attribute__((always_)) int kstack_end(void *addr) {
  return !(((unsigned long)addr + sizeof(void *) - 1) &
           ((8192) - sizeof(void *)));
}


x86 assembly (clang, -O0):
<kstack_end>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
sub    $0x1,%rax
and    $0x1ff8,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kstack_end>:
add    $0x7,%edi
xor    %eax,%eax
test   $0x1ff8,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @kstack_end(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = add i64 %4, 8
%6 = sub i64 %5, 1
%7 = and i64 %6, 8184
%8 = icmp ne i64 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @kstack_end(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = add i64 %2, 7
%4 = and i64 %3, 8184
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
char *strchr(char *, char);
void remove_carriage_return_from_string(char *str) {
  char *pos = NULL;
  if ((pos = strchr(str, '\n')) != NULL)
    *pos = '\0';
}


x86 assembly (clang, -O0):
<remove_carriage_return_from_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1147 <remove_carriage_return_from_string+0x37>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_carriage_return_from_string>:
push   %rax
mov    $0xa,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1123 <remove_carriage_return_from_string+0x13>
movb   $0x0,(%rax)
pop    %rax
ret

LLVM IR (-O0):
define void @remove_carriage_return_from_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* null, i8** %3
%4 = load i8*, i8** %2
%5 = call i8* @strchr(i8* %4, i8 signext 10)
store i8* %5, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i8*, i8** %3
store i8 0, i8* %8
br label %9
9: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
define void @remove_carriage_return_from_string(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 10)
%3 = icmp eq i8* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i8 0, i8* %2
br label %5
5: ; preds = %4, %1
ret void
}
/* Type definitions */
struct semaphore {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __down(struct semaphore *);
void down(struct semaphore *sem) { __down(sem); }


x86 assembly (clang, -O0):
<down>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <__down@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<down>:
jmp    1030 <__down@plt>

LLVM IR (-O0):
%struct.semaphore = type { i32 }
define void @down(%struct.semaphore* %0) {
%2 = alloca %struct.semaphore*
store %struct.semaphore* %0, %struct.semaphore** %2
%3 = load %struct.semaphore*, %struct.semaphore** %2
%4 = call i32 @__down(%struct.semaphore* %3)
ret void
}

LLVM IR (-O2):
%struct.semaphore = type { i32 }
define void @down(%struct.semaphore* %0) {
%2 = tail call i32 @__down(%struct.semaphore* %0)
ret void
}
/* Variables and functions */
double FLT_MANT_DIG;
double FLT_MAX;
double FLT_MIN;
int /*<<< orphan*/ printf(char *, double);
int main() {
  printf("The maximum value of float = %.10e\n", FLT_MAX);
  printf("The minimum value of float = %.10e\n", FLT_MIN);
  printf("The number of digits in the number = %.10e\n", FLT_MANT_DIG);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
movsd  (%rax),%xmm0
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eab(%rip),%rax
movsd  (%rax),%xmm0
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e7c(%rip),%rax
movsd  (%rax),%xmm0
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
movsd  (%rax),%xmm0
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eb9(%rip),%rax
movsd  (%rax),%xmm0
lea    0xeea(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8a(%rip),%rax
movsd  (%rax),%xmm0
lea    0xef7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"The maximum value of float = %.10e\0A\00"
@FLT_MAX = global double 0.000000e+00
@.str.1 = [36 x i8] c"The minimum value of float = %.10e\0A\00"
@FLT_MIN = global double 0.000000e+00
@.str.2 = [44 x i8] c"The number of digits in the number = %.10e\0A\00"
@FLT_MANT_DIG = global double 0.000000e+00
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load double, double* @FLT_MAX
%3 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double %2)
%4 = load double, double* @FLT_MIN
%5 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), double %4)
%6 = load double, double* @FLT_MANT_DIG
%7 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), double %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"The maximum value of float = %.10e\0A\00"
@FLT_MAX = global double 0.000000e+00
@.str.1 = [36 x i8] c"The minimum value of float = %.10e\0A\00"
@FLT_MIN = global double 0.000000e+00
@.str.2 = [44 x i8] c"The number of digits in the number = %.10e\0A\00"
@FLT_MANT_DIG = global double 0.000000e+00
define i32 @main() {
%1 = load double, double* @FLT_MAX
%2 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double %1)
%3 = load double, double* @FLT_MIN
%4 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), double %3)
%5 = load double, double* @FLT_MANT_DIG
%6 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), double %5)
ret i32 0
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t load_4(const unsigned char *in) {
  uint64_t result;
  result = (uint64_t)in[0];
  result |= ((uint64_t)in[1]) << 8;
  result |= ((uint64_t)in[2]) << 16;
  result |= ((uint64_t)in[3]) << 24;
  return result;
}


x86 assembly (clang, -O0):
<load_4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x8,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
shl    $0x10,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
shl    $0x18,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_4>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @load_4(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
store i32 %7, i32* %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i32, i32* %3
%14 = or i32 %13, %12
store i32 %14, i32* %3
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 2
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 16
%20 = load i32, i32* %3
%21 = or i32 %20, %19
store i32 %21, i32* %3
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i64 3
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = shl i32 %25, 24
%27 = load i32, i32* %3
%28 = or i32 %27, %26
store i32 %28, i32* %3
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @load_4(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %3
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl nuw nsw i32 %11, 16
%13 = or i32 %8, %12
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl nuw i32 %16, 24
%18 = or i32 %13, %17
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ property();
int main() {
  property();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <property@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <property@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @property()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @property()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void irq_remap() {
  outb(0x20, 0x11);
  outb(0xA0, 0x11);
  outb(0x21, 0x20);
  outb(0XA1, 0x28);
  outb(0x21, 0x04);
  outb(0XA1, 0x02);
  outb(0x21, 0x01);
  outb(0XA1, 0x01);
  outb(0x21, 0x0);
  outb(0XA1, 0x0);
}


x86 assembly (clang, -O0):
<irq_remap>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x20,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x28,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
xor    %esi,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
xor    %esi,%esi
call   1030 <outb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<irq_remap>:
push   %rax
mov    $0x20,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x20,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x28,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1030 <outb@plt>
mov    $0x21,%edi
xor    %esi,%esi
call   1030 <outb@plt>
mov    $0xa1,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @irq_remap() {
%1 = call i32 @outb(i32 32, i32 17)
%2 = call i32 @outb(i32 160, i32 17)
%3 = call i32 @outb(i32 33, i32 32)
%4 = call i32 @outb(i32 161, i32 40)
%5 = call i32 @outb(i32 33, i32 4)
%6 = call i32 @outb(i32 161, i32 2)
%7 = call i32 @outb(i32 33, i32 1)
%8 = call i32 @outb(i32 161, i32 1)
%9 = call i32 @outb(i32 33, i32 0)
%10 = call i32 @outb(i32 161, i32 0)
ret void
}

LLVM IR (-O2):
define void @irq_remap() {
%1 = tail call i32 @outb(i32 32, i32 17)
%2 = tail call i32 @outb(i32 160, i32 17)
%3 = tail call i32 @outb(i32 33, i32 32)
%4 = tail call i32 @outb(i32 161, i32 40)
%5 = tail call i32 @outb(i32 33, i32 4)
%6 = tail call i32 @outb(i32 161, i32 2)
%7 = tail call i32 @outb(i32 33, i32 1)
%8 = tail call i32 @outb(i32 161, i32 1)
%9 = tail call i32 @outb(i32 33, i32 0)
%10 = tail call i32 @outb(i32 161, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ forthresume(int /*<<< orphan*/);
void Fquit() { forthresume(0); }


x86 assembly (clang, -O0):
<Fquit>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <forthresume@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fquit>:
xor    %edi,%edi
jmp    1030 <forthresume@plt>

LLVM IR (-O0):
define void @Fquit() {
%1 = call i32 @forthresume(i32 0)
ret void
}

LLVM IR (-O2):
define void @Fquit() {
%1 = tail call i32 @forthresume(i32 0)
ret void
}
void ARGBToRGB565DitherRow_C() {}


x86 assembly (clang, -O0):
<ARGBToRGB565DitherRow_C>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ARGBToRGB565DitherRow_C>:
ret

LLVM IR (-O0):
define void @ARGBToRGB565DitherRow_C() {
ret void
}

LLVM IR (-O2):
define void @ARGBToRGB565DitherRow_C() {
ret void
}
int left(int index) { return 2 * index; }


x86 assembly (clang, -O0):
<left>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<left>:
lea    (%rdi,%rdi,1),%eax
ret

LLVM IR (-O0):
define i32 @left(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 2, %3
ret i32 %4
}

LLVM IR (-O2):
define i32 @left(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int add(char *);
bool add_test_variable_length_multiple_delimiters() {
  if (add("//[abc][def]\n1,2,3abc4def5") == 15)
    return true;
  return false;
}


x86 assembly (clang, -O0):
<add_test_variable_length_multiple_delimiters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <add@plt>
cmp    $0xf,%eax
jne    1139 <add_test_variable_length_multiple_delimiters+0x29>
movl   $0x1,-0x4(%rbp)
jmp    1140 <add_test_variable_length_multiple_delimiters+0x30>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_test_variable_length_multiple_delimiters>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <add@plt>
xor    %ecx,%ecx
cmp    $0xf,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"//[abc][def]\0A1,2,3abc4def5\00"
define i32 @add_test_variable_length_multiple_delimiters() {
%1 = alloca i32
%2 = call i32 @add(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 15
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 1, i32* %1
br label %6
5: ; preds = %0
store i32 0, i32* %1
br label %6
6: ; preds = %5, %4
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [27 x i8] c"//[abc][def]\0A1,2,3abc4def5\00"
define i32 @add_test_variable_length_multiple_delimiters() {
%1 = tail call i32 @add(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 15
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ length;
typedef int /*<<< orphan*/ header;

/* Variables and functions */
int strlen(char const *);
int /*<<< orphan*/ write(int, ...);
int write_text(int socket_fd, const char *text, int header) {
  int length = strlen(text) + 1;
  write(socket_fd, &header, sizeof(header));
  write(socket_fd, &length, sizeof(length));
  write(socket_fd, text, length);
  return 1;
}


x86 assembly (clang, -O0):
<write_text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_text>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %edx,0x4(%rsp)
mov    %rsi,%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <write@plt>
mov    %rsp,%rsi
mov    $0x4,%edx
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <write@plt>
mov    (%rsp),%edx
mov    %ebp,%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <write@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @write_text(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %5
%9 = call i32 @strlen(i8* %8)
%10 = add nsw i32 %9, 1
store i32 %10, i32* %7
%11 = load i32, i32* %4
%12 = call i32 (i32, ...) @write(i32 %11, i32* %6, i64 4)
%13 = load i32, i32* %4
%14 = call i32 (i32, ...) @write(i32 %13, i32* %7, i64 4)
%15 = load i32, i32* %4
%16 = load i8*, i8** %5
%17 = load i32, i32* %7
%18 = call i32 (i32, ...) @write(i32 %15, i8* %16, i32 %17)
ret i32 1
}

LLVM IR (-O2):
define i32 @write_text(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
store i32 %2, i32* %4
%6 = bitcast i32* %5 to i8*
%7 = tail call i32 @strlen(i8* %1)
%8 = add nsw i32 %7, 1
store i32 %8, i32* %5
%9 = call i32 (i32, ...) @write(i32 %0, i32* %4, i64 4)
%10 = call i32 (i32, ...) @write(i32 %0, i32* %5, i64 4)
%11 = load i32, i32* %5
%12 = call i32 (i32, ...) @write(i32 %0, i8* %1, i32 %11)
ret i32 1
}