xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ x;

/* Variables and functions */
int maxSubArray(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int x[] = {-2, 1, -3, 4, -1, 2, 1, -5, 4};
  printf("%d\n", maxSubArray(x, sizeof(x) / sizeof(int)));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
call   1050 <maxSubArray@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef6(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebf(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x9,%esi
call   1040 <maxSubArray@plt>
lea    0xecb(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@__const.main.x = [9 x i32] [i32 -2, i32 1, i32 -3, i32 4, i32 -1, i32 2, i32 1, i32 -5, i32 4]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%4 = call i32 @maxSubArray(i32* %3, i32 9)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
unsigned addval_190(unsigned x) { return x + 3767093313U; }


x86 assembly (clang, -O0):
<addval_190>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0894841,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addval_190>:
lea    -0x1f76b7bf(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @addval_190(i32 %0) {
%2 = add i32 %0, -527873983
ret i32 %2
}
char *basename(fname)
char *fname;
{ return FilePart(fname); }


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

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

LLVM IR (-O0):
define i8* @basename(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @FilePart to i32 (i8*, ...)*)(i8* %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}

LLVM IR (-O2):
define i8* @basename(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @FilePart to i32 (i8*, ...)*)(i8* %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint8_t;

/* Variables and functions */
uint8_t h264avcc_get_profile_compatibility(const uint8_t *p) { return p[2]; }


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

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

LLVM IR (-O0):
define i32 @h264avcc_get_profile_compatibility(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 2
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @h264avcc_get_profile_compatibility(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
ret i32 %3
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const);
void putNum(const int32_t num) { printf("%i", num); }


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

x86 assembly (clang, -O2):
<putNum>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define void @putNum(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int gettid();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
void *thread_function(void *arg) {
  printf("thread started,pid=%d\n", gettid());
  while (1) {
    sleep(1);
  }
}


x86 assembly (clang, -O0):
<thread_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <gettid@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1151 <thread_function+0x21>

x86 assembly (clang, -O2):
<thread_function>:
push   %rax
xor    %eax,%eax
call   1030 <gettid@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1150 <thread_function+0x20>

LLVM IR (-O0):
@.str = [23 x i8] c"thread started,pid=%d\0A\00"
define i8* @thread_function(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @gettid()
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %5
5: ; preds = %1, %5
%6 = call i32 @sleep(i32 1)
br label %5
}

LLVM IR (-O2):
@.str = [23 x i8] c"thread started,pid=%d\0A\00"
define noalias i8* @thread_function(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @gettid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %4
4: ; preds = %1, %4
%5 = tail call i32 @sleep(i32 1)
br label %4
}
int imsm_level_to_layout(int level) {
  switch (level) {
  case 0:
  case 1:
    return 0;
  case 5:
  case 6:
    return 0;
  case 10:
    return 0x102;
  }
  return (0xfffe);
}


x86 assembly (clang, -O0):
<imsm_level_to_layout>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x2,%eax
jb     1140 <imsm_level_to_layout+0x40>
jmp    111b <imsm_level_to_layout+0x1b>
mov    -0xc(%rbp),%eax
add    $0xfffffffb,%eax
sub    $0x2,%eax
jb     114c <imsm_level_to_layout+0x4c>
jmp    112f <imsm_level_to_layout+0x2f>
mov    -0xc(%rbp),%eax
sub    $0xa,%eax
je     1158 <imsm_level_to_layout+0x58>
jmp    1164 <imsm_level_to_layout+0x64>
movl   $0x0,-0x4(%rbp)
jmp    116b <imsm_level_to_layout+0x6b>
movl   $0x0,-0x4(%rbp)
jmp    116b <imsm_level_to_layout+0x6b>
movl   $0x102,-0x4(%rbp)
jmp    116b <imsm_level_to_layout+0x6b>
movl   $0xfffe,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imsm_level_to_layout>:
mov    $0xfffe,%eax
cmp    $0xa,%edi
ja     1117 <imsm_level_to_layout+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @imsm_level_to_layout(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 0, label %5
i32 1, label %5
i32 5, label %6
i32 6, label %6
i32 10, label %7
]
5: ; preds = %1, %1
store i32 0, i32* %2
br label %9
6: ; preds = %1, %1
store i32 0, i32* %2
br label %9
7: ; preds = %1
store i32 258, i32* %2
br label %9
8: ; preds = %1
store i32 65534, i32* %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@switch.table.imsm_level_to_layout = [11 x i32] [i32 0, i32 0, i32 65534, i32 65534, i32 65534, i32 0, i32 0, i32 65534, i32 65534, i32 65534, i32 258]
define i32 @imsm_level_to_layout(i32 %0) {
%2 = icmp ult i32 %0, 11
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [11 x i32], [11 x i32]* @switch.table.imsm_level_to_layout, i64 0, i64 %4
%6 = load i32, i32* %5
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 65534, %1 ]
ret i32 %8
}
char GDBGetChar(void) {
  char c = 0;
  return c;
}


x86 assembly (clang, -O0):
<GDBGetChar>:
push   %rbp
mov    %rsp,%rbp
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @GDBGetChar() {
%1 = alloca i8
store i8 0, i8* %1
%2 = load i8, i8* %1
ret i8 %2
}

LLVM IR (-O2):
define signext i8 @GDBGetChar() {
ret i8 0
}
int main() {
  int i = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
unsigned long TimerValueGet(unsigned long ulBase, unsigned long ulTimer) {
  ;
  ;
  return ((ulTimer == 0x000000ff)
              ? (*((volatile unsigned long *)(ulBase + 0x00000048)))
              : (*((volatile unsigned long *)(ulBase + 0x0000004C))));
}


x86 assembly (clang, -O0):
<TimerValueGet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0xff,-0x10(%rbp)
jne    112b <TimerValueGet+0x2b>
mov    -0x8(%rbp),%rax
mov    0x48(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1137 <TimerValueGet+0x37>
mov    -0x8(%rbp),%rax
mov    0x4c(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerValueGet>:
xor    %eax,%eax
cmp    $0xff,%rsi
setne  %al
mov    0x48(%rdi,%rax,4),%rax
ret

LLVM IR (-O0):
define i64 @TimerValueGet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = icmp eq i64 %5, 255
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i64, i64* %3
%9 = add i64 %8, 72
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
br label %17
12: ; preds = %2
%13 = load i64, i64* %3
%14 = add i64 %13, 76
%15 = inttoptr i64 %14 to i64*
%16 = load volatile i64, i64* %15
br label %17
17: ; preds = %12, %7
%18 = phi i64 [ %11, %7 ], [ %16, %12 ]
ret i64 %18
}

LLVM IR (-O2):
define i64 @TimerValueGet(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 255
%4 = select i1 %3, i64 72, i64 76
%5 = add i64 %4, %0
%6 = inttoptr i64 %5 to i64*
%7 = load volatile i64, i64* %6
ret i64 %7
}
int foo(int x) {
  int y = x + 1;
  return y + 2;
}


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

x86 assembly (clang, -O2):
<foo>:
lea    0x3(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 2
ret i32 %7
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = add nsw i32 %0, 3
ret i32 %2
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int x_root;
};
struct TYPE_4__ {
  TYPE_1__ xbutton;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xbutton_x_root(void *_p, int _v) {
  ((XEvent *)_p)->xbutton.x_root = (int)_v;
}


x86 assembly (clang, -O0):
<set_XEvent_xbutton_x_root>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XEvent_xbutton_x_root>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
define void @set_XEvent_xbutton_x_root(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i32 %5, i32* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xbutton_x_root(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf_verbose(char *);
int /*<<< orphan*/ teensy_write(unsigned char *, int, double);
void boot(unsigned char *buf, int write_size) {
  printf_verbose("Booting\n");
  memset(buf, 0, write_size);
  buf[0] = 0xFF;
  buf[1] = 0xFF;
  buf[2] = 0xFF;
  teensy_write(buf, write_size, 0.5);
}


x86 assembly (clang, -O0):
<boot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xec2(%rip),%rdi
call   1030 <printf_verbose@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    -0x8(%rbp),%rax
movb   $0xff,(%rax)
mov    -0x8(%rbp),%rax
movb   $0xff,0x1(%rax)
mov    -0x8(%rbp),%rax
movb   $0xff,0x2(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
movsd  0xe81(%rip),%xmm0
call   1040 <teensy_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boot>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xec9(%rip),%rdi
call   1030 <printf_verbose@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1050 <memset@plt>
movw   $0xffff,(%rbx)
movb   $0xff,0x2(%rbx)
movsd  0xe9f(%rip),%xmm0
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <teensy_write@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"Booting\0A\00"
define void @boot(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 @printf_verbose(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @memset(i8* %6, i32 0, i32 %7)
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 -1, i8* %10
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 1
store i8 -1, i8* %12
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 2
store i8 -1, i8* %14
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = call i32 @teensy_write(i8* %15, i32 %16, double 5.000000e-01)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"Booting\0A\00"
define void @boot(i8* %0, i32 %1) {
%3 = tail call i32 @printf_verbose(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @memset(i8* %0, i32 0, i32 %1)
store i8 -1, i8* %0
%5 = getelementptr inbounds i8, i8* %0, i64 1
store i8 -1, i8* %5
%6 = getelementptr inbounds i8, i8* %0, i64 2
store i8 -1, i8* %6
%7 = tail call i32 @teensy_write(i8* %0, i32 %1, double 5.000000e-01)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ c;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, char, int);
void main() {
  char c[24];
  memset(c, 'J', sizeof(c));
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    %rsp,%rdi
mov    $0x4a,%esi
mov    $0x18,%edx
call   1030 <memset@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca [24 x i8]
%2 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%3 = call i32 @memset(i8* %2, i8 signext 74, i32 24)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = alloca [24 x i8]
%2 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%3 = call i32 @memset(i8* %2, i8 signext 74, i32 24)
ret void
}
/* Variables and functions */
int read(int /*<<< orphan*/, char *, int);
unsigned int stringToHex(char *);
void scan_x(unsigned int *result_s, int *printed) {
  char temp[100];
  int size;
  size = read(0, temp, 200);
  temp[size] = '\0';
  *result_s = stringToHex(temp);
  (*printed)++;
}


x86 assembly (clang, -O0):
<scan_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rsi
xor    %edi,%edi
mov    $0xc8,%edx
call   1030 <read@plt>
mov    %eax,-0x84(%rbp)
movslq -0x84(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
lea    -0x80(%rbp),%rdi
call   1040 <stringToHex@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_x>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
xor    %edi,%edi
mov    %r15,%rsi
mov    $0xc8,%edx
call   1030 <read@plt>
cltq
movb   $0x0,(%rsp,%rax,1)
mov    %r15,%rdi
call   1040 <stringToHex@plt>
mov    %eax,(%rbx)
addl   $0x1,(%r14)
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @scan_x(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [100 x i8]
%6 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%8 = call i32 @read(i32 0, i8* %7, i32 200)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %10
store i8 0, i8* %11
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%13 = call i32 @stringToHex(i8* %12)
%14 = load i32*, i32** %3
store i32 %13, i32* %14
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1
store i32 %17, i32* %15
ret void
}

LLVM IR (-O2):
define void @scan_x(i32* nocapture writeonly %0, i32* nocapture %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = call i32 @read(i32 0, i8* %4, i32 200)
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %6
store i8 0, i8* %7
%8 = call i32 @stringToHex(i8* %4)
store i32 %8, i32* %0
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
scalar_t__ __SIGRTMIN;
int /*<<< orphan*/ __sigdelset(int /*<<< orphan*/ *, scalar_t__);
void __nptl_clear_internal_signals(sigset_t *set) {
  __sigdelset(set, __SIGRTMIN);
  __sigdelset(set, __SIGRTMIN);
  __sigdelset(set, (__SIGRTMIN + 1));
}


x86 assembly (clang, -O0):
<__nptl_clear_internal_signals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%rsi
call   1030 <__sigdelset@plt>
mov    -0x8(%rbp),%rdi
mov    0x2eae(%rip),%rax
mov    (%rax),%rsi
call   1030 <__sigdelset@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e9b(%rip),%rax
mov    (%rax),%rsi
add    $0x1,%rsi
call   1030 <__sigdelset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__nptl_clear_internal_signals>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eca(%rip),%r14
mov    (%r14),%rsi
call   1030 <__sigdelset@plt>
mov    (%r14),%rsi
mov    %rbx,%rdi
call   1030 <__sigdelset@plt>
mov    (%r14),%rsi
add    $0x1,%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <__sigdelset@plt>

LLVM IR (-O0):
@__SIGRTMIN = global i64 0
define void @__nptl_clear_internal_signals(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i64, i64* @__SIGRTMIN
%5 = call i32 @__sigdelset(i32* %3, i64 %4)
%6 = load i32*, i32** %2
%7 = load i64, i64* @__SIGRTMIN
%8 = call i32 @__sigdelset(i32* %6, i64 %7)
%9 = load i32*, i32** %2
%10 = load i64, i64* @__SIGRTMIN
%11 = add nsw i64 %10, 1
%12 = call i32 @__sigdelset(i32* %9, i64 %11)
ret void
}

LLVM IR (-O2):
@__SIGRTMIN = global i64 0
define void @__nptl_clear_internal_signals(i32* %0) {
%2 = load i64, i64* @__SIGRTMIN
%3 = tail call i32 @__sigdelset(i32* %0, i64 %2)
%4 = load i64, i64* @__SIGRTMIN
%5 = tail call i32 @__sigdelset(i32* %0, i64 %4)
%6 = load i64, i64* @__SIGRTMIN
%7 = add nsw i64 %6, 1
%8 = tail call i32 @__sigdelset(i32* %0, i64 %7)
ret void
}
/* Variables and functions */
int any_decrqss(char const *, char *);
int rpt_DECSPPCS(const char *the_title) { return any_decrqss(the_title, "*p"); }


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

x86 assembly (clang, -O2):
<rpt_DECSPPCS>:
lea    0xee9(%rip),%rsi
jmp    1030 <any_decrqss@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"*p\00"
define i32 @rpt_DECSPPCS(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @any_decrqss(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
@.str = [3 x i8] c"*p\00"
define i32 @rpt_DECSPPCS(i8* %0) {
%2 = tail call i32 @any_decrqss(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
int glutStrokeStringWidth(void *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, double);
int glutStrokeDoubleWidth(void *fontface, double i) {
  char buf[64];
  snprintf(buf, 64, "%.2g", i);
  return glutStrokeStringWidth(fontface, buf);
}


x86 assembly (clang, -O0):
<glutStrokeDoubleWidth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
mov    $0x40,%esi
lea    0xeba(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <glutStrokeStringWidth@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glutStrokeDoubleWidth>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%rbx
lea    0xecf(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x40,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <glutStrokeStringWidth@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.2g\00"
define i32 @glutStrokeDoubleWidth(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
%5 = alloca [64 x i8]
store i8* %0, i8** %3
store double %1, double* %4
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%7 = load double, double* %4
%8 = call i32 @snprintf(i8* %6, i32 64, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %7)
%9 = load i8*, i8** %3
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%11 = call i32 @glutStrokeStringWidth(i8* %9, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.2g\00"
define i32 @glutStrokeDoubleWidth(i8* %0, double %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 64, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %1)
%6 = call i32 @glutStrokeStringWidth(i8* %0, i8* %4)
ret i32 %6
}
/* Variables and functions */
int find(int *, int);
int test_negative_elements() {
  int array[] = {6, -4, -9, -5, 6, -9, -4};
  return -5 == find(array, 7);
}


x86 assembly (clang, -O0):
<test_negative_elements>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed9(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1030 <find@plt>
mov    %eax,%ecx
mov    $0xfffffffb,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_negative_elements>:
sub    $0x28,%rsp
movups 0xef1(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1030 <find@plt>
xor    %ecx,%ecx
cmp    $0xfffffffb,%eax
sete   %cl
mov    %ecx,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.test_negative_elements.array = [7 x i32] [i32 6, i32 -4, i32 -9, i32 -5, i32 6, i32 -9, i32 -4]
define i32 @test_negative_elements() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @find(i32* %3, i32 7)
%5 = icmp eq i32 -5, %4
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@__const.test_negative_elements.array = [7 x i32] [i32 6, i32 -4, i32 -9, i32 -5, i32 6, i32 -9, i32 -4]
define i32 @test_negative_elements() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @find(i32* %3, i32 7)
%5 = icmp eq i32 %4, -5
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ error(int, int /*<<< orphan*/, char *, char const *);
void usage(const char *filepath) {
  error(1, 0,
        "Usage: %s [-46cmtuz] [-C cpu] [-D dst ip] [-l secs] [-m messagenr] "
        "[-p port] [-s sendsize] [-S gsosize]",
        filepath);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x1,%edi
xor    %esi,%esi
lea    0xed2(%rip),%rdx
call   1030 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
jmp    1030 <error@plt>

LLVM IR (-O0):
@.str = [104 x i8] c"Usage: %s [-46cmtuz] [-C cpu] [-D dst ip] [-l secs] [-m messagenr] [-p port] [-s sendsize] [-S gsosize]\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [104 x i8] c"Usage: %s [-46cmtuz] [-C cpu] [-D dst ip] [-l secs] [-m messagenr] [-p port] [-s sendsize] [-S gsosize]\00"
define void @usage(i8* %0) {
%2 = tail call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ VDP_setWindowAddress(unsigned short);
void VDP_setWindowPlanAddress(unsigned short value) {
  VDP_setWindowAddress(value);
}


x86 assembly (clang, -O0):
<VDP_setWindowPlanAddress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edi
call   1030 <VDP_setWindowAddress@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VDP_setWindowPlanAddress>:
jmp    1030 <VDP_setWindowAddress@plt>

LLVM IR (-O0):
define void @VDP_setWindowPlanAddress(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call i32 @VDP_setWindowAddress(i16 zeroext %3)
ret void
}

LLVM IR (-O2):
define void @VDP_setWindowPlanAddress(i16 zeroext %0) {
%2 = tail call i32 @VDP_setWindowAddress(i16 zeroext %0)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
__attribute__((always_)) int is_dt_single(uint32_t op) {
  return !((op & 0x0C000000) ^ 0x04000000);
}


x86 assembly (clang, -O0):
<is_dt_single>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xc000000,%eax
xor    $0x4000000,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_dt_single>:
and    $0xc000000,%edi
xor    %eax,%eax
cmp    $0x4000000,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_dt_single(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 201326592
%5 = xor i32 %4, 67108864
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_dt_single(i32 %0) {
%2 = and i32 %0, 201326592
%3 = icmp eq i32 %2, 67108864
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
struct sk_buff {
  int dummy;
};

/* Variables and functions */
int nla_put(struct sk_buff *, int, scalar_t__, char const *);
scalar_t__ strlen(char const *);
int nla_put_string(struct sk_buff *skb, int attrtype, const char *str) {
  return nla_put(skb, attrtype, strlen(str) + 1, str);
}


x86 assembly (clang, -O0):
<nla_put_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    %rax,%rdx
add    $0x1,%rdx
mov    -0x18(%rbp),%rcx
call   1040 <nla_put@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nla_put_string>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    %rdx,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %rbx,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <nla_put@plt>

LLVM IR (-O0):
%struct.sk_buff = type { i32 }
define i32 @nla_put_string(%struct.sk_buff* %0, i32 %1, i8* %2) {
%4 = alloca %struct.sk_buff*
%5 = alloca i32
%6 = alloca i8*
store %struct.sk_buff* %0, %struct.sk_buff** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load %struct.sk_buff*, %struct.sk_buff** %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = call i64 @strlen(i8* %9)
%11 = add nsw i64 %10, 1
%12 = load i8*, i8** %6
%13 = call i32 @nla_put(%struct.sk_buff* %7, i32 %8, i64 %11, i8* %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.sk_buff = type { i32 }
define i32 @nla_put_string(%struct.sk_buff* %0, i32 %1, i8* %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%5 = add nsw i64 %4, 1
%6 = tail call i32 @nla_put(%struct.sk_buff* %0, i32 %1, i64 %5, i8* %2)
ret i32 %6
}
int a2_err_msg(void *ctx) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @a2_err_msg(i8* nocapture readnone %0) {
ret i32 -1
}
/* Variables and functions */
scalar_t__ all_tests_passed();
int /*<<< orphan*/ cleanup_unit_tests();
int /*<<< orphan*/ print_all_results();
int /*<<< orphan*/ run_all_tests();
int /*<<< orphan*/ setup_unit_tests();
int main(int argv, char **argc) {
  int result = 1;
  setup_unit_tests();
  run_all_tests();
  print_all_results();
  if (all_tests_passed()) {
    result = 0;
  }
  cleanup_unit_tests();
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    $0x0,%al
call   1030 <setup_unit_tests@plt>
mov    $0x0,%al
call   1050 <run_all_tests@plt>
mov    $0x0,%al
call   1070 <print_all_results@plt>
mov    $0x0,%al
call   1060 <all_tests_passed@plt>
cmp    $0x0,%rax
je     119a <main+0x4a>
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <cleanup_unit_tests@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <setup_unit_tests@plt>
xor    %eax,%eax
call   1050 <run_all_tests@plt>
xor    %eax,%eax
call   1070 <print_all_results@plt>
xor    %eax,%eax
call   1060 <all_tests_passed@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
xor    %eax,%eax
call   1040 <cleanup_unit_tests@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
%7 = call i32 (...) @setup_unit_tests()
%8 = call i32 (...) @run_all_tests()
%9 = call i32 (...) @print_all_results()
%10 = call i64 (...) @all_tests_passed()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 0, i32* %6
br label %13
13: ; preds = %12, %2
%14 = call i32 (...) @cleanup_unit_tests()
%15 = load i32, i32* %6
ret i32 %15
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @setup_unit_tests()
%4 = tail call i32 (...) @run_all_tests()
%5 = tail call i32 (...) @print_all_results()
%6 = tail call i64 (...) @all_tests_passed()
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 (...) @cleanup_unit_tests()
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ i2c_DisableINT(int, unsigned char);
void i2c1_DisableINT(unsigned char i2cints) { i2c_DisableINT(1, i2cints); }


x86 assembly (clang, -O0):
<i2c1_DisableINT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%edi
movzbl -0x1(%rbp),%esi
call   1030 <i2c_DisableINT@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c1_DisableINT>:
mov    %edi,%esi
mov    $0x1,%edi
jmp    1030 <i2c_DisableINT@plt>

LLVM IR (-O0):
define void @i2c1_DisableINT(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @i2c_DisableINT(i32 1, i8 zeroext %3)
ret void
}

LLVM IR (-O2):
define void @i2c1_DisableINT(i8 zeroext %0) {
%2 = tail call i32 @i2c_DisableINT(i32 1, i8 zeroext %0)
ret void
}
/* Variables and functions */
void *v(size_t);
void *z(size_t n) { return v(n); }


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

x86 assembly (clang, -O2):
<z>:
jmp    1030 <v@plt>

LLVM IR (-O0):
define i8* @z(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @v(i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @z(i64 %0) {
%2 = tail call i8* @v(i64 %0)
ret i8* %2
}
int bit_byte(int bit) { return ((bit) >> 3); }


x86 assembly (clang, -O0):
<bit_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_byte>:
mov    %edi,%eax
sar    $0x3,%eax
ret

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

LLVM IR (-O2):
define i32 @bit_byte(i32 %0) {
%2 = ashr i32 %0, 3
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void libtest2_dtor(void) { printf("libtest2: destructor!\n"); }


x86 assembly (clang, -O0):
<libtest2_dtor>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [23 x i8] c"libtest2: destructor!\0A\00"
define void @libtest2_dtor() {
%1 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [22 x i8] c"libtest2: destructor!\00"
define void @libtest2_dtor() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret void
}
void test_storage() {
  static a;
  auto b;
  register c;
  static int d;
  auto int e;
  register int f;
}


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

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

LLVM IR (-O0):
@test_storage.a = internal global i32 0
@test_storage.d = internal global i32 0
define void @test_storage() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
ret void
}

LLVM IR (-O2):
define void @test_storage() {
ret void
}
/* Type definitions */
struct sfile {
  int dummy;
};

/* Variables and functions */
int sfile_read_until(struct sfile *, int /*<<< orphan*/, int /*<<< orphan*/);
int av_sfile_startget(struct sfile *fil) { return sfile_read_until(fil, 0, 0); }


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

x86 assembly (clang, -O2):
<av_sfile_startget>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <sfile_read_until@plt>

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

LLVM IR (-O2):
%struct.sfile = type { i32 }
define i32 @av_sfile_startget(%struct.sfile* %0) {
%2 = tail call i32 @sfile_read_until(%struct.sfile* %0, i32 0, i32 0)
ret i32 %2
}
void math_matrix_perspective(float *matrix, const int width, const int height) {
  matrix[0] = height / width;
  matrix[5] = 1;
  matrix[10] = -1;
  matrix[11] = -1;
  matrix[14] = -2;
}


x86 assembly (clang, -O0):
<math_matrix_perspective>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cvtsi2ss %eax,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0xedb(%rip),%xmm0
movss  %xmm0,0x14(%rax)
mov    -0x8(%rbp),%rax
movss  0xec6(%rip),%xmm0
movss  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
movss  0xeb5(%rip),%xmm0
movss  %xmm0,0x2c(%rax)
mov    -0x8(%rbp),%rax
movss  0xea0(%rip),%xmm0
movss  %xmm0,0x38(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_matrix_perspective>:
mov    %edx,%eax
cltd
idiv   %esi
cvtsi2ss %eax,%xmm0
movss  %xmm0,(%rdi)
movl   $0x3f800000,0x14(%rdi)
movabs $0xbf800000bf800000,%rax
mov    %rax,0x28(%rdi)
movl   $0xc0000000,0x38(%rdi)
ret

LLVM IR (-O0):
define void @math_matrix_perspective(float* %0, i32 %1, i32 %2) {
%4 = alloca float*
%5 = alloca i32
%6 = alloca i32
store float* %0, float** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i32, i32* %5
%9 = sdiv i32 %7, %8
%10 = sitofp i32 %9 to float
%11 = load float*, float** %4
%12 = getelementptr inbounds float, float* %11, i64 0
store float %10, float* %12
%13 = load float*, float** %4
%14 = getelementptr inbounds float, float* %13, i64 5
store float 1.000000e+00, float* %14
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 10
store float -1.000000e+00, float* %16
%17 = load float*, float** %4
%18 = getelementptr inbounds float, float* %17, i64 11
store float -1.000000e+00, float* %18
%19 = load float*, float** %4
%20 = getelementptr inbounds float, float* %19, i64 14
store float -2.000000e+00, float* %20
ret void
}

LLVM IR (-O2):
define void @math_matrix_perspective(float* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = sdiv i32 %2, %1
%5 = sitofp i32 %4 to float
store float %5, float* %0
%6 = getelementptr inbounds float, float* %0, i64 5
store float 1.000000e+00, float* %6
%7 = getelementptr inbounds float, float* %0, i64 10
store float -1.000000e+00, float* %7
%8 = getelementptr inbounds float, float* %0, i64 11
store float -1.000000e+00, float* %8
%9 = getelementptr inbounds float, float* %0, i64 14
store float -2.000000e+00, float* %9
ret void
}
/* Variables and functions */
int pt_compare_min(char const *, char const *);
int pt_compare_max(const char *a, const char *b) {
  return 0 - pt_compare_min(a, b);
}


x86 assembly (clang, -O0):
<pt_compare_max>:
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 <pt_compare_min@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pt_compare_max>:
push   %rax
call   1030 <pt_compare_min@plt>
neg    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @pt_compare_max(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @pt_compare_min(i8* %5, i8* %6)
%8 = sub nsw i32 0, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @pt_compare_max(i8* %0, i8* %1) {
%3 = tail call i32 @pt_compare_min(i8* %0, i8* %1)
%4 = sub nsw i32 0, %3
ret i32 %4
}
/* Variables and functions */
int calculateExpression();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, const char *argv[]) {
  printf("\nResult is %d\n", calculateExpression());
  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    $0x0,%al
call   1040 <calculateExpression@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <calculateExpression@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"\0AResult is %d\0A\00"
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 (...) @calculateExpression()
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"\0AResult is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @calculateExpression()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ system(char *);
int in2dump(char filename[]) {
  char cmd[1000];
  sprintf(cmd, "grep -v \"#\" %s > %s.dump", filename, filename);
  system(cmd);
  return 0;
}


x86 assembly (clang, -O0):
<in2dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xebb(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x3f0(%rbp),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<in2dump>:
push   %rbx
sub    $0x3f0,%rsp
mov    %rdi,%rcx
lea    0xece(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rcx,%rdx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"grep -v \22#\22 %s > %s.dump\00"
define i32 @in2dump(i8* %0) {
%2 = alloca i8*
%3 = alloca [1000 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%9 = call i32 @system(i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"grep -v \22#\22 %s > %s.dump\00"
define i32 @in2dump(i8* %0) {
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0)
%5 = call i32 @system(i8* %3)
ret i32 0
}
void ice_init_arfs(struct ice_vsi *vsi) {}


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

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

LLVM IR (-O0):
%struct.ice_vsi = type opaque
define void @ice_init_arfs(%struct.ice_vsi* %0) {
%2 = alloca %struct.ice_vsi*
store %struct.ice_vsi* %0, %struct.ice_vsi** %2
ret void
}

LLVM IR (-O2):
%struct.ice_vsi = type opaque
define void @ice_init_arfs(%struct.ice_vsi* nocapture %0) {
ret void
}
/* Variables and functions */
void stub1(void *);
void iterate(void (*f)(void *), void **list) {
  if (list == NULL)
    return;
  void *l;
  int i = -1;
  while (true) {
    if ((l = list[++i]) == NULL)
      break;
    (*f)(l);
  }
}


x86 assembly (clang, -O0):
<iterate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1120 <iterate+0x20>
jmp    115d <iterate+0x5d>
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    114e <iterate+0x4e>
jmp    115d <iterate+0x5d>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rdi
call   *%rax
jmp    1127 <iterate+0x27>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iterate>:
push   %r14
push   %rbx
push   %rax
test   %rsi,%rsi
je     112f <iterate+0x2f>
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%rdi
test   %rdi,%rdi
je     112f <iterate+0x2f>
add    $0x8,%rbx
nopl   0x0(%rax,%rax,1)
call   *%r14
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1120 <iterate+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @iterate(void (i8*)* %0, i8** %1) {
%3 = alloca void (i8*)*
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32
store void (i8*)* %0, void (i8*)** %3
store i8** %1, i8*** %4
%7 = load i8**, i8*** %4
%8 = icmp eq i8** %7, null
br i1 %8, label %9, label %10
9: ; preds = %2
br label %23
10: ; preds = %2
store i32 -1, i32* %6
br label %11
11: ; preds = %10, %20
%12 = load i8**, i8*** %4
%13 = load i32, i32* %6
%14 = add nsw i32 %13, 1
store i32 %14, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %12, i64 %15
%17 = load i8*, i8** %16
store i8* %17, i8** %5
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %20
19: ; preds = %11
br label %23
20: ; preds = %11
%21 = load void (i8*)*, void (i8*)** %3
%22 = load i8*, i8** %5
br label %11
23: ; preds = %9, %19
ret void
}

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