xunge/DecIR huggingface dataset:
void ff_hevc_put_hevc_uni_w_epel_hv32_8_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_w_epel_hv32_8_sse4() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
void write8(FILE *out, unsigned char p) {
  fwrite(&p, 1, 1, out);
  return;
}


x86 assembly (clang, -O0):
<write8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x9(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fwrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write8>:
mov    %rdi,%rax
movsbl %sil,%edi
mov    %rax,%rsi
jmp    1030 <fputc@plt>

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

LLVM IR (-O2):
define void @write8(i32* nocapture %0, i8 zeroext %1) {
%3 = sext i8 %1 to i32
%4 = tail call i32 @fputc(i32 %3, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int *malloc(int);
int malloc_usable_size(void *);
int main(void) {
  int *x = malloc(99);
  assert(99 == malloc_usable_size(x));
  assert(0 == malloc_usable_size(NULL));
  assert(0 == malloc_usable_size((void *)0xdeadbeef));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x63,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <malloc_usable_size@plt>
mov    %eax,%ecx
mov    $0x63,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <malloc_usable_size@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0xdeadbeef,%edi
call   1030 <malloc_usable_size@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x63,%edi
call   1050 <malloc@plt>
mov    %rax,%rdi
call   1030 <malloc_usable_size@plt>
xor    %edi,%edi
cmp    $0x63,%eax
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
call   1030 <malloc_usable_size@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    $0xdeadbeef,%edi
call   1030 <malloc_usable_size@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @malloc(i32 99)
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = bitcast i32* %4 to i8*
%6 = call i32 @malloc_usable_size(i8* %5)
%7 = icmp eq i32 99, %6
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 @malloc_usable_size(i8* null)
%11 = icmp eq i32 0, %10
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = call i32 @malloc_usable_size(i8* inttoptr (i64 3735928559 to i8*))
%15 = icmp eq i32 0, %14
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 99)
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @malloc_usable_size(i8* %2)
%4 = icmp eq i32 %3, 99
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @malloc_usable_size(i8* null)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 @malloc_usable_size(i8* inttoptr (i64 3735928559 to i8*))
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
ret i32 0
}
/* Variables and functions */
int foo(int, int);
__attribute__((no)) int bar(int a, int b) { return foo(b * 3, a); }


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0x3,-0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
mov    %edi,%eax
lea    (%rsi,%rsi,2),%edi
mov    %eax,%esi
jmp    1030 <foo@plt>

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

LLVM IR (-O2):
define i32 @bar(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, 3
%4 = tail call i32 @foo(i32 %3, i32 %0)
ret i32 %4
}
void modplayer_code_lock_end(void) {}


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

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

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

LLVM IR (-O2):
define void @modplayer_code_lock_end() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ isdir(char *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  assert(0 == isdir("./testd"));
  printf("ok\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1050 <isdir@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1050 <isdir@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"./testd\00"
@.str.1 = [4 x i8] c"ok\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @isdir(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 0, %2
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"./testd\00"
@str = [3 x i8] c"ok\00"
define i32 @main() {
%1 = tail call i64 @isdir(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int ti_round_start(double const *options) {
  (void)options;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @ti_round_start(double* nocapture readnone %0) {
ret i32 0
}
int strcmp(const char *l, const char *r) {
  for (; *l == *r && *l; l++, r++)
    ;
  return *(unsigned char *)l - *(unsigned char *)r;
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
jne    1137 <strcmp+0x37>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1147 <strcmp+0x47>
jmp    1169 <strcmp+0x69>
jmp    114c <strcmp+0x4c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <strcmp+0xc>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
mov    (%rdi),%al
mov    (%rsi),%cl
test   %al,%al
je     1134 <strcmp+0x34>
cmp    %cl,%al
jne    1134 <strcmp+0x34>
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rdi,%rdx,1),%eax
movzbl (%rsi,%rdx,1),%ecx
test   %al,%al
je     1134 <strcmp+0x34>
add    $0x1,%rdx
cmp    %cl,%al
je     1120 <strcmp+0x20>
movzbl %al,%eax
movzbl %cl,%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp ne i8 %3, %4
%6 = icmp eq i8 %3, 0
%7 = or i1 %6, %5
br i1 %7, label %18, label %8
8: ; preds = %2, %8
%9 = phi i8* [ %12, %8 ], [ %1, %2 ]
%10 = phi i8* [ %11, %8 ], [ %0, %2 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = load i8, i8* %11
%14 = load i8, i8* %12
%15 = icmp ne i8 %13, %14
%16 = icmp eq i8 %13, 0
%17 = or i1 %16, %15
br i1 %17, label %18, label %8
18: ; preds = %8, %2
%19 = phi i8 [ %3, %2 ], [ %13, %8 ]
%20 = phi i8 [ %4, %2 ], [ %14, %8 ]
%21 = zext i8 %19 to i32
%22 = zext i8 %20 to i32
%23 = sub nsw i32 %21, %22
ret i32 %23
}
int fun701() { return 701; }


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

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

LLVM IR (-O0):
define i32 @fun701() {
ret i32 701
}

LLVM IR (-O2):
define i32 @fun701() {
ret i32 701
}
int Operand_imms_encode(unsigned int *valp) {
  unsigned s_0, imms_0;
  imms_0 = *valp;
  s_0 = imms_0 & 0xf;
  *valp = s_0;
  return 0;
}


x86 assembly (clang, -O0):
<Operand_imms_encode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Operand_imms_encode>:
andl   $0xf,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @Operand_imms_encode(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = and i32 %7, 15
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = load i32*, i32** %2
store i32 %9, i32* %10
ret i32 0
}

LLVM IR (-O2):
define i32 @Operand_imms_encode(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 15
store i32 %3, i32* %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main(void) {
  int a, b, c, d;
  a = 1;
  b = 2;
  c = 3;
  d = 4;
  a = (b = a) * c + d;
  printf("a=%d, b=%d, c=%d, d=%d\n", a, b, c, d);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
movl   $0x4,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
imul   -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [24 x i8] c"a=%d, b=%d, c=%d, d=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 7, i32 1, i32 3, i32 4)
ret i32 0
}
void add(int a[]) {
  int i;
  for (i = 0; i < 3; i++) {
    a[i] = a[i] + i;
  }
}


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1140 <add+0x40>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <add+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
addl   $0x1,0x4(%rdi)
addl   $0x2,0x8(%rdi)
ret

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

LLVM IR (-O2):
define void @add(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
store i32 %4, i32* %2
%5 = getelementptr inbounds i32, i32* %0, i64 2
%6 = load i32, i32* %5
%7 = add nsw i32 %6, 2
store i32 %7, i32* %5
ret void
}
swap(char *x, char *y) {
  char temp;
  temp = *x;
  *x = *y;
  *y = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x19(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
mov    (%rdi),%al
mov    (%rsi),%cl
mov    %cl,(%rdi)
mov    %al,(%rsi)
ret

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

LLVM IR (-O2):
define i32 @swap(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
store i8 %4, i8* %0
store i8 %3, i8* %1
ret i32 undef
}
long NET_recvData(void *pData, int Size, int Mode) { return 0; }


x86 assembly (clang, -O0):
<NET_recvData>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @NET_recvData(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret i64 0
}

LLVM IR (-O2):
define i64 @NET_recvData(i8* nocapture readnone %0, i32 %1, i32 %2) {
ret i64 0
}
int longitud_string(char *s) {
  int i;
  i = 0;
  while (*s != '\0')
    i++;
  s = s + 1;
  return i;
}


x86 assembly (clang, -O0):
<longitud_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     112d <longitud_string+0x2d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <longitud_string+0xf>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @longitud_string(i8* nocapture %0) {
ret i32 0
}
unsigned int __uidiv__(unsigned int num, unsigned int den) {
  unsigned int i;
  if (den == 1)
    return num;
  i = 1;
  while (den * i < num)
    i++;
  return i - 1;
}


x86 assembly (clang, -O0):
<__uidiv__>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    111f <__uidiv__+0x1f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114d <__uidiv__+0x4d>
movl   $0x1,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1144 <__uidiv__+0x44>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <__uidiv__+0x26>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__uidiv__>:
cmp    $0x1,%esi
jne    1108 <__uidiv__+0x8>
mov    %edi,%eax
ret
mov    $0xffffffff,%eax
xor    %ecx,%ecx
nop
add    $0x1,%eax
add    %esi,%ecx
cmp    %edi,%ecx
jb     1110 <__uidiv__+0x10>
ret

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

LLVM IR (-O2):
define i32 @__uidiv__(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 1
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ 1, %2 ]
%6 = mul i32 %5, %1
%7 = icmp ult i32 %6, %0
%8 = add i32 %5, 1
br i1 %7, label %4, label %9
9: ; preds = %4
%10 = add i32 %5, -1
br label %11
11: ; preds = %2, %9
%12 = phi i32 [ %10, %9 ], [ %0, %2 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ LCD_Cmd(int);
void _lcd_reset() { LCD_Cmd(0xE2); }


x86 assembly (clang, -O0):
<_lcd_reset>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe2,%edi
call   1030 <LCD_Cmd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_lcd_reset>:
mov    $0xe2,%edi
jmp    1030 <LCD_Cmd@plt>

LLVM IR (-O0):
define void @_lcd_reset() {
%1 = call i32 @LCD_Cmd(i32 226)
ret void
}

LLVM IR (-O2):
define void @_lcd_reset() {
%1 = tail call i32 @LCD_Cmd(i32 226)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int);
void cpy_elm(void *dst, void *src, int dst_off, int src_off, int width) {
  memcpy(dst + dst_off * width, src + src_off * width, width);
}


x86 assembly (clang, -O0):
<cpy_elm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
add    %rax,%rsi
mov    -0x1c(%rbp),%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpy_elm>:
imul   %r8d,%edx
movslq %edx,%rax
add    %rax,%rdi
imul   %r8d,%ecx
movslq %ecx,%rax
add    %rax,%rsi
mov    %r8d,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @cpy_elm(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i8*, i8** %6
%12 = load i32, i32* %8
%13 = load i32, i32* %10
%14 = mul nsw i32 %12, %13
%15 = sext i32 %14 to i64
%16 = getelementptr i8, i8* %11, i64 %15
%17 = load i8*, i8** %7
%18 = load i32, i32* %9
%19 = load i32, i32* %10
%20 = mul nsw i32 %18, %19
%21 = sext i32 %20 to i64
%22 = getelementptr i8, i8* %17, i64 %21
%23 = load i32, i32* %10
%24 = call i32 @memcpy(i8* %16, i8* %22, i32 %23)
ret void
}

LLVM IR (-O2):
define void @cpy_elm(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = mul nsw i32 %4, %2
%7 = sext i32 %6 to i64
%8 = getelementptr i8, i8* %0, i64 %7
%9 = mul nsw i32 %4, %3
%10 = sext i32 %9 to i64
%11 = getelementptr i8, i8* %1, i64 %10
%12 = tail call i32 @memcpy(i8* %8, i8* %11, i32 %4)
ret void
}
/* Variables and functions */
void *id0() { return NULL; }


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

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

LLVM IR (-O0):
define i8* @id0() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @id0() {
ret i8* null
}
int test_imm_2Fint64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x2F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_2Fint64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x10,%rdx
and    $0x2f,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_2Fint64_midword_mem>:
testb  $0x2f,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_2Fint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 3080192
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ perror(char const *);
int exit_perror(const char *context) {
  perror(context);
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @exit_perror(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
ret i32 1
}
void tegra_cl_dvfs_resume(struct tegra_cl_dvfs *cld) {}


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

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

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

LLVM IR (-O2):
%struct.tegra_cl_dvfs = type opaque
define void @tegra_cl_dvfs_resume(%struct.tegra_cl_dvfs* nocapture %0) {
ret void
}
/* Type definitions */
struct _mgmt_adduser_rsp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct _mgmt_adduser_rsp *);
void mgmt_adduser_rsp_free(struct _mgmt_adduser_rsp *ptr) { free(ptr); }


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

x86 assembly (clang, -O2):
<mgmt_adduser_rsp_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct._mgmt_adduser_rsp = type { i32 }
define void @mgmt_adduser_rsp_free(%struct._mgmt_adduser_rsp* nocapture %0) {
%2 = tail call i32 @free(%struct._mgmt_adduser_rsp* %0)
ret void
}
/* Variables and functions */
int _find_tag(unsigned short, unsigned char **, unsigned short *,
              unsigned char **, unsigned short *);
int st_asn1_tlv_find_tag(unsigned short tag, unsigned char *data,
                         unsigned short data_length, unsigned char **value,
                         unsigned short *value_length) {
  return _find_tag(tag, &data, &data_length, value, value_length);
}


x86 assembly (clang, -O0):
<st_asn1_tlv_find_tag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dx,%ax
mov    %di,%dx
mov    %dx,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x2(%rbp),%ax
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    -0x10(%rbp),%rsi
lea    -0x12(%rbp),%rdx
movzwl %ax,%edi
call   1030 <_find_tag@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<st_asn1_tlv_find_tag>:
sub    $0x18,%rsp
mov    %rsi,0x10(%rsp)
mov    %dx,0xe(%rsp)
lea    0x10(%rsp),%rsi
lea    0xe(%rsp),%rdx
call   1030 <_find_tag@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @st_asn1_tlv_find_tag(i16 zeroext %0, i8* %1, i16 zeroext %2, i8** %3, i16* %4) {
%6 = alloca i16
%7 = alloca i8*
%8 = alloca i16
%9 = alloca i8**
%10 = alloca i16*
store i16 %0, i16* %6
store i8* %1, i8** %7
store i16 %2, i16* %8
store i8** %3, i8*** %9
store i16* %4, i16** %10
%11 = load i16, i16* %6
%12 = load i8**, i8*** %9
%13 = load i16*, i16** %10
%14 = call i32 @_find_tag(i16 zeroext %11, i8** %7, i16* %8, i8** %12, i16* %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @st_asn1_tlv_find_tag(i16 zeroext %0, i8* %1, i16 zeroext %2, i8** %3, i16* %4) {
%6 = alloca i8*
%7 = alloca i16
store i8* %1, i8** %6
store i16 %2, i16* %7
%8 = call i32 @_find_tag(i16 zeroext %0, i8** %6, i16* %7, i8** %3, i16* %4)
ret i32 %8
}
int sub4(int i) { return i * 6; }


x86 assembly (clang, -O0):
<sub4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0x6,-0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub4>:
add    %edi,%edi
lea    (%rdi,%rdi,2),%eax
ret

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

LLVM IR (-O2):
define i32 @sub4(i32 %0) {
%2 = mul nsw i32 %0, 6
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ cleanup();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void sigint_handler(int sig) {
  (void)sig;
  cleanup();
  exit(0);
}


x86 assembly (clang, -O0):
<sigint_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <cleanup@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<sigint_handler>:
push   %rax
xor    %eax,%eax
call   1030 <cleanup@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @sigint_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (...) @cleanup()
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @sigint_handler(i32 %0) {
%2 = tail call i32 (...) @cleanup()
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int arraySize(const void **array) {
  int count;
  for (count = 0; array[count] != NULL; count++)
    ;
  return count;
}


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

x86 assembly (clang, -O2):
<arraySize>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpq   $0x0,(%rdi)
lea    0x8(%rdi),%rdi
jne    1110 <arraySize+0x10>
ret

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

LLVM IR (-O2):
define i32 @arraySize(i8** nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int whosthere() {
  printf("Quem eh?\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [9 x i8] c"Quem eh?\00"
define i32 @whosthere() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ die(char *, char const *);
int open(char const *, int /*<<< orphan*/);
int sopen(const char *fname) {
  int fd = open(fname, O_RDONLY);
  if (fd == -1)
    die("open failed: %s", fname);
  return fd;
}


x86 assembly (clang, -O0):
<sopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    115b <sopen+0x3b>
mov    -0x8(%rbp),%rsi
lea    0xeaa(%rip),%rdi
call   1040 <die@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sopen>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
jne    114a <sopen+0x2a>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
call   1040 <die@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
@.str = [16 x i8] c"open failed: %s\00"
define i32 @sopen(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_RDONLY
%6 = call i32 @open(i8* %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@.str = [16 x i8] c"open failed: %s\00"
define i32 @sopen(i8* %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %5, %1
ret i32 %3
}
/* Variables and functions */
float log(float);
float rocket_equation(float total_mass, float dry_mass, float sp_impulse) {
  float delta_v;
  float g = 9.81;
  delta_v = sp_impulse * g * log(total_mass / dry_mass);
  return delta_v;
}


x86 assembly (clang, -O0):
<rocket_equation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  0xed1(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rocket_equation>:
push   %rax
mulss  0xee7(%rip),%xmm2
movss  %xmm2,0x4(%rsp)
divss  %xmm1,%xmm0
call   1030 <log@plt>
mulss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @rocket_equation(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
store float 0x40239EB860000000, float* %8
%9 = load float, float* %6
%10 = load float, float* %8
%11 = fmul float %9, %10
%12 = load float, float* %4
%13 = load float, float* %5
%14 = fdiv float %12, %13
%15 = call float @log(float %14)
%16 = fmul float %11, %15
store float %16, float* %7
%17 = load float, float* %7
ret float %17
}

LLVM IR (-O2):
define float @rocket_equation(float %0, float %1, float %2) {
%4 = fmul float %2, 0x40239EB860000000
%5 = fdiv float %0, %1
%6 = tail call float @log(float %5)
%7 = fmul float %4, %6
ret float %7
}
/* Variables and functions */
int b(int);
int user_b(int z) { return b(z); }


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

x86 assembly (clang, -O2):
<user_b>:
jmp    1030 <b@plt>

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

LLVM IR (-O2):
define i32 @user_b(i32 %0) {
%2 = tail call i32 @b(i32 %0)
ret i32 %2
}
/* Variables and functions */
char *value(char *);
char *get_pager(void) {
  char *cp;
  cp = value("PAGER");
  if (cp == NULL || *cp == '\0')
    cp = value("bsdcompat") ? "more" : "less";
  return cp;
}


x86 assembly (clang, -O0):
<get_pager>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <value@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1143 <get_pager+0x33>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    116c <get_pager+0x5c>
lea    0xebc(%rip),%rdi
call   1030 <value@plt>
mov    %rax,%rdx
lea    0xebc(%rip),%rax
lea    0xeb0(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_pager>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <value@plt>
test   %rax,%rax
je     1129 <get_pager+0x19>
cmpb   $0x0,(%rax)
je     1129 <get_pager+0x19>
pop    %rcx
ret
lea    0xed6(%rip),%rdi
call   1030 <value@plt>
test   %rax,%rax
lea    0xed6(%rip),%rcx
lea    0xeca(%rip),%rax
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"PAGER\00"
@.str.1 = [10 x i8] c"bsdcompat\00"
@.str.2 = [5 x i8] c"more\00"
@.str.3 = [5 x i8] c"less\00"
define i8* @get_pager() {
%1 = alloca i8*
%2 = call i8* @value(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %10, label %5
5: ; preds = %0
%6 = load i8*, i8** %1
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %5, %0
%11 = call i8* @value(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp ne i8* %11, null
%13 = zext i1 %12 to i64
%14 = select i1 %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
store i8* %14, i8** %1
br label %15
15: ; preds = %10, %5
%16 = load i8*, i8** %1
ret i8* %16
}

LLVM IR (-O2):
@.str = [6 x i8] c"PAGER\00"
@.str.1 = [10 x i8] c"bsdcompat\00"
@.str.2 = [5 x i8] c"more\00"
@.str.3 = [5 x i8] c"less\00"
define i8* @get_pager() {
%1 = tail call i8* @value(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3, %0
%7 = tail call i8* @value(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i8* %7, null
%9 = select i1 %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
br label %10
10: ; preds = %6, %3
%11 = phi i8* [ %9, %6 ], [ %1, %3 ]
ret i8* %11
}
/* Variables and functions */
scalar_t__ get_collision_button();
int /*<<< orphan*/ lower_probiscus();
int /*<<< orphan*/ raise_probiscus();
int /*<<< orphan*/ ramming_speed();
int /*<<< orphan*/ stop_moving();
int /*<<< orphan*/ wait1Msec(int);
void handle_collision_button1() {
  ramming_speed();
  raise_probiscus();
  while (get_collision_button()) {
    wait1Msec(1000);
  }
  stop_moving();
  lower_probiscus();
}


x86 assembly (clang, -O0):
<handle_collision_button1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <ramming_speed@plt>
mov    $0x0,%al
call   1070 <raise_probiscus@plt>
mov    $0x0,%al
call   1060 <get_collision_button@plt>
cmp    $0x0,%rax
je     1192 <handle_collision_button1+0x32>
mov    $0x3e8,%edi
call   1030 <wait1Msec@plt>
jmp    1172 <handle_collision_button1+0x12>
mov    $0x0,%al
call   1080 <stop_moving@plt>
mov    $0x0,%al
call   1050 <lower_probiscus@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_collision_button1>:
push   %rax
xor    %eax,%eax
call   1040 <ramming_speed@plt>
xor    %eax,%eax
call   1070 <raise_probiscus@plt>
nop
xor    %eax,%eax
call   1060 <get_collision_button@plt>
test   %rax,%rax
je     1188 <handle_collision_button1+0x28>
mov    $0x3e8,%edi
call   1030 <wait1Msec@plt>
jmp    1170 <handle_collision_button1+0x10>
xor    %eax,%eax
call   1080 <stop_moving@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <lower_probiscus@plt>

LLVM IR (-O0):
define void @handle_collision_button1() {
%1 = call i32 (...) @ramming_speed()
%2 = call i32 (...) @raise_probiscus()
br label %3
3: ; preds = %6, %0
%4 = call i64 (...) @get_collision_button()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = call i32 @wait1Msec(i32 1000)
br label %3
8: ; preds = %3
%9 = call i32 (...) @stop_moving()
%10 = call i32 (...) @lower_probiscus()
ret void
}

LLVM IR (-O2):
define void @handle_collision_button1() {
%1 = tail call i32 (...) @ramming_speed()
%2 = tail call i32 (...) @raise_probiscus()
%3 = tail call i64 (...) @get_collision_button()
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %0, %5
%6 = tail call i32 @wait1Msec(i32 1000)
%7 = tail call i64 (...) @get_collision_button()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %5
9: ; preds = %5, %0
%10 = tail call i32 (...) @stop_moving()
%11 = tail call i32 (...) @lower_probiscus()
ret void
}
int test_imm_32int32_mem(int *val) {
  return ((*val) & (0x32 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_32int32_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    $0x32,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_32int32_mem>:
testb  $0x32,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_32int32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 50
%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_32int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 50
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ x_root;
};
typedef TYPE_1__ XButtonReleasedEvent;

/* Variables and functions */
int get_XButtonReleasedEvent_x_root(void *_p) {
  return (int)((XButtonReleasedEvent *)_p)->x_root;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XButtonReleasedEvent_x_root(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XButtonReleasedEvent_x_root(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
void *so_new();
__attribute__((visibility("default"))) void *sp_env(void) { return so_new(); }


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

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

LLVM IR (-O0):
define i8* @sp_env() {
%1 = call i8* (...) @so_new()
ret i8* %1
}

LLVM IR (-O2):
define i8* @sp_env() {
%1 = tail call i8* (...) @so_new()
ret i8* %1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t S0(uint32_t x) {
  return (((x) >> (2)) | ((x) << (32 - (2)))) ^
         (((x) >> (13)) | ((x) << (32 - (13)))) ^
         (((x) >> (22)) | ((x) << (32 - (22))));
}


x86 assembly (clang, -O0):
<S0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1e,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0xd,%ecx
mov    -0x4(%rbp),%edx
shl    $0x13,%edx
or     %edx,%ecx
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x16,%ecx
mov    -0x4(%rbp),%edx
shl    $0xa,%edx
or     %edx,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<S0>:
mov    %edi,%eax
sar    $0x2,%eax
mov    %edi,%ecx
shl    $0x1e,%ecx
or     %eax,%ecx
mov    %edi,%eax
sar    $0xd,%eax
mov    %edi,%edx
shl    $0x13,%edx
or     %eax,%edx
xor    %ecx,%edx
mov    %edi,%eax
sar    $0x16,%eax
shl    $0xa,%edi
or     %edi,%eax
xor    %edx,%eax
ret

LLVM IR (-O0):
define i32 @S0(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 2
%5 = load i32, i32* %2
%6 = shl i32 %5, 30
%7 = or i32 %4, %6
%8 = load i32, i32* %2
%9 = ashr i32 %8, 13
%10 = load i32, i32* %2
%11 = shl i32 %10, 19
%12 = or i32 %9, %11
%13 = xor i32 %7, %12
%14 = load i32, i32* %2
%15 = ashr i32 %14, 22
%16 = load i32, i32* %2
%17 = shl i32 %16, 10
%18 = or i32 %15, %17
%19 = xor i32 %13, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @S0(i32 %0) {
%2 = ashr i32 %0, 2
%3 = shl i32 %0, 30
%4 = or i32 %2, %3
%5 = ashr i32 %0, 13
%6 = shl i32 %0, 19
%7 = or i32 %5, %6
%8 = xor i32 %4, %7
%9 = ashr i32 %0, 22
%10 = shl i32 %0, 10
%11 = or i32 %9, %10
%12 = xor i32 %8, %11
ret i32 %12
}
void do_nothing(void *data __attribute__((unused))) { return; }


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

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

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

LLVM IR (-O2):
define void @do_nothing(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bson_fatal_msg(int, char *);
void *bson_realloc_func(void *, int);
void *bson_realloc(void *ptr, int size) {
  void *p;
  p = bson_realloc_func(ptr, size);
  bson_fatal_msg(!!p, "realloc() failed");
  return p;
}


x86 assembly (clang, -O0):
<bson_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <bson_realloc_func@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xea9(%rip),%rsi
call   1040 <bson_fatal_msg@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bson_realloc>:
push   %rbx
call   1030 <bson_realloc_func@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
lea    0xec7(%rip),%rsi
call   1040 <bson_fatal_msg@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"realloc() failed\00"
define i8* @bson_realloc(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i8* @bson_realloc_func(i8* %6, i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
%11 = xor i1 %10, true
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
%14 = call i32 @bson_fatal_msg(i32 %13, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
@.str = [17 x i8] c"realloc() failed\00"
define i8* @bson_realloc(i8* %0, i32 %1) {
%3 = tail call i8* @bson_realloc_func(i8* %0, i32 %1)
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @bson_fatal_msg(i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i8* %3
}
/* Variables and functions */
int strings_cmp(char *, char *);
int drivers_names_cmp(const void *first, const void *second) {
  return strings_cmp((char *)first, (char *)second);
}


x86 assembly (clang, -O0):
<drivers_names_cmp>:
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 <strings_cmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drivers_names_cmp>:
jmp    1030 <strings_cmp@plt>

LLVM IR (-O0):
define i32 @drivers_names_cmp(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 @strings_cmp(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @drivers_names_cmp(i8* %0, i8* %1) {
%3 = tail call i32 @strings_cmp(i8* %0, i8* %1)
ret i32 %3
}