xunge/DecIR huggingface dataset:
/* Type definitions */
struct hda_codec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ alc_exec_unsol_event(struct hda_codec *, unsigned int);
void alc882_unsol_event(struct hda_codec *codec, unsigned int res) {
  alc_exec_unsol_event(codec, res >> 26);
}


x86 assembly (clang, -O0):
<alc882_unsol_event>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
shr    $0x1a,%esi
call   1030 <alc_exec_unsol_event@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alc882_unsol_event>:
shr    $0x1a,%esi
jmp    1030 <alc_exec_unsol_event@plt>

LLVM IR (-O0):
%struct.hda_codec = type { i32 }
define void @alc882_unsol_event(%struct.hda_codec* %0, i32 %1) {
%3 = alloca %struct.hda_codec*
%4 = alloca i32
store %struct.hda_codec* %0, %struct.hda_codec** %3
store i32 %1, i32* %4
%5 = load %struct.hda_codec*, %struct.hda_codec** %3
%6 = load i32, i32* %4
%7 = lshr i32 %6, 26
%8 = call i32 @alc_exec_unsol_event(%struct.hda_codec* %5, i32 %7)
ret void
}

LLVM IR (-O2):
%struct.hda_codec = type { i32 }
define void @alc882_unsol_event(%struct.hda_codec* %0, i32 %1) {
%3 = lshr i32 %1, 26
%4 = tail call i32 @alc_exec_unsol_event(%struct.hda_codec* %0, i32 %3)
ret void
}
int MUD_pack(num, inBinSize, inArray, outBinSize, outArray)
int num;
int inBinSize;
void *inArray;
int outBinSize;
void *outArray;
{
  return (MUD_SEC_GEN_HIST_pack(num, inBinSize, inArray, outBinSize, outArray));
}


x86 assembly (clang, -O0):
<MUD_pack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    $0x0,%al
call   1030 <MUD_SEC_GEN_HIST_pack@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MUD_pack>:
xor    %eax,%eax
jmp    1030 <MUD_SEC_GEN_HIST_pack@plt>

LLVM IR (-O0):
define i32 @MUD_pack(i32 %0, i32 %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i8*, i8** %8
%14 = load i32, i32* %9
%15 = load i8*, i8** %10
%16 = call i32 (i32, i32, i8*, i32, i8*, ...) bitcast (i32 (...)* @MUD_SEC_GEN_HIST_pack to i32 (i32, i32, i8*, i32, i8*, ...)*)(i32 %11, i32 %12, i8* %13, i32 %14, i8* %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @MUD_pack(i32 %0, i32 %1, i8* %2, i32 %3, i8* %4) {
%6 = tail call i32 (i32, i32, i8*, i32, i8*, ...) bitcast (i32 (...)* @MUD_SEC_GEN_HIST_pack to i32 (i32, i32, i8*, i32, i8*, ...)*)(i32 %0, i32 %1, i8* %2, i32 %3, i8* %4)
ret i32 %6
}
int warp_min(int a, int b) { return a < b ? a : b; }


x86 assembly (clang, -O0):
<warp_min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <warp_min+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <warp_min+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<warp_min>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @warp_min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ General_USART_Init();
void ESP8266_UART_Init(void) { General_USART_Init(); }


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

x86 assembly (clang, -O2):
<ESP8266_UART_Init>:
xor    %eax,%eax
jmp    1030 <General_USART_Init@plt>

LLVM IR (-O0):
define void @ESP8266_UART_Init() {
%1 = call i32 (...) @General_USART_Init()
ret void
}

LLVM IR (-O2):
define void @ESP8266_UART_Init() {
%1 = tail call i32 (...) @General_USART_Init()
ret void
}
/* Variables and functions */
int my_func();
int main(void) {
  int ret = 0;
  ret = my_func();
  return ret;
}


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

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
jmp    1030 <my_func@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @my_func()
ret i32 %1
}
/* Variables and functions */
void *calloc(int, size_t);
void *my_alloc(size_t size) { return calloc(1, size); }


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

x86 assembly (clang, -O2):
<my_alloc>:
mov    %rdi,%rsi
mov    $0x1,%edi
jmp    1030 <calloc@plt>

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

LLVM IR (-O2):
define i8* @my_alloc(i64 %0) {
%2 = tail call i8* @calloc(i32 1, i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ hash(char const *);
void f(const char *str, int *h) {
  int i = 6;
  while (i--)
    *h++ = hash(str);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x6,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     115c <f+0x4c>
mov    -0x8(%rbp),%rdi
call   1030 <hash@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x10(%rbp)
mov    %ecx,(%rax)
jmp    1127 <f+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <hash@plt>
mov    %eax,(%r14)
mov    %rbx,%rdi
call   1030 <hash@plt>
mov    %eax,0x4(%r14)
mov    %rbx,%rdi
call   1030 <hash@plt>
mov    %eax,0x8(%r14)
mov    %rbx,%rdi
call   1030 <hash@plt>
mov    %eax,0xc(%r14)
mov    %rbx,%rdi
call   1030 <hash@plt>
mov    %eax,0x10(%r14)
mov    %rbx,%rdi
call   1030 <hash@plt>
mov    %eax,0x14(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @f(i8* %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @hash(i8* %0)
%4 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %3, i32* %1
%5 = tail call i32 @hash(i8* %0)
%6 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %5, i32* %4
%7 = tail call i32 @hash(i8* %0)
%8 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %7, i32* %6
%9 = tail call i32 @hash(i8* %0)
%10 = getelementptr inbounds i32, i32* %1, i64 4
store i32 %9, i32* %8
%11 = tail call i32 @hash(i8* %0)
%12 = getelementptr inbounds i32, i32* %1, i64 5
store i32 %11, i32* %10
%13 = tail call i32 @hash(i8* %0)
store i32 %13, i32* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void vt100_cursor_back(void) {
  printf("\x1B[D");
  fflush(stdout);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[D\00"
@stdout = global i32 0
define void @vt100_cursor_back() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[D\00"
@stdout = global i32 0
define void @vt100_cursor_back() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
ret void
}
/* Variables and functions */
int putchar(int);
int wsh_putchar(int c) { return putchar(c); }


x86 assembly (clang, -O0):
<wsh_putchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wsh_putchar>:
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define i32 @wsh_putchar(i32 %0) {
%2 = tail call i32 @putchar(i32 %0)
ret i32 %2
}
int test_nested1(int foo, int bar) { return foo; }


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

x86 assembly (clang, -O2):
<test_nested1>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @test_nested1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
ret i32 %5
}

LLVM IR (-O2):
define i32 @test_nested1(i32 returned %0, i32 %1) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_1D(int length, int *arr) {
  int j;
  for (j = 0; j < length; j++) {
    printf("%d ", arr[j]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_1D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1159 <print_1D+0x49>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <print_1D+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_1D>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1157 <print_1D+0x37>
mov    %rsi,%r15
mov    %edi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_1D+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_1D(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %4
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print_1D(i32 %0, i32* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %1, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int /*<<< orphan*/ O_RDONLY;
int fcntl(int, int /*<<< orphan*/, int);
int open(char const *, int /*<<< orphan*/);
int open_fifo(const char *path) {
  int fd = open(path, O_RDONLY);
  int flags = fcntl(fd, F_GETFL, 0);
  fcntl(fd, F_SETFL, flags | O_NONBLOCK);
  return fd;
}


x86 assembly (clang, -O0):
<open_fifo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    0x2e7d(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    0x2e6f(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%edx
mov    0x2e7b(%rip),%rax
or     (%rax),%edx
call   1030 <fcntl@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_fifo>:
push   %rbx
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,%ebx
mov    0x2e90(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    0x2e86(%rip),%rcx
mov    (%rcx),%esi
mov    0x2e95(%rip),%rcx
or     (%rcx),%eax
mov    %ebx,%edi
mov    %eax,%edx
call   1030 <fcntl@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
define i32 @open_fifo(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = load i32, i32* @O_RDONLY
%7 = call i32 @open(i8* %5, i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = load i32, i32* @F_GETFL
%10 = call i32 @fcntl(i32 %8, i32 %9, i32 0)
store i32 %10, i32* %4
%11 = load i32, i32* %3
%12 = load i32, i32* @F_SETFL
%13 = load i32, i32* %4
%14 = load i32, i32* @O_NONBLOCK
%15 = or i32 %13, %14
%16 = call i32 @fcntl(i32 %11, i32 %12, i32 %15)
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
define i32 @open_fifo(i8* nocapture %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = load i32, i32* @F_GETFL
%5 = tail call i32 @fcntl(i32 %3, i32 %4, i32 0)
%6 = load i32, i32* @F_SETFL
%7 = load i32, i32* @O_NONBLOCK
%8 = or i32 %7, %5
%9 = tail call i32 @fcntl(i32 %3, i32 %6, i32 %8)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_node(int key, int h) {
  int i;
  for (i = 0; i < h; i++)
    printf("    ");
  printf("%d\n", key);
}


x86 assembly (clang, -O0):
<print_node>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    114d <print_node+0x3d>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <print_node+0x15>
mov    -0x4(%rbp),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_node>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
test   %esi,%esi
jle    113f <print_node+0x2f>
mov    %esi,%ebp
lea    0xedc(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jne    1130 <print_node+0x20>
lea    0xebf(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @print_node(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %12, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
store i32 %14, i32* %5
br label %6
15: ; preds = %6
%16 = load i32, i32* %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c" \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @print_node(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ 0, %2 ]
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %1
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
struct db_query {
  int dummy;
};
typedef int /*<<< orphan*/ sqlite3_stmt;
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ sqlite3_column_int64(int /*<<< orphan*/ *, int);
int64_t db_column_int64(struct db_query *query, int i) {
  if (query == NULL)
    return -1;
  return (int64_t)sqlite3_column_int64((sqlite3_stmt *)query, i);
}


x86 assembly (clang, -O0):
<db_column_int64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1136 <db_column_int64+0x26>
movl   $0xffffffff,-0x4(%rbp)
jmp    1145 <db_column_int64+0x35>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <sqlite3_column_int64@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_column_int64>:
test   %rdi,%rdi
je     111a <db_column_int64+0xa>
jmp    1030 <sqlite3_column_int64@plt>
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.db_query = type { i32 }
define i32 @db_column_int64(%struct.db_query* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.db_query*
%5 = alloca i32
store %struct.db_query* %0, %struct.db_query** %4
store i32 %1, i32* %5
%6 = load %struct.db_query*, %struct.db_query** %4
%7 = icmp eq %struct.db_query* %6, null
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 -1, i32* %3
br label %14
9: ; preds = %2
%10 = load %struct.db_query*, %struct.db_query** %4
%11 = bitcast %struct.db_query* %10 to i32*
%12 = load i32, i32* %5
%13 = call i32 @sqlite3_column_int64(i32* %11, i32 %12)
store i32 %13, i32* %3
br label %14
14: ; preds = %9, %8
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
%struct.db_query = type { i32 }
define i32 @db_column_int64(%struct.db_query* %0, i32 %1) {
%3 = icmp eq %struct.db_query* %0, null
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = getelementptr %struct.db_query, %struct.db_query* %0, i64 0, i32 0
%6 = tail call i32 @sqlite3_column_int64(i32* %5, i32 %1)
br label %7
7: ; preds = %2, %4
%8 = phi i32 [ %6, %4 ], [ -1, %2 ]
ret i32 %8
}
/* Variables and functions */
char *strchr(const char *s, int c) {
  while (*s != (char)c) {
    if (*s == '\0') {
      return NULL;
    }
    ++s;
  }
  return (char *)s;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x14(%rbp),%ecx
movsbl %cl,%ecx
cmp    %ecx,%eax
je     114e <strchr+0x4e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    113d <strchr+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    1156 <strchr+0x56>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110b <strchr+0xb>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
movsbl %sil,%ecx
movsbl (%rdi),%edx
cmp    %edx,%ecx
je     1120 <strchr+0x20>
xchg   %ax,%ax
test   %dl,%dl
je     1121 <strchr+0x21>
movsbl 0x1(%rax),%edx
add    $0x1,%rax
cmp    %edx,%ecx
jne    1110 <strchr+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = shl i32 %1, 24
%4 = ashr exact i32 %3, 24
%5 = load i8, i8* %0
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %4, %6
br i1 %7, label %17, label %8
8: ; preds = %2, %12
%9 = phi i8 [ %14, %12 ], [ %5, %2 ]
%10 = phi i8* [ %13, %12 ], [ %0, %2 ]
%11 = icmp eq i8 %9, 0
br i1 %11, label %17, label %12
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %10, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %4, %15
br i1 %16, label %17, label %8
17: ; preds = %8, %12, %2
%18 = phi i8* [ %0, %2 ], [ %13, %12 ], [ null, %8 ]
ret i8* %18
}
int test_imm_28uint16_reg(unsigned short val) {
  return ((val) & (-0x28 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_28uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffffd8,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_28uint16_reg>:
test   $0xffd8,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_28uint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, -40
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_28uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -40
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  int a;
  int b;
  scanf("%d", &n);
  a = n * n;
  b = n * n * n;
  printf("%d \n", a);
  printf("%d \n", b);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ebx
mov    %ebx,%esi
imul   %ebx,%esi
imul   %esi,%ebx
lea    0xebb(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = mul nsw i32 %6, %7
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = load i32, i32* %2
%11 = mul nsw i32 %9, %10
%12 = load i32, i32* %2
%13 = mul nsw i32 %11, %12
store i32 %13, i32* %4
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %4
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d \0A\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 = mul nsw i32 %4, %4
%6 = mul nsw i32 %5, %4
%7 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%8 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}
void ball_new() {}


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

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

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

LLVM IR (-O2):
define void @ball_new() {
ret void
}
/* Variables and functions */
char *quotearg_char(char const *, char);
char *quotearg_colon(char const *arg) { return quotearg_char(arg, ':'); }


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

x86 assembly (clang, -O2):
<quotearg_colon>:
mov    $0x3a,%esi
jmp    1030 <quotearg_char@plt>

LLVM IR (-O0):
define i8* @quotearg_colon(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @quotearg_char(i8* %3, i8 signext 58)
ret i8* %4
}

LLVM IR (-O2):
define i8* @quotearg_colon(i8* %0) {
%2 = tail call i8* @quotearg_char(i8* %0, i8 signext 58)
ret i8* %2
}
/* Variables and functions */
int atoi(char const *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ proxyLog(char *, char const *);
int parseNumIOThreads(const char *optarg) {
  const int numIOThreads = atoi(optarg);
  if (numIOThreads <= 0) {
    proxyLog("invalid num io threads %s", optarg);
    exit(1);
  }
  return numIOThreads;
}


x86 assembly (clang, -O0):
<parseNumIOThreads>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     116c <parseNumIOThreads+0x3c>
mov    -0x8(%rbp),%rsi
lea    0xea3(%rip),%rdi
call   1030 <proxyLog@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseNumIOThreads>:
push   %rbx
mov    %rdi,%rbx
call   1040 <atoi@plt>
test   %eax,%eax
jle    113f <parseNumIOThreads+0xf>
pop    %rbx
ret
lea    0xeba(%rip),%rdi
mov    %rbx,%rsi
call   1030 <proxyLog@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"invalid num io threads %s\00"
define i32 @parseNumIOThreads(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @atoi(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @proxyLog(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@.str = [26 x i8] c"invalid num io threads %s\00"
define i32 @parseNumIOThreads(i8* %0) {
%2 = tail call i32 @atoi(i8* %0)
%3 = icmp slt i32 %2, 1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @proxyLog(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ __coverity_panic__();
void _assert_in_range(const unsigned long long value,
                      const unsigned long long minimum,
                      const unsigned long long maximum, const char *const file,
                      const int line) {
  __coverity_panic__();
}


x86 assembly (clang, -O0):
<_assert_in_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    $0x0,%al
call   1030 <__coverity_panic__@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_assert_in_range>:
xor    %eax,%eax
jmp    1030 <__coverity_panic__@plt>

LLVM IR (-O0):
define void @_assert_in_range(i64 %0, i64 %1, i64 %2, i8* %3, i32 %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i32
store i64 %0, i64* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = call i32 (...) @__coverity_panic__()
ret void
}

LLVM IR (-O2):
define void @_assert_in_range(i64 %0, i64 %1, i64 %2, i8* nocapture readnone %3, i32 %4) {
%6 = tail call i32 (...) @__coverity_panic__()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void NEWLINE(void) { printf("-------------------------------------------\n"); }


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

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

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

LLVM IR (-O2):
@str = [44 x i8] c"-------------------------------------------\00"
define void @NEWLINE() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void do_flush() {
  fflush(stdout);
  fflush(stderr);
}


x86 assembly (clang, -O0):
<do_flush>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
mov    0x2eb7(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_flush>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1030 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
@stderr = global i32 0
define void @do_flush() {
%1 = load i32, i32* @stdout
%2 = call i32 @fflush(i32 %1)
%3 = load i32, i32* @stderr
%4 = call i32 @fflush(i32 %3)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@stderr = global i32 0
define void @do_flush() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fflush(i32 %1)
%3 = load i32, i32* @stderr
%4 = tail call i32 @fflush(i32 %3)
ret void
}
void main() {
  int y;
  int f;
  int x = 0;
  if (y > 0) {
    f = 1;
  } else {
    f = 0;
  }
  if (f > 0) {
    x = y;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1121 <main+0x21>
movl   $0x1,-0x8(%rbp)
jmp    1128 <main+0x28>
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1138 <main+0x38>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @main() {
ret void
}
long grib_op_add(long a, long b) { return a + b; }


x86 assembly (clang, -O0):
<grib_op_add>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<grib_op_add>:
lea    (%rdi,%rsi,1),%rax
ret

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

LLVM IR (-O2):
define i64 @grib_op_add(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
ret i64 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int dopr(char *, size_t, char const *, int /*<<< orphan*/);
int rsync_vsnprintf(char *str, size_t count, const char *fmt, va_list args) {
  return dopr(str, count, fmt, args);
}


x86 assembly (clang, -O0):
<rsync_vsnprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <dopr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsync_vsnprintf>:
jmp    1030 <dopr@plt>

LLVM IR (-O0):
define i32 @rsync_vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 @dopr(i8* %9, i64 %10, i8* %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @rsync_vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = tail call i32 @dopr(i8* %0, i64 %1, i8* %2, i32 %3)
ret i32 %5
}
int do_882() { return 882; }


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

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

LLVM IR (-O0):
define i32 @do_882() {
ret i32 882
}

LLVM IR (-O2):
define i32 @do_882() {
ret i32 882
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef size_t uint32_t;

/* Variables and functions */
uint32_t *p32(uint8_t *c, uint32_t i) { return (uint32_t *)&c[i]; }


x86 assembly (clang, -O0):
<p32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<p32>:
lea    (%rdi,%rsi,4),%rax
ret

LLVM IR (-O0):
define i64* @p32(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%5 = load i32*, i32** %3
%6 = load i64, i64* %4
%7 = getelementptr inbounds i32, i32* %5, i64 %6
%8 = bitcast i32* %7 to i64*
ret i64* %8
}

LLVM IR (-O2):
define i64* @p32(i32* readnone %0, i64 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 %1
%4 = bitcast i32* %3 to i64*
ret i64* %4
}
/* Type definitions */
struct option {
  int dummy;
};

/* Variables and functions */
int _gnu_getopt_internal(int, char *const *, char const *,
                         struct option const *, int *, int /*<<< orphan*/);
int gnu_getopt_long(int argc, char *const *argv, const char *options,
                    const struct option *long_options, int *opt_index) {
  return _gnu_getopt_internal(argc, argv, options, long_options, opt_index, 0);
}


x86 assembly (clang, -O0):
<gnu_getopt_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
xor    %r9d,%r9d
call   1030 <_gnu_getopt_internal@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gnu_getopt_long>:
xor    %r9d,%r9d
jmp    1030 <_gnu_getopt_internal@plt>

LLVM IR (-O0):
%struct.option = type { i32 }
define i32 @gnu_getopt_long(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca %struct.option*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store %struct.option* %3, %struct.option** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8*, i8** %8
%14 = load %struct.option*, %struct.option** %9
%15 = load i32*, i32** %10
%16 = call i32 @_gnu_getopt_internal(i32 %11, i8** %12, i8* %13, %struct.option* %14, i32* %15, i32 0)
ret i32 %16
}

LLVM IR (-O2):
%struct.option = type { i32 }
define i32 @gnu_getopt_long(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = tail call i32 @_gnu_getopt_internal(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, i32 0)
ret i32 %6
}
int internal_thingy() { return 99; }


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

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

LLVM IR (-O0):
define i32 @internal_thingy() {
ret i32 99
}

LLVM IR (-O2):
define i32 @internal_thingy() {
ret i32 99
}
void sig_do_pipe(int status) {}


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

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

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

LLVM IR (-O2):
define void @sig_do_pipe(i32 %0) {
ret void
}
/* Type definitions */
struct pevent {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pevent_register_trace_clock(struct pevent *, char *);
int /*<<< orphan*/ sscanf(char *, char *, char **);
char *strtok_r(char *, char *, char **);
void extract_trace_clock(struct pevent *pevent, char *line) {
  char *data;
  char *clock;
  char *next = NULL;
  data = strtok_r(line, "[]", &next);
  sscanf(data, "%ms", &clock);
  pevent_register_trace_clock(pevent, clock);
}


x86 assembly (clang, -O0):
<extract_trace_clock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xead(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <strtok_r@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe98(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <sscanf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <pevent_register_trace_clock@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_trace_clock>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rax
mov    %rdi,%rbx
movq   $0x0,(%rsp)
lea    0xeb6(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1040 <strtok_r@plt>
lea    0xea7(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rax,%rdi
call   1050 <sscanf@plt>
mov    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <pevent_register_trace_clock@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.pevent = type { i32 }
@.str = [3 x i8] c"[]\00"
@.str.1 = [4 x i8] c"%ms\00"
define void @extract_trace_clock(%struct.pevent* %0, i8* %1) {
%3 = alloca %struct.pevent*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store %struct.pevent* %0, %struct.pevent** %3
store i8* %1, i8** %4
store i8* null, i8** %7
%8 = load i8*, i8** %4
%9 = call i8* @strtok_r(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %7)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %6)
%12 = load %struct.pevent*, %struct.pevent** %3
%13 = load i8*, i8** %6
%14 = call i32 @pevent_register_trace_clock(%struct.pevent* %12, i8* %13)
ret void
}

LLVM IR (-O2):
%struct.pevent = type { i32 }
@.str = [3 x i8] c"[]\00"
@.str.1 = [4 x i8] c"%ms\00"
define void @extract_trace_clock(%struct.pevent* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = bitcast i8** %3 to i8*
%6 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%7 = call i8* @strtok_r(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %4)
%8 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %3)
%9 = load i8*, i8** %3
%10 = call i32 @pevent_register_trace_clock(%struct.pevent* %0, i8* %9)
ret void
}
int strcmp(const char *s1, const char *s2) {
  while (*s1 == *s2++)
    if (*s1++ == '\0') {
      return (0);
    }
  return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1));
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1159 <strcmp+0x59>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1154 <strcmp+0x54>
movl   $0x0,-0x4(%rbp)
jmp    116d <strcmp+0x6d>
jmp    110c <strcmp+0xc>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movzbl -0x1(%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%edx
cmp    %dl,%al
jne    1127 <strcmp+0x27>
add    $0x1,%rcx
test   %eax,%eax
jne    1110 <strcmp+0x10>
xor    %eax,%eax
ret
sub    %edx,%eax
ret

LLVM IR (-O0):
define i32 @strcmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
br label %6
6: ; preds = %22, %2
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = load i8*, i8** %5
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %5
%12 = load i8, i8* %10
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %9, %13
br i1 %14, label %15, label %23
15: ; preds = %6
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %4
%18 = load i8, i8* %16
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %15
store i32 0, i32* %3
br label %32
22: ; preds = %15
br label %6
23: ; preds = %6
%24 = load i8*, i8** %4
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i64 -1
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = sub nsw i32 %26, %30
store i32 %31, i32* %3
br label %32
32: ; preds = %23, %21
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %9, %2
%4 = phi i8* [ %0, %2 ], [ %11, %9 ]
%5 = phi i8* [ %1, %2 ], [ %10, %9 ]
%6 = load i8, i8* %4
%7 = load i8, i8* %5
%8 = icmp eq i8 %6, %7
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = getelementptr inbounds i8, i8* %5, i64 1
%11 = getelementptr inbounds i8, i8* %4, i64 1
%12 = icmp eq i8 %6, 0
br i1 %12, label %17, label %3
13: ; preds = %3
%14 = zext i8 %6 to i32
%15 = zext i8 %7 to i32
%16 = sub nsw i32 %14, %15
br label %17
17: ; preds = %9, %13
%18 = phi i32 [ %16, %13 ], [ 0, %9 ]
ret i32 %18
}
/* Type definitions */
typedef int /*<<< orphan*/ HMAC_CTX;

/* Variables and functions */
int /*<<< orphan*/ HMAC_CTX_cleanup(int /*<<< orphan*/ *);
int /*<<< orphan*/ OPENSSL_free(int /*<<< orphan*/ *);
void HMAC_CTX_free(HMAC_CTX *ctx) {
  HMAC_CTX_cleanup(ctx);
  OPENSSL_free(ctx);
}


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

x86 assembly (clang, -O2):
<HMAC_CTX_free>:
push   %rbx
mov    %rdi,%rbx
call   1030 <HMAC_CTX_cleanup@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <OPENSSL_free@plt>

LLVM IR (-O0):
define void @HMAC_CTX_free(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @HMAC_CTX_cleanup(i32* %3)
%5 = load i32*, i32** %2
%6 = call i32 @OPENSSL_free(i32* %5)
ret void
}

LLVM IR (-O2):
define void @HMAC_CTX_free(i32* %0) {
%2 = tail call i32 @HMAC_CTX_cleanup(i32* %0)
%3 = tail call i32 @OPENSSL_free(i32* %0)
ret void
}
int min(int x, int y) {
  int z;
  if (x < y)
    z = x;
  else
    z = y;
  return z;
}


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <min+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <min+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int count_char(char *, char);
char getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  char s[100], c;
  gets(s);
  c = getchar();
  printf("%d\n", count_char(s, c));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
call   1060 <gets@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x71(%rbp)
lea    -0x70(%rbp),%rdi
movsbl -0x71(%rbp),%esi
call   1030 <count_char@plt>
mov    %eax,%esi
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
movsbl %al,%esi
mov    %rbx,%rdi
call   1030 <count_char@plt>
lea    0xe97(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i8
store i32 0, i32* %1
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = call signext i8 (...) @getchar()
store i8 %6, i8* %3
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = load i8, i8* %3
%9 = call i32 @count_char(i8* %7, i8 signext %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = call signext i8 (...) @getchar()
%5 = call i32 @count_char(i8* %2, i8 signext %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}