xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void main(int argc, char **argv) { printf("%s\n", argv[1]); }


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

x86 assembly (clang, -O2):
<main>:
mov    0x8(%rsi),%rsi
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
void foo1c() {}


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

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

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

LLVM IR (-O2):
define void @foo1c() {
ret void
}
int toascii(int c) { return c & ~0x80; }


x86 assembly (clang, -O0):
<toascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffff7f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toascii>:
mov    %edi,%eax
and    $0xffffff7f,%eax
ret

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

LLVM IR (-O2):
define i32 @toascii(i32 %0) {
%2 = and i32 %0, -129
ret i32 %2
}
/* Variables and functions */
int exact_square(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  printf("Enter a number: ");
  scanf("%d", &n);
  printf("%d", exact_square(n));
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 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), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 @exact_square(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 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), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @exact_square(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ GLint;
typedef int /*<<< orphan*/ GLenum;

/* Variables and functions */
int /*<<< orphan*/ __glTexGendv_size(int /*<<< orphan*/);
GLint __glTexGeniv_size(GLenum e) { return __glTexGendv_size(e); }


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

x86 assembly (clang, -O2):
<__glTexGeniv_size>:
jmp    1030 <__glTexGendv_size@plt>

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

LLVM IR (-O2):
define i32 @__glTexGeniv_size(i32 %0) {
%2 = tail call i32 @__glTexGendv_size(i32 %0)
ret i32 %2
}
long GPU_test(void) { return 0; }


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

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

LLVM IR (-O0):
define i64 @GPU_test() {
ret i64 0
}

LLVM IR (-O2):
define i64 @GPU_test() {
ret i64 0
}
void swap(int x, int y) {
  int tmp = x;
  x = y;
  y = tmp;
}


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

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

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

LLVM IR (-O2):
define void @swap(i32 %0, i32 %1) {
ret void
}
void tl880_deinit_wintv_hd(struct tl880_dev *tl880dev) {}


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

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

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

LLVM IR (-O2):
%struct.tl880_dev = type opaque
define void @tl880_deinit_wintv_hd(%struct.tl880_dev* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outb(char, int);
void ADClearRegister(char var) { outb(var, 0x0260 + 0x08); }


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

x86 assembly (clang, -O2):
<ADClearRegister>:
mov    $0x268,%esi
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @ADClearRegister(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @outb(i8 signext %3, i32 616)
ret void
}

LLVM IR (-O2):
define void @ADClearRegister(i8 signext %0) {
%2 = tail call i32 @outb(i8 signext %0, i32 616)
ret void
}
int main(void) {
  int x = 5;
  int a[-x];
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x5,-0x4(%rbp)
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
store i32 5, i32* %1
%4 = load i32, i32* %1
%5 = sub nsw i32 0, %4
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
store i8* %7, i8** %2
%8 = alloca i32, i64 %6
store i64 %6, i64* %3
%9 = load i8*, i8** %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
nr3arp() {
  int psax25(), setpath();
  arp_init(0, 7, 0, 0, (char *)0, psax25, setpath);
}


x86 assembly (clang, -O0):
<nr3arp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %ecx,%ecx
mov    $0x7,%esi
xor    %eax,%eax
mov    %eax,%r8d
mov    0x2ead(%rip),%r9
mov    0x2eb6(%rip),%rax
mov    %ecx,%edi
mov    %ecx,%edx
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <arp_init@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nr3arp>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    %rax,(%rsp)
mov    0x2eb5(%rip),%r9
xor    %edi,%edi
mov    $0x7,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %eax,%eax
call   1030 <arp_init@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @nr3arp() {
%1 = alloca i32
%2 = call i32 (i32, i32, i32, i32, i8*, i32 (...)*, i32 (...)*, ...) bitcast (i32 (...)* @arp_init to i32 (i32, i32, i32, i32, i8*, i32 (...)*, i32 (...)*, ...)*)(i32 0, i32 7, i32 0, i32 0, i8* null, i32 (...)* @psax25, i32 (...)* @setpath)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @nr3arp() {
%1 = tail call i32 (i32, i32, i32, i32, i8*, i32 (...)*, i32 (...)*, ...) bitcast (i32 (...)* @arp_init to i32 (i32, i32, i32, i32, i8*, i32 (...)*, i32 (...)*, ...)*)(i32 0, i32 7, i32 0, i32 0, i8* null, i32 (...)* @psax25, i32 (...)* @setpath)
ret i32 undef
}
int f(int a, int b) {
  if (a == 1)
    a = 0;
  if (b == 0)
    a = 1;
  if (a != 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    111b <f+0x1b>
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    112c <f+0x2c>
movl   $0x1,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1142 <f+0x42>
movl   $0x0,-0x4(%rbp)
jmp    1149 <f+0x49>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
test   %esi,%esi
setne  %al
cmp    $0x2,%edi
setb   %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = icmp ne i32 %1, 0
%4 = icmp ult i32 %0, 2
%5 = and i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void binary_printf(uint64_t n, int bits_num) {
  int i;
  for (i = bits_num - 1; i >= 0; i--) {
    if ((n >> i) & 1) {
      printf("1");
    } else {
      printf("0");
    }
  }
}


x86 assembly (clang, -O0):
<binary_printf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1175 <binary_printf+0x65>
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1156 <binary_printf+0x46>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
jmp    1162 <binary_printf+0x52>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
jmp    1167 <binary_printf+0x57>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <binary_printf+0x17>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binary_printf>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jle    113e <binary_printf+0x2e>
mov    %esi,%ebx
mov    %edi,%ebp
add    $0x1,%ebx
xchg   %ax,%ax
lea    -0x2(%rbx),%eax
movzbl %al,%eax
bt     %eax,%ebp
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1120 <binary_printf+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @binary_printf(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %1, %2 ]
%6 = add nsw i32 %5, -1
%7 = shl nuw i32 1, %6
%8 = and i32 %7, %0
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 48, i32 49
%11 = tail call i32 @putchar(i32 %10)
%12 = icmp ugt i32 %5, 1
br i1 %12, label %4, label %13
13: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_DUPFD;
int fcntl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int _dup(int oldfd) {
  int newfd;
  newfd = fcntl(oldfd, F_DUPFD, 0);
  if (newfd == -1)
    return -1;
  return newfd;
}


x86 assembly (clang, -O0):
<_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1147 <_dup+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    114d <_dup+0x3d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dup>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
jmp    1030 <fcntl@plt>

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

LLVM IR (-O2):
@F_DUPFD = global i32 0
define i32 @_dup(i32 %0) {
%2 = load i32, i32* @F_DUPFD
%3 = tail call i32 @fcntl(i32 %0, i32 %2, i32 0)
ret i32 %3
}
int my_strlen(char *str) {
  int length;
  length = 0;
  while (*(str + length) != 0)
    length++;
  return (length);
}


x86 assembly (clang, -O0):
<my_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <my_strlen+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <my_strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @my_strlen(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 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%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 @my_strlen(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, 0
%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
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void ComparatorIntClear(uint32_t ui32Base, uint32_t ui32Comp) {
  ;
  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000000))) = 1 << ui32Comp;
}


x86 assembly (clang, -O0):
<ComparatorIntClear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComparatorIntClear>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
movslq %edi,%rcx
mov    %eax,(%rcx)
ret

LLVM IR (-O0):
define void @ComparatorIntClear(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 = shl i32 1, %5
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 0
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
store volatile i32 %6, i32* %10
ret void
}

LLVM IR (-O2):
define void @ComparatorIntClear(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = sext i32 %0 to i64
%5 = inttoptr i64 %4 to i32*
store volatile i32 %3, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fun() {
  char s[12];
  printf("Return to fun!\n");
}


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"Return to fun!\0A\00"
define void @fun() {
%1 = alloca [12 x i8]
%2 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [15 x i8] c"Return to fun!\00"
define void @fun() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
void heap(list, length) int list[], length;
{
  register int i;
  for (i = (length - 2) / 2; i >= 0; --i)
    adjust(list, i, length - 1);
}


x86 assembly (clang, -O0):
<heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     115c <heap+0x4c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
mov    $0x0,%al
call   1030 <adjust@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1130 <heap+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heap>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    1143 <heap+0x33>
mov    %esi,%ebx
mov    %rdi,%r14
lea    -0x2(%rbx),%eax
shr    $0x1f,%eax
lea    (%rbx,%rax,1),%ebp
add    $0xfffffffe,%ebp
sar    %ebp
add    $0xffffffff,%ebx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <adjust@plt>
add    $0xffffffff,%ebp
jb     1130 <heap+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @heap(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sub nsw i32 %6, 2
%8 = sdiv i32 %7, 2
store i32 %8, i32* %5
br label %9
9: ; preds = %18, %2
%10 = load i32, i32* %5
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = load i32*, i32** %3
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = sub nsw i32 %15, 1
%17 = call i32 (i32*, i32, i32, ...) bitcast (i32 (...)* @adjust to i32 (i32*, i32, i32, ...)*)(i32* %13, i32 %14, i32 %16)
br label %18
18: ; preds = %12
%19 = load i32, i32* %5
%20 = add nsw i32 %19, -1
store i32 %20, i32* %5
br label %9
21: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @heap(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = add nsw i32 %1, -2
%6 = sdiv i32 %5, 2
%7 = add nsw i32 %1, -1
br label %8
8: ; preds = %4, %8
%9 = phi i32 [ %6, %4 ], [ %11, %8 ]
%10 = tail call i32 (i32*, i32, i32, ...) bitcast (i32 (...)* @adjust to i32 (i32*, i32, i32, ...)*)(i32* %0, i32 %9, i32 %7)
%11 = add nsw i32 %9, -1
%12 = icmp eq i32 %9, 0
br i1 %12, label %13, label %8
13: ; preds = %8, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "usage memcat if=file|of=file size=bytes"
                  " [memskip=bytes]\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [57 x i8] c"usage memcat if=file|of=file size=bytes [memskip=bytes]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [57 x i8] c"usage memcat if=file|of=file size=bytes [memskip=bytes]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct Cyc_PP_Doc {
  int dummy;
};

/* Variables and functions */
struct Cyc_PP_Doc *Cyc_PP_doc_union(struct Cyc_PP_Doc *, struct Cyc_PP_Doc *);
struct Cyc_PP_Doc *Cyc_PP_line_doc();
struct Cyc_PP_Doc *Cyc_PP_nil_doc();
struct Cyc_PP_Doc *Cyc_PP_oline_doc(void) {
  struct Cyc_PP_Doc *_T0;
  struct Cyc_PP_Doc *_T1;
  struct Cyc_PP_Doc *_T2;
  _T0 = Cyc_PP_nil_doc();
  _T1 = Cyc_PP_line_doc();
  _T2 = Cyc_PP_doc_union(_T0, _T1);
  return _T2;
}


x86 assembly (clang, -O0):
<Cyc_PP_oline_doc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <Cyc_PP_nil_doc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <Cyc_PP_line_doc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <Cyc_PP_doc_union@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_PP_oline_doc>:
push   %rbx
xor    %eax,%eax
call   1030 <Cyc_PP_nil_doc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <Cyc_PP_line_doc@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1050 <Cyc_PP_doc_union@plt>

LLVM IR (-O0):
%struct.Cyc_PP_Doc = type { i32 }
define %struct.Cyc_PP_Doc* @Cyc_PP_oline_doc() {
%1 = alloca %struct.Cyc_PP_Doc*
%2 = alloca %struct.Cyc_PP_Doc*
%3 = alloca %struct.Cyc_PP_Doc*
%4 = call %struct.Cyc_PP_Doc* (...) @Cyc_PP_nil_doc()
store %struct.Cyc_PP_Doc* %4, %struct.Cyc_PP_Doc** %1
%5 = call %struct.Cyc_PP_Doc* (...) @Cyc_PP_line_doc()
store %struct.Cyc_PP_Doc* %5, %struct.Cyc_PP_Doc** %2
%6 = load %struct.Cyc_PP_Doc*, %struct.Cyc_PP_Doc** %1
%7 = load %struct.Cyc_PP_Doc*, %struct.Cyc_PP_Doc** %2
%8 = call %struct.Cyc_PP_Doc* @Cyc_PP_doc_union(%struct.Cyc_PP_Doc* %6, %struct.Cyc_PP_Doc* %7)
store %struct.Cyc_PP_Doc* %8, %struct.Cyc_PP_Doc** %3
%9 = load %struct.Cyc_PP_Doc*, %struct.Cyc_PP_Doc** %3
ret %struct.Cyc_PP_Doc* %9
}

LLVM IR (-O2):
%struct.Cyc_PP_Doc = type { i32 }
define %struct.Cyc_PP_Doc* @Cyc_PP_oline_doc() {
%1 = tail call %struct.Cyc_PP_Doc* (...) @Cyc_PP_nil_doc()
%2 = tail call %struct.Cyc_PP_Doc* (...) @Cyc_PP_line_doc()
%3 = tail call %struct.Cyc_PP_Doc* @Cyc_PP_doc_union(%struct.Cyc_PP_Doc* %1, %struct.Cyc_PP_Doc* %2)
ret %struct.Cyc_PP_Doc* %3
}
/* Variables and functions */
float roundf(float);
float nearest_interp(float p1, float p2, float amount) {
  amount = roundf(amount);
  return amount ? p2 : p1;
}


x86 assembly (clang, -O0):
<nearest_interp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <roundf@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1152 <nearest_interp+0x42>
jp     1152 <nearest_interp+0x42>
jmp    1161 <nearest_interp+0x51>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    116b <nearest_interp+0x5b>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nearest_interp>:
sub    $0x28,%rsp
movaps %xmm1,(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm2,%xmm0
call   1030 <roundf@plt>
xorps  %xmm1,%xmm1
cmpneqss %xmm1,%xmm0
movaps (%rsp),%xmm1
andps  %xmm0,%xmm1
andnps 0x10(%rsp),%xmm0
orps   %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @nearest_interp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %6
%8 = call float @llvm.round.f32(float %7)
store float %8, float* %6
%9 = load float, float* %6
%10 = fcmp une float %9, 0.000000e+00
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load float, float* %5
br label %15
13: ; preds = %3
%14 = load float, float* %4
br label %15
15: ; preds = %13, %11
%16 = phi float [ %12, %11 ], [ %14, %13 ]
ret float %16
}

LLVM IR (-O2):
define float @nearest_interp(float %0, float %1, float %2) {
%4 = tail call float @llvm.round.f32(float %2)
%5 = fcmp une float %4, 0.000000e+00
%6 = select i1 %5, float %1, float %0
ret float %6
}
int null_byes_in_word(long word) {
  static long low_magic = 0x0101010101010101L;
  static long high_magic = 0x8080808080808080L;
  return (((word - low_magic) & ~word & high_magic) != 0);
}


x86 assembly (clang, -O0):
<null_byes_in_word>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sub    0x2f0d(%rip),%rax
mov    -0x8(%rbp),%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
and    0x2f03(%rip),%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<null_byes_in_word>:
movabs $0xfefefefefefefeff,%rcx
fe fe fe
add    %rdi,%rcx
not    %rdi
and    %rdi,%rcx
movabs $0x8080808080808080,%rdx
80 80 80
xor    %eax,%eax
test   %rdx,%rcx
setne  %al
ret

LLVM IR (-O0):
@null_byes_in_word.low_magic = internal global i64 72340172838076673
@null_byes_in_word.high_magic = internal global i64 -9187201950435737472
define i32 @null_byes_in_word(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i64, i64* @null_byes_in_word.low_magic
%5 = sub nsw i64 %3, %4
%6 = load i64, i64* %2
%7 = xor i64 %6, -1
%8 = and i64 %5, %7
%9 = load i64, i64* @null_byes_in_word.high_magic
%10 = and i64 %8, %9
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @null_byes_in_word(i64 %0) {
%2 = add nsw i64 %0, -72340172838076673
%3 = and i64 %0, -9187201950435737472
%4 = xor i64 %3, -9187201950435737472
%5 = and i64 %4, %2
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ fun(char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ puts(char *);
int main() {
  char a[] = "This ia a book.";
  fun(a);
  puts(a);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <fun@plt>
lea    -0x20(%rbp),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movaps 0xec4(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <fun@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [16 x i8] c"This ia a book.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
store i32 0, i32* %1
%3 = bitcast [16 x i8]* %2 to i8*
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = call i32 @fun(i8* %4)
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%7 = call i32 @puts(i8* %6)
%8 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [16 x i8] c"This ia a book.\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 @fun(i8* %2)
%4 = call i32 @puts(i8* %2)
%5 = call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ handle_BUS(int /*<<< orphan*/);
int gen_BUS(void) {
  handle_BUS(0);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @gen_BUS() {
%1 = call i32 @handle_BUS(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_BUS() {
%1 = tail call i32 @handle_BUS(i32 0)
ret i32 0
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ test_glist();
int /*<<< orphan*/ test_gmap();
int /*<<< orphan*/ test_gset();
int /*<<< orphan*/ test_intmap();
int /*<<< orphan*/ test_strmap();
int main(void) {
  test_gmap();
  test_intmap();
  test_strmap();
  test_glist();
  test_gset();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <test_gmap@plt>
mov    $0x0,%al
call   1040 <test_intmap@plt>
mov    $0x0,%al
call   1060 <test_strmap@plt>
mov    $0x0,%al
call   1030 <test_glist@plt>
mov    $0x0,%al
call   1050 <test_gset@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <test_gmap@plt>
xor    %eax,%eax
call   1040 <test_intmap@plt>
xor    %eax,%eax
call   1060 <test_strmap@plt>
xor    %eax,%eax
call   1030 <test_glist@plt>
xor    %eax,%eax
call   1050 <test_gset@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_gmap()
%3 = call i32 (...) @test_intmap()
%4 = call i32 (...) @test_strmap()
%5 = call i32 (...) @test_glist()
%6 = call i32 (...) @test_gset()
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @test_gmap()
%2 = tail call i32 (...) @test_intmap()
%3 = tail call i32 (...) @test_strmap()
%4 = tail call i32 (...) @test_glist()
%5 = tail call i32 (...) @test_gset()
%6 = load i32, i32* @EXIT_SUCCESS
ret i32 %6
}
flush_cache() {}


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

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

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

LLVM IR (-O2):
define i32 @flush_cache() {
ret i32 undef
}
void ScaleARGBRowDownEvenBox_C() {}


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

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

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

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

/* Variables and functions */
void wr_scrn_printf(int16_t r, int16_t c, const char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
define void @wr_scrn_printf(i32 %0, i32 %1, i8* nocapture %2, ...) {
ret void
}
/* Variables and functions */
float atof(char *);
float strToFloat(char a[]) { return (atof(a)); }


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

x86 assembly (clang, -O2):
<strToFloat>:
jmp    1030 <atof@plt>

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

LLVM IR (-O2):
define float @strToFloat(i8* nocapture %0) {
%2 = tail call float @atof(i8* %0)
ret float %2
}
int test_imm_0Auint8_reg(unsigned char val) {
  return ((val) & (-0x0A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_0Auint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xfffffff6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_0Auint8_reg>:
test   $0xf6,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_0Auint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, -10
%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_0Auint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -10
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ funcA();
int /*<<< orphan*/ funcB();
int main() {
#pragma omp parallel
  {
#pragma omp sections
    {
#pragma omp section
      (void)funcA();
#pragma omp section
      (void)funcB();
    }
  }
  return (0);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @funcA()
%2 = tail call i32 (...) @funcB()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ X_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int fileExists(char *fileName) { return access(fileName, X_OK) == 0; }


x86 assembly (clang, -O0):
<fileExists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileExists>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@X_OK = global i32 0
define i32 @fileExists(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @X_OK
%5 = call i64 @access(i8* %3, i32 %4)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
@X_OK = global i32 0
define i32 @fileExists(i8* nocapture %0) {
%2 = load i32, i32* @X_OK
%3 = tail call i64 @access(i8* %0, i32 %2)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ HplMcs51GeneralIOC__P20__toggle();
void ReverseGPIOP__0__In__toggle(void) { HplMcs51GeneralIOC__P20__toggle(); }


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

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

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

LLVM IR (-O2):
define void @ReverseGPIOP__0__In__toggle() {
%1 = tail call i32 (...) @HplMcs51GeneralIOC__P20__toggle()
ret void
}
int h(void) {
  int array[10] = {[4] = 10, [5] = 10};
  return array[0];
}


x86 assembly (clang, -O0):
<h>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
movl   $0xa,-0x20(%rbp)
movl   $0xa,-0x1c(%rbp)
mov    -0x30(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @h() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = bitcast i8* %2 to [10 x i32]*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i32 0, i32 4
store i32 10, i32* %4
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i32 0, i32 5
store i32 10, i32* %5
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @h() {
ret i32 0
}
void PEOPS_SPUabout(void) {}


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

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

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

LLVM IR (-O2):
define void @PEOPS_SPUabout() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/, int /*<<< orphan*/,
                       unsigned long long, unsigned long long);
void bar(unsigned long long x, unsigned long long y) {
  foo(0, 0, 0, 0, x / y, x % y);
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rax,%r8
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rdx,%r9
xor    %ecx,%ecx
mov    %ecx,%edi
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
mov    %rdi,%rax
mov    %rdi,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1129 <bar+0x19>
xor    %edx,%edx
div    %rsi
mov    %rdx,%r9
jmp    1130 <bar+0x20>
xor    %edx,%edx
div    %esi
mov    %edx,%r9d
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rax,%r8
jmp    1030 <foo@plt>

LLVM IR (-O0):
define void @bar(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = udiv i64 %5, %6
%8 = load i64, i64* %3
%9 = load i64, i64* %4
%10 = urem i64 %8, %9
%11 = call i32 @foo(i32 0, i32 0, i32 0, i32 0, i64 %7, i64 %10)
ret void
}

LLVM IR (-O2):
define void @bar(i64 %0, i64 %1) {
%3 = udiv i64 %0, %1
%4 = urem i64 %0, %1
%5 = tail call i32 @foo(i32 0, i32 0, i32 0, i32 0, i64 %3, i64 %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int _cp_error(char const *, int);
scalar_t__ mkfifo(char const *, int /*<<< orphan*/);
int _cp_single_fifo(char const *dst, mode_t mode) {
  if (mkfifo(dst, mode) != 0)
    return _cp_error(dst, 1);
  return 0;
}


x86 assembly (clang, -O0):
<_cp_single_fifo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <mkfifo@plt>
cmp    $0x0,%rax
je     115b <_cp_single_fifo+0x3b>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1040 <_cp_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1162 <_cp_single_fifo+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cp_single_fifo>:
push   %rbx
mov    %rdi,%rbx
call   1030 <mkfifo@plt>
test   %rax,%rax
je     113c <_cp_single_fifo+0x1c>
mov    %rbx,%rdi
mov    $0x1,%esi
pop    %rbx
jmp    1040 <_cp_error@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @_cp_single_fifo(i8* %0, i32 %1) {
%3 = tail call i64 @mkfifo(i8* %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @_cp_error(i8* %0, i32 1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ 0, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ sigrelse(int /*<<< orphan*/);
main() { sigrelse(SIGINT); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <sigrelse@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@SIGINT = global i32 0
define i32 @main() {
%1 = load i32, i32* @SIGINT
%2 = call i32 @sigrelse(i32 %1)
ret i32 0
}

LLVM IR (-O2):
@SIGINT = global i32 0
define i32 @main() {
%1 = load i32, i32* @SIGINT
%2 = tail call i32 @sigrelse(i32 %1)
ret i32 0
}
void __s2e_touch_string(volatile const char *string) {
  while (*string) {
    ++string;
  }
}


x86 assembly (clang, -O0):
<__s2e_touch_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
cmp    $0x0,%al
je     1127 <__s2e_touch_string+0x27>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <__s2e_touch_string+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__s2e_touch_string>:
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1100 <__s2e_touch_string>
ret

LLVM IR (-O0):
define void @__s2e_touch_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load volatile i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
br label %3
10: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @__s2e_touch_string(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load volatile i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
ret void
}
void loadFloatRegs(void) { return; }


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

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

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

LLVM IR (-O2):
define void @loadFloatRegs() {
ret void
}
/* Variables and functions */
char *strdup(char const *);
char *strdup_safe(const char *s) { return s ? strdup(s) : NULL; }


x86 assembly (clang, -O0):
<strdup_safe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1139 <strdup_safe+0x29>
mov    -0x8(%rbp),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x10(%rbp)
jmp    1144 <strdup_safe+0x34>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    1144 <strdup_safe+0x34>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup_safe>:
test   %rdi,%rdi
je     111a <strdup_safe+0xa>
jmp    1030 <strdup@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define noalias i8* @strdup_safe(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i8* @strdup(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ %4, %3 ], [ null, %1 ]
ret i8* %6
}
/* Variables and functions */
int M_PI;
int get_alpha(char);
float powf(int, double);
float overlap_elem(char i, char j) {
  return powf(M_PI / (get_alpha(i) + get_alpha(j)), 1.5);
}


x86 assembly (clang, -O0):
<overlap_elem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <get_alpha@plt>
mov    %eax,-0xc(%rbp)
movsbl -0x2(%rbp),%edi
call   1040 <get_alpha@plt>
mov    -0xc(%rbp),%ecx
mov    %eax,%edx
mov    -0x8(%rbp),%eax
add    %edx,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
movsd  0xe94(%rip),%xmm0
call   1030 <powf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<overlap_elem>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    0x2ebb(%rip),%rax
mov    (%rax),%r14d
call   1040 <get_alpha@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <get_alpha@plt>
mov    %eax,%ecx
add    %ebp,%ecx
mov    %r14d,%eax
cltd
idiv   %ecx
movsd  0xeb0(%rip),%xmm0
mov    %eax,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <powf@plt>

LLVM IR (-O0):
@M_PI = global i32 0
define float @overlap_elem(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i32, i32* @M_PI
%6 = load i8, i8* %3
%7 = call i32 @get_alpha(i8 signext %6)
%8 = load i8, i8* %4
%9 = call i32 @get_alpha(i8 signext %8)
%10 = add nsw i32 %7, %9
%11 = sdiv i32 %5, %10
%12 = call float @powf(i32 %11, double 1.500000e+00)
ret float %12
}

LLVM IR (-O2):
@M_PI = global i32 0
define float @overlap_elem(i8 signext %0, i8 signext %1) {
%3 = load i32, i32* @M_PI
%4 = tail call i32 @get_alpha(i8 signext %0)
%5 = tail call i32 @get_alpha(i8 signext %1)
%6 = add nsw i32 %5, %4
%7 = sdiv i32 %3, %6
%8 = tail call float @powf(i32 %7, double 1.500000e+00)
ret float %8
}
int cairo_code_draw_lushGraphPoint_get_width() { return 21; }


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

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

LLVM IR (-O0):
define i32 @cairo_code_draw_lushGraphPoint_get_width() {
ret i32 21
}

LLVM IR (-O2):
define i32 @cairo_code_draw_lushGraphPoint_get_width() {
ret i32 21
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void die(const char *msg) {
  fputs(msg, stderr);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stderr
%5 = call i32 @fputs(i8* %3, i32 %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @die(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fputs(i8* %0, i32 %2)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}