xunge/DecIR huggingface dataset:
int test_imm_7Duint16_mem(unsigned short *val) {
  return ((*val) & (0x7D << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_7Duint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, 125
%7 = icmp ne i32 %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_7Duint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 125
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct mat4 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mat4_rotation_y(float *, float);
__attribute__((always_)) struct mat4 *psmat4_rotation_y(struct mat4 *result,
                                                        float angle) {
  mat4_rotation_y((float *)result, angle);
  return result;
}


x86 assembly (clang, -O0):
<psmat4_rotation_y>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
call   1030 <mat4_rotation_y@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psmat4_rotation_y>:
push   %rbx
mov    %rdi,%rbx
call   1030 <mat4_rotation_y@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.mat4 = type { i32 }
define %struct.mat4* @psmat4_rotation_y(%struct.mat4* %0, float %1) {
%3 = alloca %struct.mat4*
%4 = alloca float
store %struct.mat4* %0, %struct.mat4** %3
store float %1, float* %4
%5 = load %struct.mat4*, %struct.mat4** %3
%6 = bitcast %struct.mat4* %5 to float*
%7 = load float, float* %4
%8 = call i32 @mat4_rotation_y(float* %6, float %7)
%9 = load %struct.mat4*, %struct.mat4** %3
ret %struct.mat4* %9
}

LLVM IR (-O2):
%struct.mat4 = type { i32 }
define %struct.mat4* @psmat4_rotation_y(%struct.mat4* returned %0, float %1) {
%3 = bitcast %struct.mat4* %0 to float*
%4 = tail call i32 @mat4_rotation_y(float* %3, float %1)
ret %struct.mat4* %0
}
void get_time(struct timeval *t) {}


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

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

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

LLVM IR (-O2):
%struct.timeval = type opaque
define void @get_time(%struct.timeval* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_deep_copy();
int main() {
  test_deep_copy();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_deep_copy()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
void putString(char *s) {
  while (*s != '\0') {
    putchar(*s++);
  }
}


x86 assembly (clang, -O0):
<putString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1148 <putString+0x38>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    111c <putString+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putString>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <putString+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <putString+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @putString(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = sext i8 %5 to i32
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = tail call i32 @putchar(i32 %7)
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int add(int, int);
int /*<<< orphan*/ my_puts(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int main() {
  char my_string[20];
  sprintf(my_string, "add(40,2) = %u\n", add(40, 2));
  my_puts(my_string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x28,%edi
mov    $0x2,%esi
call   1030 <add@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
lea    0xe9d(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <my_puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    $0x28,%edi
mov    $0x2,%esi
call   1030 <add@plt>
lea    0xeb5(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %eax,%edx
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <my_puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"add(40,2) = %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%4 = call i32 @add(i32 40, i32 2)
%5 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = call i32 @my_puts(i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"add(40,2) = %u\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @add(i32 40, i32 2)
%4 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @my_puts(i8* %2)
ret i32 0
}
/* Variables and functions */
int doerror(char *, int);
int ErrorIncompatible(char *fnName) { return doerror(fnName, -18); }


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

x86 assembly (clang, -O2):
<ErrorIncompatible>:
mov    $0xffffffee,%esi
jmp    1030 <doerror@plt>

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

LLVM IR (-O2):
define i32 @ErrorIncompatible(i8* %0) {
%2 = tail call i32 @doerror(i8* %0, i32 -18)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("--- BiTree demo ---\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%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
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [20 x i8] c"--- BiTree demo ---\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void rt_waitscanlines(void *voidhandle) { ; }


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

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

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

LLVM IR (-O2):
define void @rt_waitscanlines(i8* nocapture %0) {
ret void
}
int fun1100() { return 1100; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    $0x44c,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    $0x44c,%eax
ret

LLVM IR (-O0):
define i32 @fun1100() {
ret i32 1100
}

LLVM IR (-O2):
define i32 @fun1100() {
ret i32 1100
}
int test_compiler(int *x, int *y) {
  *x = 0;
  *y = 1;
  return *x;
}


x86 assembly (clang, -O0):
<test_compiler>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_compiler>:
movl   $0x0,(%rdi)
movl   $0x1,(%rsi)
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @test_compiler(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
store i32 0, i32* %5
%6 = load i32*, i32** %4
store i32 1, i32* %6
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_compiler(i32* nocapture %0, i32* nocapture writeonly %1) {
store i32 0, i32* %0
store i32 1, i32* %1
%3 = load i32, i32* %0
ret i32 %3
}
/* Variables and functions */
int ejtag_switch(int, int /*<<< orphan*/);
int mips_ejtag_implementation() { return ejtag_switch(0x1002, 0); }


x86 assembly (clang, -O0):
<mips_ejtag_implementation>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1002,%edi
xor    %esi,%esi
call   1030 <ejtag_switch@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mips_ejtag_implementation>:
mov    $0x1002,%edi
xor    %esi,%esi
jmp    1030 <ejtag_switch@plt>

LLVM IR (-O0):
define i32 @mips_ejtag_implementation() {
%1 = call i32 @ejtag_switch(i32 4098, i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @mips_ejtag_implementation() {
%1 = tail call i32 @ejtag_switch(i32 4098, i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ be32enc(unsigned char *, unsigned long);
extern void be64enc(void *buf, unsigned long long u) {
  unsigned char *p = (unsigned char *)buf;
  be32enc(p, (unsigned long)(u >> 32));
  be32enc(p + 4, (unsigned long)(u & 0xffffffffULL));
}


x86 assembly (clang, -O0):
<be64enc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
shr    $0x20,%rsi
call   1030 <be32enc@plt>
mov    -0x18(%rbp),%rdi
add    $0x4,%rdi
movabs $0xffffffff,%rsi
and    -0x10(%rbp),%rsi
call   1030 <be32enc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<be64enc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
shr    $0x20,%rsi
call   1030 <be32enc@plt>
add    $0x4,%rbx
mov    %r14d,%esi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <be32enc@plt>

LLVM IR (-O0):
define void @be64enc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = load i64, i64* %4
%9 = lshr i64 %8, 32
%10 = call i32 @be32enc(i8* %7, i64 %9)
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 4
%13 = load i64, i64* %4
%14 = and i64 %13, 4294967295
%15 = call i32 @be32enc(i8* %12, i64 %14)
ret void
}

LLVM IR (-O2):
define void @be64enc(i8* %0, i64 %1) {
%3 = lshr i64 %1, 32
%4 = tail call i32 @be32enc(i8* %0, i64 %3)
%5 = getelementptr inbounds i8, i8* %0, i64 4
%6 = and i64 %1, 4294967295
%7 = tail call i32 @be32enc(i8* %5, i64 %6)
ret void
}
/* Variables and functions */
char *str_pfind(char const *, char const *);
unsigned str_occurs(const char *in, const char *what) {
  unsigned i = 0;
  in--;
  while ((in = str_pfind(in + 1, what)))
    i++;
  return i;
}


x86 assembly (clang, -O0):
<str_occurs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <str_pfind@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     1160 <str_occurs+0x50>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <str_occurs+0x23>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_occurs>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
mov    $0xffffffff,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rax
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <str_pfind@plt>
add    $0x1,%ebp
test   %rax,%rax
jne    1130 <str_occurs+0x20>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @str_occurs(i8* %0, i8* %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 -1
br label %4
4: ; preds = %4, %2
%5 = phi i8* [ %3, %2 ], [ %8, %4 ]
%6 = phi i32 [ 0, %2 ], [ %10, %4 ]
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = tail call i8* @str_pfind(i8* %7, i8* %1)
%9 = icmp eq i8* %8, null
%10 = add i32 %6, 1
br i1 %9, label %11, label %4
11: ; preds = %4
ret i32 %6
}
void sock_release(struct socket *sock) {}


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

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

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

LLVM IR (-O2):
%struct.socket = type opaque
define void @sock_release(%struct.socket* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put8(int);
void idiv_reg32(unsigned int reg32) {
  put8(0xF7);
  put8(0xF8 + reg32);
}


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

x86 assembly (clang, -O2):
<idiv_reg32>:
push   %rbx
mov    %edi,%ebx
mov    $0xf7,%edi
call   1030 <put8@plt>
add    $0xf8,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @idiv_reg32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @put8(i32 247)
%4 = load i32, i32* %2
%5 = add i32 248, %4
%6 = call i32 @put8(i32 %5)
ret void
}

LLVM IR (-O2):
define void @idiv_reg32(i32 %0) {
%2 = tail call i32 @put8(i32 247)
%3 = add i32 %0, 248
%4 = tail call i32 @put8(i32 %3)
ret void
}
void process() {}


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

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

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

LLVM IR (-O2):
define void @process() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_assert(int);
int main() {
  for (int i = 0; i < 100; i++) {
    __VERIFIER_assert(i >= 0);
    __VERIFIER_assert(i >= 0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1160 <main+0x50>
cmpl   $0x0,-0x8(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <__VERIFIER_assert@plt>
cmpl   $0x0,-0x8(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <__VERIFIER_assert@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x64,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <__VERIFIER_assert@plt>
mov    $0x1,%edi
call   1030 <__VERIFIER_assert@plt>
add    $0xffffffff,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %15, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 100
br i1 %5, label %6, label %18
6: ; preds = %3
%7 = load i32, i32* %2
%8 = icmp sge i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @__VERIFIER_assert(i32 %9)
%11 = load i32, i32* %2
%12 = icmp sge i32 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @__VERIFIER_assert(i32 %13)
br label %15
15: ; preds = %6
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %3
18: ; preds = %3
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
define i32 @main() {
br label %2
1: ; preds = %2
ret i32 0
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %6, %2 ]
%4 = tail call i32 @__VERIFIER_assert(i32 1)
%5 = tail call i32 @__VERIFIER_assert(i32 1)
%6 = add nuw nsw i32 %3, 1
%7 = icmp eq i32 %6, 100
br i1 %7, label %1, label %2
}
void test___atomic_fetch_add_2(int *mem) { __atomic_fetch_add(mem, 1, 4); }


x86 assembly (clang, -O0):
<test___atomic_fetch_add_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
lock xadd %eax,(%rcx)
mov    %eax,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test___atomic_fetch_add_2>:
lock addl $0x1,(%rdi)
ret

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

LLVM IR (-O2):
define void @test___atomic_fetch_add_2(i32* nocapture %0) {
%2 = atomicrmw add i32* %0, i32 1 acq_rel
ret void
}
void *thread1(void *vargp) { return (void *)42; }


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

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

LLVM IR (-O0):
define i8* @thread1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* inttoptr (i64 42 to i8*)
}

LLVM IR (-O2):
define i8* @thread1(i8* nocapture readnone %0) {
ret i8* inttoptr (i64 42 to i8*)
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
scalar_t__ printf(char *, int /*<<< orphan*/);
void write_int(int64_t n) {
  if (printf("%ld\n", n) < 0) {
    perror("write_int failed");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<write_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x0,%rax
jge    116e <write_int+0x3e>
lea    0xeaa(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_int>:
push   %rax
mov    %edi,%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
test   %rax,%rax
js     1146 <write_int+0x16>
pop    %rax
ret
lea    0xeb8(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%ld\0A\00"
@.str.1 = [17 x i8] c"write_int failed\00"
@EXIT_FAILURE = global i32 0
define void @write_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
@.str.1 = [17 x i8] c"write_int failed\00"
@EXIT_FAILURE = global i32 0
define void @write_int(i32 %0) {
%2 = tail call i64 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret void
}
__float128 add(__float128 a, long double b) { return a + b; }


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
fldt   0x10(%rbp)
movaps %xmm0,-0x10(%rbp)
fstpt  -0x20(%rbp)
movaps -0x10(%rbp),%xmm0
movaps %xmm0,-0x30(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   2520 <__extendxftf2>
movaps %xmm0,%xmm1
movaps -0x30(%rbp),%xmm0
call   1140 <__addtf3>
add    $0x40,%rsp
pop    %rbp
ret
nopl   0x0(%rax)

x86 assembly (clang, -O2):
<add>:
sub    $0x28,%rsp
movaps %xmm0,0x10(%rsp)
fldt   0x30(%rsp)
fstpt  (%rsp)
call   2510 <__extendxftf2>
movaps 0x10(%rsp),%xmm1
add    $0x28,%rsp
jmp    1130 <__addtf3>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)

LLVM IR (-O0):
define fp128 @add(fp128 %0, x86_fp80 %1) {
%3 = alloca fp128
%4 = alloca x86_fp80
store fp128 %0, fp128* %3
store x86_fp80 %1, x86_fp80* %4
%5 = load fp128, fp128* %3
%6 = load x86_fp80, x86_fp80* %4
%7 = fpext x86_fp80 %6 to fp128
%8 = fadd fp128 %5, %7
ret fp128 %8
}

LLVM IR (-O2):
define fp128 @add(fp128 %0, x86_fp80 %1) {
%3 = fpext x86_fp80 %1 to fp128
%4 = fadd fp128 %3, %0
ret fp128 %4
}
int test_imm_61uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x61 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_61uint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 97
%6 = icmp ne i64 %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_61uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 97
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_imm_11int8_mem(signed char *val) {
  return ((*val) & (0x11 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_11int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 17
%7 = icmp ne i32 %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_11int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 17
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int usb_amd_find_chipset_info(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @usb_amd_find_chipset_info() {
ret i32 0
}

LLVM IR (-O2):
define i32 @usb_amd_find_chipset_info() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
int main() {
  system("clear");
  int x = 0;
  if (!x == 1)
    printf("ok\n");
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <system@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x1,%eax
jne    1175 <main+0x45>
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <system@plt>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [4 x i8] c"ok\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %0
%12 = call i32 (...) @getchar()
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@str = [3 x i8] c"ok\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void g(char *y) {
  if (*y != 42)
    abort();
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
je     1133 <g+0x23>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
push   %rax
cmpb   $0x2a,(%rdi)
jne    1118 <g+0x8>
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @g(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp ne i32 %5, 42
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @g(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 42
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int write_bytes_to_file(char const *, char const *, int /*<<< orphan*/, int);
int write_str_to_file(const char *fname, const char *str, int bin) {
  return write_bytes_to_file(fname, str, strlen(str), bin);
}


x86 assembly (clang, -O0):
<write_str_to_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
mov    -0x14(%rbp),%ecx
call   1040 <write_bytes_to_file@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_str_to_file>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
mov    %r14d,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <write_bytes_to_file@plt>

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

LLVM IR (-O2):
define i32 @write_str_to_file(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %1)
%5 = tail call i32 @write_bytes_to_file(i8* %0, i8* %1, i32 %4, i32 %2)
ret i32 %5
}
void U_EMRBEGINPATH_print(const char *contents) { (void)contents; }


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

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

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

LLVM IR (-O2):
define void @U_EMRBEGINPATH_print(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int db_warehouse_init();
int sequential_init() {
  int ret;
  ret = db_warehouse_init();
  return ret;
}


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

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

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

LLVM IR (-O2):
define i32 @sequential_init() {
%1 = tail call i32 (...) @db_warehouse_init()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ log10(double);
double luaL_check_number(int);
int /*<<< orphan*/ lua_pushnumber(int /*<<< orphan*/);
void math_log10(void) {
  double d = luaL_check_number(1);
  lua_pushnumber(log10(d));
}


x86 assembly (clang, -O0):
<math_log10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1030 <luaL_check_number@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <log10@plt>
mov    %eax,%edi
call   1040 <lua_pushnumber@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_log10>:
push   %rax
mov    $0x1,%edi
call   1030 <luaL_check_number@plt>
call   1050 <log10@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <lua_pushnumber@plt>

LLVM IR (-O0):
define void @math_log10() {
%1 = alloca double
%2 = call double @luaL_check_number(i32 1)
store double %2, double* %1
%3 = load double, double* %1
%4 = call i32 @log10(double %3)
%5 = call i32 @lua_pushnumber(i32 %4)
ret void
}

LLVM IR (-O2):
define void @math_log10() {
%1 = tail call double @luaL_check_number(i32 1)
%2 = tail call i32 @log10(double %1)
%3 = tail call i32 @lua_pushnumber(i32 %2)
ret void
}
double puissance(double a, int n) {
  double resultat = 1;
  for (int i = 0; i < n; i++)
    resultat = resultat * a;
  return resultat;
}


x86 assembly (clang, -O0):
<puissance>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  0xeec(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1149 <puissance+0x49>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1120 <puissance+0x20>
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<puissance>:
test   %edi,%edi
jle    111b <puissance+0x1b>
lea    -0x1(%rdi),%ecx
mov    %edi,%eax
and    $0x7,%eax
cmp    $0x7,%ecx
jae    1124 <puissance+0x24>
movsd  0xee7(%rip),%xmm1
jmp    1155 <puissance+0x55>
movsd  0xedd(%rip),%xmm0
ret
and    $0xfffffff8,%edi
movsd  0xed1(%rip),%xmm1
nop
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
add    $0xfffffff8,%edi
jne    1130 <puissance+0x30>
test   %eax,%eax
je     1169 <puissance+0x69>
nopl   0x0(%rax)
mulsd  %xmm0,%xmm1
add    $0xffffffff,%eax
jne    1160 <puissance+0x60>
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @puissance(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
store double 1.000000e+00, double* %5
store i32 0, i32* %6
br label %7
7: ; preds = %15, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %18
11: ; preds = %7
%12 = load double, double* %5
%13 = load double, double* %3
%14 = fmul double %12, %13
store double %14, double* %5
br label %15
15: ; preds = %11
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
store i32 %17, i32* %6
br label %7
18: ; preds = %7
%19 = load double, double* %5
ret double %19
}

LLVM IR (-O2):
define double @puissance(double %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %20
4: ; preds = %2
%5 = add i32 %1, -1
%6 = and i32 %1, 7
%7 = icmp ult i32 %5, 7
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = and i32 %1, -8
br label %22
10: ; preds = %22, %4
%11 = phi double [ undef, %4 ], [ %32, %22 ]
%12 = phi double [ 1.000000e+00, %4 ], [ %32, %22 ]
%13 = icmp eq i32 %6, 0
br i1 %13, label %20, label %14
14: ; preds = %10, %14
%15 = phi double [ %17, %14 ], [ %12, %10 ]
%16 = phi i32 [ %18, %14 ], [ 0, %10 ]
%17 = fmul double %15, %0
%18 = add i32 %16, 1
%19 = icmp eq i32 %18, %6
br i1 %19, label %20, label %14
20: ; preds = %10, %14, %2
%21 = phi double [ 1.000000e+00, %2 ], [ %11, %10 ], [ %17, %14 ]
ret double %21
22: ; preds = %22, %8
%23 = phi double [ 1.000000e+00, %8 ], [ %32, %22 ]
%24 = phi i32 [ 0, %8 ], [ %33, %22 ]
%25 = fmul double %23, %0
%26 = fmul double %25, %0
%27 = fmul double %26, %0
%28 = fmul double %27, %0
%29 = fmul double %28, %0
%30 = fmul double %29, %0
%31 = fmul double %30, %0
%32 = fmul double %31, %0
%33 = add i32 %24, 8
%34 = icmp eq i32 %33, %9
br i1 %34, label %10, label %22
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char ch;
  printf("please enter a character. \n");
  scanf("%c", &ch);
  printf("the code for %c is %d. \n", ch, ch);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%esi
movsbl -0x5(%rbp),%edx
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%edx
lea    0xea9(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"please enter a character. \0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [25 x i8] c"the code for %c is %d. \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [25 x i8] c"the code for %c is %d. \0A\00"
@str = [27 x i8] c"please enter a character. \00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %5)
ret i32 0
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn9() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn9");
  return result;
}


x86 assembly (clang, -O0):
<fn9>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn9>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"fn9\00"
define i8* @fn9() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [4 x i8] c"fn9\00"
define i8* @fn9() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
void *xrealloc(ptr, size) void *ptr;
int size;
{
  void *result = realloc(ptr, size);
  if (!result)
    fatal("virtual memory exhausted");
  return result;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1159 <xrealloc+0x39>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <fatal@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rbx
movslq %esi,%rsi
call   1030 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113f <xrealloc+0x1f>
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"virtual memory exhausted\00"
define i8* @xrealloc(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 = sext i32 %7 to i64
%9 = call i8* @realloc(i8* %6, i64 %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = icmp ne i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %2
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
@.str = [25 x i8] c"virtual memory exhausted\00"
define i8* @xrealloc(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = tail call i8* @realloc(i8* %0, i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ finalize();
int /*<<< orphan*/ initialize();
int /*<<< orphan*/ run(int);
int main(void) {
  initialize();
  run(-1);
  finalize();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <initialize@plt>
mov    $0xffffffff,%edi
call   1030 <run@plt>
xor    %eax,%eax
call   1040 <finalize@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @initialize()
%2 = tail call i32 @run(i32 -1)
%3 = tail call i32 (...) @finalize()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ TaskletC__Tasklet__suspend();
void MessageBufferLayerP__0__Tasklet__suspend(void) {
  TaskletC__Tasklet__suspend();
}


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

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

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

LLVM IR (-O2):
define void @MessageBufferLayerP__0__Tasklet__suspend() {
%1 = tail call i32 (...) @TaskletC__Tasklet__suspend()
ret void
}
unsigned int getbits(unsigned int x, int p, int n) {
  unsigned int a, b, c;
  a = x >> (p + 1 - n);
  b = ~(~0 << n);
  c = a & b;
  return c;
}


x86 assembly (clang, -O0):
<getbits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0xc(%rbp),%ecx
shr    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
and    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getbits>:
sub    %edx,%esi
lea    0x1(%rsi),%ecx
shr    %cl,%edi
mov    $0xffffffff,%eax
mov    %edx,%ecx
shl    %cl,%eax
not    %eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @getbits(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = add nsw i32 %11, 1
%13 = load i32, i32* %6
%14 = sub nsw i32 %12, %13
%15 = lshr i32 %10, %14
store i32 %15, i32* %7
%16 = load i32, i32* %6
%17 = shl i32 -1, %16
%18 = xor i32 %17, -1
store i32 %18, i32* %8
%19 = load i32, i32* %7
%20 = load i32, i32* %8
%21 = and i32 %19, %20
store i32 %21, i32* %9
%22 = load i32, i32* %9
ret i32 %22
}

LLVM IR (-O2):
define i32 @getbits(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, 1
%5 = sub i32 %4, %2
%6 = lshr i32 %0, %5
%7 = shl nsw i32 -1, %2
%8 = xor i32 %7, -1
%9 = and i32 %6, %8
ret i32 %9
}
/* Variables and functions */
int test();
void main() {
  int a[10];
  int b;
  b = a[1] + test();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    -0x2c(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    $0x0,%al
call   1030 <test@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
add    $0x40,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%4 = load i32, i32* %3
%5 = call i32 (...) @test()
%6 = add nsw i32 %4, %5
store i32 %6, i32* %2
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @test()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ serial_out(unsigned int);
void out4(unsigned ch4) {
  if (ch4 >> 8)
    out4(ch4 >> 8);
  serial_out(ch4 & 0xFF);
}


x86 assembly (clang, -O0):
<out4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
cmp    $0x0,%eax
je     1145 <out4+0x25>
mov    -0x4(%rbp),%edi
shr    $0x8,%edi
call   1030 <out4@plt>
mov    -0x4(%rbp),%edi
and    $0xff,%edi
call   1040 <serial_out@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<out4>:
push   %rbx
mov    %edi,%ebx
cmp    $0x100,%edi
jb     1135 <out4+0x15>
mov    %ebx,%edi
shr    $0x8,%edi
call   1030 <out4@plt>
movzbl %bl,%edi
pop    %rbx
jmp    1040 <serial_out@plt>

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

LLVM IR (-O2):
define void @out4(i32 %0) {
%2 = icmp ult i32 %0, 256
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = lshr i32 %0, 8
tail call void @out4(i32 %4)
br label %5
5: ; preds = %3, %1
%6 = and i32 %0, 255
%7 = tail call i32 @serial_out(i32 %6)
ret void
}