xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ print(int *, int);
int /*<<< orphan*/ qsort(int *, int /*<<< orphan*/, int);
int main(void) {
  int x[10];
  int i;
  for (i = 0; i < 10; i++)
    x[i] = 9 - i;
  qsort(x, 0, 9);
  print(x, 10);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    115e <main+0x3e>
mov    $0x9,%ecx
sub    -0x34(%rbp),%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1136 <main+0x16>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1030 <qsort@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movq   $0x1,0x20(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1030 <qsort@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = bitcast [10 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 9, i32 8, i32 7, i32 6>, <4 x i32>* %4
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 5, i32 4, i32 3, i32 2>, <4 x i32>* %6
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
store i32 1, i32* %7
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
store i32 0, i32* %8
%9 = call i32 @qsort(i32* %3, i32 0, i32 9)
%10 = call i32 @print(i32* %3, i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ test(int);
int main(void) {
  test(-1);
  test(0);
  test(1);
  test(2);
  test(3);
  test(4);
  test(5);
  test(6);
  test(7);
  test(8);
  test(9);
  test(10);
  test(11);
  test(15);
  test(11434);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%edi
call   1030 <test@plt>
xor    %edi,%edi
call   1030 <test@plt>
mov    $0x1,%edi
call   1030 <test@plt>
mov    $0x2,%edi
call   1030 <test@plt>
mov    $0x3,%edi
call   1030 <test@plt>
mov    $0x4,%edi
call   1030 <test@plt>
mov    $0x5,%edi
call   1030 <test@plt>
mov    $0x6,%edi
call   1030 <test@plt>
mov    $0x7,%edi
call   1030 <test@plt>
mov    $0x8,%edi
call   1030 <test@plt>
mov    $0x9,%edi
call   1030 <test@plt>
mov    $0xa,%edi
call   1030 <test@plt>
mov    $0xb,%edi
call   1030 <test@plt>
mov    $0xf,%edi
call   1030 <test@plt>
mov    $0x2caa,%edi
call   1030 <test@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffff,%edi
call   1030 <test@plt>
xor    %edi,%edi
call   1030 <test@plt>
mov    $0x1,%edi
call   1030 <test@plt>
mov    $0x2,%edi
call   1030 <test@plt>
mov    $0x3,%edi
call   1030 <test@plt>
mov    $0x4,%edi
call   1030 <test@plt>
mov    $0x5,%edi
call   1030 <test@plt>
mov    $0x6,%edi
call   1030 <test@plt>
mov    $0x7,%edi
call   1030 <test@plt>
mov    $0x8,%edi
call   1030 <test@plt>
mov    $0x9,%edi
call   1030 <test@plt>
mov    $0xa,%edi
call   1030 <test@plt>
mov    $0xb,%edi
call   1030 <test@plt>
mov    $0xf,%edi
call   1030 <test@plt>
mov    $0x2caa,%edi
call   1030 <test@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @test(i32 -1)
%2 = call i32 @test(i32 0)
%3 = call i32 @test(i32 1)
%4 = call i32 @test(i32 2)
%5 = call i32 @test(i32 3)
%6 = call i32 @test(i32 4)
%7 = call i32 @test(i32 5)
%8 = call i32 @test(i32 6)
%9 = call i32 @test(i32 7)
%10 = call i32 @test(i32 8)
%11 = call i32 @test(i32 9)
%12 = call i32 @test(i32 10)
%13 = call i32 @test(i32 11)
%14 = call i32 @test(i32 15)
%15 = call i32 @test(i32 11434)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test(i32 -1)
%2 = tail call i32 @test(i32 0)
%3 = tail call i32 @test(i32 1)
%4 = tail call i32 @test(i32 2)
%5 = tail call i32 @test(i32 3)
%6 = tail call i32 @test(i32 4)
%7 = tail call i32 @test(i32 5)
%8 = tail call i32 @test(i32 6)
%9 = tail call i32 @test(i32 7)
%10 = tail call i32 @test(i32 8)
%11 = tail call i32 @test(i32 9)
%12 = tail call i32 @test(i32 10)
%13 = tail call i32 @test(i32 11)
%14 = tail call i32 @test(i32 15)
%15 = tail call i32 @test(i32 11434)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void shmem_longlong_sum_to_all(long long *target, long long *source,
                                      int nreduce, int PE_start,
                                      int logPE_stride, int PE_size,
                                      long long *pWrk, long *pSync) {
  printf("\nOpenSHMEM Analyzer\n");
}


x86 assembly (clang, -O0):
<shmem_longlong_sum_to_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define void @shmem_longlong_sum_to_all(i64* nocapture readnone %0, i64* nocapture readnone %1, i32 %2, i32 %3, i32 %4, i32 %5, i64* nocapture readnone %6, i64* nocapture readnone %7) {
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
extern unsigned long PassULong(unsigned long *lng) { return *lng; }


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

x86 assembly (clang, -O2):
<PassULong>:
mov    (%rdi),%rax
ret

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

LLVM IR (-O2):
define i64 @PassULong(i64* nocapture %0) {
%2 = load i64, i64* %0
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, int);
int main() {
  char c = 0;
  int i = 0;
  short s = 0;
  long l = 0;
  while (++c > 0)
    ;
  --c;
  while (++i > 0)
    ;
  ++i;
  printf("Max char: %d\nMax int: %d\n", c, i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
movw   $0x0,-0xe(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
jle    1151 <main+0x41>
jmp    1138 <main+0x28>
mov    -0x5(%rbp),%al
add    $0xff,%al
mov    %al,-0x5(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jle    1170 <main+0x60>
jmp    1159 <main+0x49>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x5(%rbp),%al
mov    -0xc(%rbp),%edx
lea    0xe7a(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int focus;
};
struct TYPE_4__ {
  TYPE_1__ xcrossing;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xcrossing_focus(void *_p, int _v) {
  ((XEvent *)_p)->xcrossing.focus = (int)_v;
}


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

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

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

LLVM IR (-O2):
define void @set_XEvent_xcrossing_focus(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ foo(int *);
int main(void) {
  int p = 8;
  if ((foo(&p) ?: p) != 6)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x8,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <foo@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     115a <main+0x3a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1162 <main+0x42>
movslq -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    $0x6,%rax
je     1177 <main+0x57>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x8,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1040 <foo@plt>
test   %rax,%rax
movslq 0x4(%rsp),%rcx
cmovne %rax,%rcx
cmp    $0x6,%rcx
jne    1149 <main+0x29>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 8, i32* %2
%3 = call i64 @foo(i32* %2)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
br label %9
6: ; preds = %0
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
br label %9
9: ; preds = %6, %5
%10 = phi i64 [ %3, %5 ], [ %8, %6 ]
%11 = icmp ne i64 %10, 6
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 8, i32* %1
%3 = call i64 @foo(i32* %1)
%4 = icmp eq i64 %3, 0
%5 = load i32, i32* %1
%6 = sext i32 %5 to i64
%7 = select i1 %4, i64 %6, i64 %3
%8 = icmp eq i64 %7, 6
br i1 %8, label %11, label %9
9: ; preds = %0
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %0
ret i32 0
}
int assertDeepEqual(int *actual, int *expected, int length) {
  int i;
  for (i = 0; i < length; i++) {
    if (*(actual + i) != *(expected + i)) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<assertDeepEqual>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    115d <assertDeepEqual+0x5d>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     114a <assertDeepEqual+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1164 <assertDeepEqual+0x64>
jmp    114f <assertDeepEqual+0x4f>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <assertDeepEqual+0x16>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<assertDeepEqual>:
mov    $0x1,%eax
test   %edx,%edx
jle    1121 <assertDeepEqual+0x21>
mov    %edx,%r8d
xor    %edx,%edx
xchg   %ax,%ax
mov    (%rdi,%rdx,4),%ecx
cmp    (%rsi,%rdx,4),%ecx
jne    1122 <assertDeepEqual+0x22>
add    $0x1,%rdx
cmp    %rdx,%r8
jne    1110 <assertDeepEqual+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @assertDeepEqual(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %16, %6
br i1 %8, label %17, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %16, %7 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %1, i64 %10
%14 = load i32, i32* %13
%15 = icmp eq i32 %12, %14
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %7, label %17
17: ; preds = %9, %7, %3
%18 = phi i32 [ 1, %3 ], [ 1, %7 ], [ 0, %9 ]
ret i32 %18
}
void Dswap2B(void *val) {
  char *c = (char *)val;
  char a;
  a = c[0];
  c[0] = c[1];
  c[1] = a;
}


x86 assembly (clang, -O0):
<Dswap2B>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Dswap2B>:
rolw   $0x8,(%rdi)
ret

LLVM IR (-O0):
define void @Dswap2B(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
store i8 %8, i8* %4
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 0
store i8 %11, i8* %13
%14 = load i8, i8* %4
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
ret void
}

LLVM IR (-O2):
define void @Dswap2B(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
store i8 %4, i8* %0
store i8 %2, i8* %3
ret void
}
void check_for_gz(int ispipe, const char *cp, struct coredump_params *cprm) {
  return;
}


x86 assembly (clang, -O0):
<check_for_gz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.coredump_params = type opaque
define void @check_for_gz(i32 %0, i8* nocapture %1, %struct.coredump_params* nocapture %2) {
ret void
}
/* Variables and functions */
double asin(double);
double acos(double x) { return (1.57079632679489661923 - asin(x)); }


x86 assembly (clang, -O0):
<acos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <asin@plt>
movaps %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acos>:
push   %rax
call   1030 <asin@plt>
movsd  0xee2(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @acos(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @asin(double %3)
%5 = fsub double 0x3FF921FB54442D18, %4
ret double %5
}

LLVM IR (-O2):
define double @acos(double %0) {
%2 = tail call double @asin(double %0)
%3 = fsub double 0x3FF921FB54442D18, %2
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int main(void) {
  FILE *fout = fopen("primes.out", "w");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    0xede(%rip),%rsi
call   1030 <fopen@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [11 x i8] c"primes.out\00"
@.str.1 = [2 x i8] c"w\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"primes.out\00"
@.str.1 = [2 x i8] c"w\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
int main(void) { return 17; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 17
}
/* Variables and functions */
int serialOpen(char const *, int const);
int initSerial(int *fd, const char *device, const int baud) {
  *fd = serialOpen(device, baud);
  if (*fd == -1) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<initSerial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <serialOpen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0xffffffff,(%rax)
jne    1150 <initSerial+0x40>
movl   $0x0,-0x4(%rbp)
jmp    1157 <initSerial+0x47>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initSerial>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %edx,%esi
call   1030 <serialOpen@plt>
mov    %eax,(%rbx)
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @initSerial(i32* nocapture writeonly %0, i8* %1, i32 %2) {
%4 = tail call i32 @serialOpen(i8* %1, i32 %2)
store i32 %4, i32* %0
%5 = icmp ne i32 %4, -1
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ PTHREAD_CANCEL_DISABLE;
int /*<<< orphan*/ pthread_setcancelstate(int /*<<< orphan*/,
                                          int /*<<< orphan*/ *);
void thread_disable_cancel(void) {
  pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
}


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

x86 assembly (clang, -O2):
<thread_disable_cancel>:
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
jmp    1030 <pthread_setcancelstate@plt>

LLVM IR (-O0):
@PTHREAD_CANCEL_DISABLE = global i32 0
define void @thread_disable_cancel() {
%1 = load i32, i32* @PTHREAD_CANCEL_DISABLE
%2 = call i32 @pthread_setcancelstate(i32 %1, i32* null)
ret void
}

LLVM IR (-O2):
@PTHREAD_CANCEL_DISABLE = global i32 0
define void @thread_disable_cancel() {
%1 = load i32, i32* @PTHREAD_CANCEL_DISABLE
%2 = tail call i32 @pthread_setcancelstate(i32 %1, i32* null)
ret void
}
__attribute__((no, noclone)) void f4(unsigned int v) {
  unsigned int x = 214748365U * (v + 1);
  if (x != -1932735285U)
    __builtin_abort();
}


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
imul   $0xccccccd,%eax,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x8ccccccb,-0x8(%rbp)
je     113c <f4+0x2c>
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
imul   $0xccccccd,%edi,%eax
cmp    $0x7ffffffe,%eax
jne    111e <f4+0xe>
ret
push   %rax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @f4(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add i32 %4, 1
%6 = mul i32 214748365, %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, -1932735285
br i1 %8, label %9, label %10
9: ; preds = %1
unreachable
10: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @f4(i32 %0) {
%2 = mul i32 %0, 214748365
%3 = icmp eq i32 %2, 2147483646
br i1 %3, label %5, label %4
4: ; preds = %1
tail call void @abort()
unreachable
5: ; preds = %1
ret void
}
/* Variables and functions */
int _func_xpath_funcs(char *, void *, int, char *);
int _func_xpath_nsuri(char *chunk, void *data) {
  return _func_xpath_funcs(chunk, data, 11, "namespace-uri()");
}


x86 assembly (clang, -O0):
<_func_xpath_nsuri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xb,%edx
lea    0xecc(%rip),%rcx
call   1030 <_func_xpath_funcs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_func_xpath_nsuri>:
lea    0xee9(%rip),%rcx
mov    $0xb,%edx
jmp    1030 <_func_xpath_funcs@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"namespace-uri()\00"
define i32 @_func_xpath_nsuri(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @_func_xpath_funcs(i8* %5, i8* %6, i32 11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 %7
}

LLVM IR (-O2):
@.str = [16 x i8] c"namespace-uri()\00"
define i32 @_func_xpath_nsuri(i8* %0, i8* %1) {
%3 = tail call i32 @_func_xpath_funcs(i8* %0, i8* %1, i32 11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int parse_byte_stream_delim(char const *, char *, int, int /*<<< orphan*/ *,
                            int *);
int parse_byte_stream(const char *sval, int max_len, uint8_t *dst,
                      int *out_len) {
  return parse_byte_stream_delim(sval, ":-", max_len, dst, out_len);
}


x86 assembly (clang, -O0):
<parse_byte_stream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xec3(%rip),%rsi
call   1030 <parse_byte_stream_delim@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_byte_stream>:
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %esi,%edx
lea    0xee1(%rip),%rsi
jmp    1030 <parse_byte_stream_delim@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c":-\00"
define i32 @parse_byte_stream(i8* %0, i32 %1, i32* %2, i32* %3) {
%5 = tail call i32 @parse_byte_stream_delim(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1, i32* %2, i32* %3)
ret i32 %5
}
unsigned shit(unsigned i) { return i <= 0 ? 0 : i - 1; }


x86 assembly (clang, -O0):
<shit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
ja     111b <shit+0x1b>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <shit+0x24>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shit>:
xor    %eax,%eax
sub    $0x1,%edi
cmovae %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @shit(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = add i32 %0, -1
%4 = select i1 %2, i32 0, i32 %3
ret i32 %4
}
int bit_shift(long int x) {
  int i, n;
  for (i = n = 0; x && (i < (sizeof(long) * 8)); ++i, x >>= 1)
    n += (int)(x & 1L);
  return n;
}


x86 assembly (clang, -O0):
<bit_shift>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     1134 <bit_shift+0x34>
movslq -0xc(%rbp),%rax
cmp    $0x40,%rax
setb   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1144 <bit_shift+0x44>
jmp    116c <bit_shift+0x6c>
mov    -0x8(%rbp),%rax
and    $0x1,%rax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
sar    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1116 <bit_shift+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_shift>:
xor    %eax,%eax
test   %rdi,%rdi
je     112c <bit_shift+0x2c>
xor    %ecx,%ecx
nopl   0x0(%rax)
mov    %eax,%edx
mov    %edi,%eax
and    $0x1,%eax
add    %edx,%eax
cmp    $0x2,%rdi
jb     112c <bit_shift+0x2c>
lea    0x1(%rcx),%edx
sar    %rdi
cmp    $0x3f,%ecx
mov    %edx,%ecx
jb     1110 <bit_shift+0x10>
ret

LLVM IR (-O0):
define i32 @bit_shift(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
store i64 %0, i64* %2
store i32 0, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %20, %1
%6 = load i64, i64* %2
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 64
br label %12
12: ; preds = %8, %5
%13 = phi i1 [ false, %5 ], [ %11, %8 ]
br i1 %13, label %14, label %25
14: ; preds = %12
%15 = load i64, i64* %2
%16 = and i64 %15, 1
%17 = trunc i64 %16 to i32
%18 = load i32, i32* %4
%19 = add nsw i32 %18, %17
store i32 %19, i32* %4
br label %20
20: ; preds = %14
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
%23 = load i64, i64* %2
%24 = ashr i64 %23, 1
store i64 %24, i64* %2
br label %5
25: ; preds = %12
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
define i32 @bit_shift(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %15, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ 0, %1 ]
%5 = phi i32 [ %10, %3 ], [ 0, %1 ]
%6 = phi i64 [ %11, %3 ], [ %0, %1 ]
%7 = trunc i64 %6 to i32
%8 = and i32 %7, 1
%9 = add nuw nsw i32 %4, %8
%10 = add nuw nsw i32 %5, 1
%11 = ashr i64 %6, 1
%12 = icmp ugt i64 %6, 1
%13 = icmp ult i32 %5, 63
%14 = select i1 %12, i1 %13, i1 false
br i1 %14, label %3, label %15
15: ; preds = %3, %1
%16 = phi i32 [ 0, %1 ], [ %9, %3 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void think(int positionOfP) { printf("Philosopher %d thinks\n", positionOfP); }


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

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

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

LLVM IR (-O2):
@.str = [23 x i8] c"Philosopher %d thinks\0A\00"
define void @think(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, char, int);
int str_repeat(char input, int len, char *to) {
  if (!input || !to)
    return -1;
  memset(to, input, len);
  return 0;
}


x86 assembly (clang, -O0):
<str_repeat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpb   $0x0,-0x5(%rbp)
je     113a <str_repeat+0x2a>
cmpq   $0x0,-0x18(%rbp)
jne    1146 <str_repeat+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    115f <str_repeat+0x4f>
mov    -0x18(%rbp),%rdi
mov    -0x5(%rbp),%al
mov    -0xc(%rbp),%edx
movsbl %al,%esi
call   1030 <memset@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_repeat>:
mov    $0xffffffff,%eax
test   %dil,%dil
je     1136 <str_repeat+0x26>
test   %rdx,%rdx
je     1136 <str_repeat+0x26>
push   %rax
mov    %esi,%ecx
movsbl %dil,%esi
mov    %rdx,%rdi
mov    %ecx,%edx
call   1030 <memset@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @str_repeat(i8 signext %0, i32 %1, i8* %2) {
%4 = icmp ne i8 %0, 0
%5 = icmp ne i8* %2, null
%6 = and i1 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @memset(i8* %2, i8 signext %0, i32 %1)
br label %9
9: ; preds = %3, %7
%10 = phi i32 [ 0, %7 ], [ -1, %3 ]
ret i32 %10
}
int main() {
  int k = 0;
  for (int i = 0; i < 10; i++) {
    while (k < 10) {
      k++;
    }
  }
  return k;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1153 <main+0x53>
jmp    1128 <main+0x28>
cmpl   $0xa,-0x8(%rbp)
jge    1140 <main+0x40>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1128 <main+0x28>
jmp    1145 <main+0x45>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1119 <main+0x19>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int /*<<< orphan*/ sumI(int, int, int **);
int main() {
  int a, b;
  int rtn[2];
  printf("Please input 2 Numbers(,): ");
  scanf("%d, %d", &a, &b);
  sumI(a, b, &rtn);
  printf("%d,,", rtn[0]);
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
lea    0x10(%rsp),%rdx
call   1040 <sumI@plt>
mov    0x10(%rsp),%esi
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Please input 2 Numbers(,): \00"
@.str.1 = [7 x i8] c"%d, %d\00"
@.str.2 = [5 x i8] c"%d,,\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2 x i32]
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = bitcast [2 x i32]* %3 to i32**
%9 = call i32 @sumI(i32 %6, i32 %7, i32** %8)
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%11 = load i32, i32* %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"Please input 2 Numbers(,): \00"
@.str.1 = [7 x i8] c"%d, %d\00"
@.str.2 = [5 x i8] c"%d,,\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32** %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = call i32 @sumI(i32 %9, i32 %10, i32** %3)
%12 = bitcast i32** %3 to i32*
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %13)
ret i32 0
}
void g_value_get_param() {}


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

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

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

LLVM IR (-O2):
define void @g_value_get_param() {
ret void
}
/* Variables and functions */
bool nrf51_errata_60(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf51_errata_60() {
ret i32 0
}
void TimerControlEvent(unsigned long ulBase, unsigned long ulTimer,
                       unsigned long ulEvent) {
  ;

  ;
  ulTimer &= 0x0000000C | 0x00000C00;
  (*((volatile unsigned long *)(ulBase + 0x0000000C))) =
      (((*((volatile unsigned long *)(ulBase + 0x0000000C))) & ~ulTimer) |
       (ulEvent & ulTimer));
}


x86 assembly (clang, -O0):
<TimerControlEvent>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0xc0c,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rcx
mov    -0x10(%rbp),%rax
xor    $0xffffffffffffffff,%rax
and    %rax,%rcx
mov    -0x18(%rbp),%rax
and    -0x10(%rbp),%rax
or     %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerControlEvent>:
and    $0xc0c,%esi
mov    %rsi,%rax
not    %rax
and    0xc(%rdi),%rax
and    %edx,%esi
or     %rax,%rsi
mov    %rsi,0xc(%rdi)
ret

LLVM IR (-O0):
define void @TimerControlEvent(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %5
%8 = and i64 %7, 3084
store i64 %8, i64* %5
%9 = load i64, i64* %4
%10 = add i64 %9, 12
%11 = inttoptr i64 %10 to i64*
%12 = load volatile i64, i64* %11
%13 = load i64, i64* %5
%14 = xor i64 %13, -1
%15 = and i64 %12, %14
%16 = load i64, i64* %6
%17 = load i64, i64* %5
%18 = and i64 %16, %17
%19 = or i64 %15, %18
%20 = load i64, i64* %4
%21 = add i64 %20, 12
%22 = inttoptr i64 %21 to i64*
store volatile i64 %19, i64* %22
ret void
}

LLVM IR (-O2):
define void @TimerControlEvent(i64 %0, i64 %1, i64 %2) {
%4 = and i64 %1, 3084
%5 = add i64 %0, 12
%6 = inttoptr i64 %5 to i64*
%7 = load volatile i64, i64* %6
%8 = xor i64 %4, -1
%9 = and i64 %7, %8
%10 = and i64 %4, %2
%11 = or i64 %9, %10
store volatile i64 %11, i64* %6
ret void
}
/* Variables and functions */
int pow(int, int);
int cube(int a) { return pow(a, 3); }


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

x86 assembly (clang, -O2):
<cube>:
mov    $0x3,%esi
jmp    1030 <pow@plt>

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

LLVM IR (-O2):
define i32 @cube(i32 %0) {
%2 = tail call i32 @pow(i32 %0, i32 3)
ret i32 %2
}
/* Type definitions */
struct timeb {
  int millitm;
  int time;
};

/* Variables and functions */
int /*<<< orphan*/ ftime(struct timeb *);
int BMK_GetMilliStart() {
  struct timeb tb;
  int nCount;
  ftime(&tb);
  nCount = tb.millitm + (tb.time & 0xfffff) * 1000;
  return nCount;
}


x86 assembly (clang, -O0):
<BMK_GetMilliStart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1030 <ftime@plt>
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
and    $0xfffff,%ecx
imul   $0x3e8,%ecx,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BMK_GetMilliStart>:
push   %rax
mov    %rsp,%rdi
call   1030 <ftime@plt>
mov    $0xfffff,%eax
and    0x4(%rsp),%eax
imul   $0x3e8,%eax,%eax
add    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeb = type { i32, i32 }
define i32 @BMK_GetMilliStart() {
%1 = alloca %struct.timeb
%2 = alloca i32
%3 = call i32 @ftime(%struct.timeb* %1)
%4 = getelementptr inbounds %struct.timeb, %struct.timeb* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.timeb, %struct.timeb* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = and i32 %7, 1048575
%9 = mul nsw i32 %8, 1000
%10 = add nsw i32 %5, %9
store i32 %10, i32* %2
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
%struct.timeb = type { i32, i32 }
define i32 @BMK_GetMilliStart() {
%1 = alloca %struct.timeb
%2 = bitcast %struct.timeb* %1 to i8*
%3 = call i32 @ftime(%struct.timeb* %1)
%4 = getelementptr inbounds %struct.timeb, %struct.timeb* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.timeb, %struct.timeb* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = and i32 %7, 1048575
%9 = mul nuw nsw i32 %8, 1000
%10 = add nsw i32 %9, %5
ret i32 %10
}
int my_atoi(char **str) {
  int nbr;
  nbr = 0;
  while (**str >= '0' && **str <= '9') {
    nbr = nbr * 10 + (**str - '0');
    (*str)++;
  }
  return (nbr);
}


x86 assembly (clang, -O0):
<my_atoi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0xd(%rbp)
jl     113a <my_atoi+0x3a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    114a <my_atoi+0x4a>
jmp    1173 <my_atoi+0x73>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
movsbl (%rcx),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    110f <my_atoi+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_atoi>:
mov    (%rdi),%rcx
mov    (%rcx),%dl
lea    -0x30(%rdx),%esi
xor    %eax,%eax
cmp    $0x9,%sil
ja     113f <my_atoi+0x3f>
add    $0x1,%rcx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
movzbl %dl,%edx
lea    (%rax,%rax,4),%eax
lea    (%rdx,%rax,2),%eax
add    $0xffffffd0,%eax
mov    %rcx,(%rdi)
movzbl (%rcx),%edx
lea    -0x30(%rdx),%esi
add    $0x1,%rcx
cmp    $0xa,%sil
jb     1120 <my_atoi+0x20>
ret

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

LLVM IR (-O2):
define i32 @my_atoi(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = add i8 %3, -48
%5 = icmp ult i8 %4, 10
br i1 %5, label %6, label %18
6: ; preds = %1, %6
%7 = phi i8 [ %15, %6 ], [ %3, %1 ]
%8 = phi i8* [ %14, %6 ], [ %2, %1 ]
%9 = phi i32 [ %13, %6 ], [ 0, %1 ]
%10 = zext i8 %7 to i32
%11 = mul nsw i32 %9, 10
%12 = add i32 %11, -48
%13 = add i32 %12, %10
%14 = getelementptr inbounds i8, i8* %8, i64 1
store i8* %14, i8** %0
%15 = load i8, i8* %14
%16 = add i8 %15, -48
%17 = icmp ult i8 %16, 10
br i1 %17, label %6, label %18
18: ; preds = %6, %1
%19 = phi i32 [ 0, %1 ], [ %13, %6 ]
ret i32 %19
}
__attribute__((always_)) void rcu_enter_nohz(void) {}


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

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

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

LLVM IR (-O2):
define void @rcu_enter_nohz() {
ret void
}
void AnimationDemo(void) {}


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

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

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

LLVM IR (-O2):
define void @AnimationDemo() {
ret void
}
int kfree(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @kfree() {
ret i32 0
}
/* Variables and functions */
int ENXIO;
__attribute__((deprecated)) int
snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
                        long db_gain, long *value, int xdir) {
  return -ENXIO;
}


x86 assembly (clang, -O0):
<snd_tlv_convert_from_dB>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
xor    %eax,%eax
mov    0x2ebb(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<snd_tlv_convert_from_dB>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@ENXIO = global i32 0
define i32 @snd_tlv_convert_from_dB(i32* %0, i64 %1, i64 %2, i64 %3, i64* %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64*
%12 = alloca i32
store i32* %0, i32** %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i64* %4, i64** %11
store i32 %5, i32* %12
%13 = load i32, i32* @ENXIO
%14 = sub nsw i32 0, %13
ret i32 %14
}

LLVM IR (-O2):
@ENXIO = global i32 0
define i32 @snd_tlv_convert_from_dB(i32* nocapture readnone %0, i64 %1, i64 %2, i64 %3, i64* nocapture readnone %4, i32 %5) {
%7 = load i32, i32* @ENXIO
%8 = sub nsw i32 0, %7
ret i32 %8
}