xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printids(char *);
void *thr_fun(void *arg) {
  printids("new thread: ");
  return ((void *)0);
}


x86 assembly (clang, -O0):
<thr_fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <printids@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [13 x i8] c"new thread: \00"
define i8* @thr_fun(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printids(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@.str = [13 x i8] c"new thread: \00"
define noalias i8* @thr_fun(i8* nocapture readnone %0) {
%2 = tail call i32 @printids(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i8* null
}
int test_imm_ADuint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xAD << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_ADuint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 173
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int null_ishost(a1)
struct sockaddr *a1;
{
  return (0);
}


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

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

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

LLVM IR (-O2):
%struct.sockaddr = type opaque
define i32 @null_ishost(%struct.sockaddr* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
int main() { fprintf(stdout, "%s\n", NULL); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
xor    %edx,%edx
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 0
}
void gtk_misc_get_padding() {}


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

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

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

LLVM IR (-O2):
define void @gtk_misc_get_padding() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ line_editor();
void main() { line_editor(); }


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

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

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @line_editor()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dwrite_ascfile(char const *, double const, double const,
                                  int const, double const *);
void DWRITE_ASCFILE_C_(const char *name, const double *t0, const double *dt,
                       const int *n, const double *data) {
  dwrite_ascfile(name, *t0, *dt, *n, data);
}


x86 assembly (clang, -O0):
<DWRITE_ASCFILE_C_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rdx
call   1030 <dwrite_ascfile@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DWRITE_ASCFILE_C_>:
movsd  (%rsi),%xmm0
movsd  (%rdx),%xmm1
mov    (%rcx),%esi
mov    %r8,%rdx
jmp    1030 <dwrite_ascfile@plt>

LLVM IR (-O0):
define void @DWRITE_ASCFILE_C_(i8* %0, double* %1, double* %2, i32* %3, double* %4) {
%6 = alloca i8*
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32*
%10 = alloca double*
store i8* %0, i8** %6
store double* %1, double** %7
store double* %2, double** %8
store i32* %3, i32** %9
store double* %4, double** %10
%11 = load i8*, i8** %6
%12 = load double*, double** %7
%13 = load double, double* %12
%14 = load double*, double** %8
%15 = load double, double* %14
%16 = load i32*, i32** %9
%17 = load i32, i32* %16
%18 = load double*, double** %10
%19 = call i32 @dwrite_ascfile(i8* %11, double %13, double %15, i32 %17, double* %18)
ret void
}

LLVM IR (-O2):
define void @DWRITE_ASCFILE_C_(i8* %0, double* nocapture %1, double* nocapture %2, i32* nocapture %3, double* %4) {
%6 = load double, double* %1
%7 = load double, double* %2
%8 = load i32, i32* %3
%9 = tail call i32 @dwrite_ascfile(i8* %0, double %6, double %7, i32 %8, double* %4)
ret void
}
/* Variables and functions */
int rand();
int randInt(int minInclusive, int maxInclusive) {
  int range = (maxInclusive - minInclusive + 1);
  return ((rand() % range) + minInclusive);
}


x86 assembly (clang, -O0):
<randInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randInt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
sub    %edi,%ebx
add    $0x1,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @randInt(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 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = add nsw i32 %8, 1
store i32 %9, i32* %5
%10 = call i32 (...) @rand()
%11 = load i32, i32* %5
%12 = srem i32 %10, %11
%13 = load i32, i32* %3
%14 = add nsw i32 %12, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @randInt(i32 %0, i32 %1) {
%3 = sub i32 1, %0
%4 = add i32 %3, %1
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, %4
%7 = add nsw i32 %6, %0
ret i32 %7
}
unsigned int countContinuousBackslashesBackward(const char *from,
                                                const char *till) {
  unsigned int counter = 0;
  for (; from > till; from--) {
    if (*from == '\\')
      counter++;
    else
      break;
  }
  return counter;
}


x86 assembly (clang, -O0):
<countContinuousBackslashesBackward>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    115a <countContinuousBackslashesBackward+0x5a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    113f <countContinuousBackslashesBackward+0x3f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <countContinuousBackslashesBackward+0x44>
jmp    115a <countContinuousBackslashesBackward+0x5a>
jmp    1149 <countContinuousBackslashesBackward+0x49>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    1113 <countContinuousBackslashesBackward+0x13>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<countContinuousBackslashesBackward>:
xor    %eax,%eax
cmp    %rsi,%rdi
jbe    1123 <countContinuousBackslashesBackward+0x23>
mov    %edi,%ecx
sub    %esi,%ecx
xor    %eax,%eax
nopl   (%rax)
cmpb   $0x5c,(%rdi)
jne    1123 <countContinuousBackslashesBackward+0x23>
add    $0x1,%eax
add    $0xffffffffffffffff,%rdi
cmp    %rsi,%rdi
ja     1110 <countContinuousBackslashesBackward+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @countContinuousBackslashesBackward(i8* %0, i8* readnone %1) {
%3 = icmp ugt i8* %0, %1
br i1 %3, label %4, label %19
4: ; preds = %2
%5 = ptrtoint i8* %0 to i64
%6 = ptrtoint i8* %1 to i64
%7 = trunc i64 %5 to i32
%8 = trunc i64 %6 to i32
%9 = sub i32 %7, %8
br label %10
10: ; preds = %4, %15
%11 = phi i32 [ %16, %15 ], [ 0, %4 ]
%12 = phi i8* [ %17, %15 ], [ %0, %4 ]
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 92
br i1 %14, label %15, label %19
15: ; preds = %10
%16 = add i32 %11, 1
%17 = getelementptr inbounds i8, i8* %12, i64 -1
%18 = icmp ugt i8* %17, %1
br i1 %18, label %10, label %19
19: ; preds = %15, %10, %2
%20 = phi i32 [ 0, %2 ], [ %11, %10 ], [ %9, %15 ]
ret i32 %20
}
/* Variables and functions */
int atoi(char *);
int calc(int);
int /*<<< orphan*/ myprint(int);
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  puts("hello world");
  puts(argv[1]);
  int n = atoi(argv[2]);
  int a = calc(n);
  myprint(a);
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <calc@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <myprint@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx),%rdi
call   1030 <puts@plt>
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1050 <calc@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1040 <myprint@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"hello world\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @puts(i8* %11)
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 2
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = call i32 @calc(i32 %17)
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = call i32 @myprint(i32 %19)
%21 = load i32, i32* %7
ret i32 %21
}

LLVM IR (-O2):
@.str = [12 x i8] c"hello world\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @puts(i8* dereferenceable(1) %5)
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = tail call i32 @calc(i32 %9)
%11 = tail call i32 @myprint(i32 %10)
ret i32 %10
}
char *usage(void) {
  return "--disk=IMAGE (file exposed to the unikernel as a raw block device)";
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [67 x i8] c"--disk=IMAGE (file exposed to the unikernel as a raw block device)\00"
define i8* @usage() {
ret i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [67 x i8] c"--disk=IMAGE (file exposed to the unikernel as a raw block device)\00"
define i8* @usage() {
ret i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0)
}
void arrayTest(const int array[]) {}


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

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

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

LLVM IR (-O2):
define void @arrayTest(i32* nocapture %0) {
ret void
}
void IO_InitWatchdog(void) {
  (*(volatile unsigned long *)(0xE0000000 + 0x04)) = (5 * 11059200) / 3;
  (*(volatile unsigned long *)(0xE0000000 + 0x00)) = 0x03;
  (*(volatile unsigned long *)(0xE0000000 + 0x08)) = 0xaa;
  (*(volatile unsigned long *)(0xE0000000 + 0x08)) = 0x55;
}


x86 assembly (clang, -O0):
<IO_InitWatchdog>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe0000004,%eax
movq   $0x1194000,(%rax)
mov    $0xe0000000,%eax
movq   $0x3,(%rax)
mov    $0xe0000008,%eax
movq   $0xaa,(%rax)
mov    $0xe0000008,%eax
movq   $0x55,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<IO_InitWatchdog>:
mov    $0xe0000008,%eax
movq   $0x1194000,-0x4(%rax)
01
movq   $0x3,-0x8(%rax)
movq   $0xaa,(%rax)
movq   $0x55,(%rax)
ret

LLVM IR (-O0):
define void @IO_InitWatchdog() {
store volatile i64 18432000, i64* inttoptr (i64 3758096388 to i64*)
store volatile i64 3, i64* inttoptr (i64 3758096384 to i64*)
store volatile i64 170, i64* inttoptr (i64 3758096392 to i64*)
store volatile i64 85, i64* inttoptr (i64 3758096392 to i64*)
ret void
}

LLVM IR (-O2):
define void @IO_InitWatchdog() {
store volatile i64 18432000, i64* inttoptr (i64 3758096388 to i64*)
store volatile i64 3, i64* inttoptr (i64 3758096384 to i64*)
store volatile i64 170, i64* inttoptr (i64 3758096392 to i64*)
store volatile i64 85, i64* inttoptr (i64 3758096392 to i64*)
ret void
}
int intFunc() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @intFunc() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ WriteToSMBus(int, int, int, int);
void I2CPowerOff(void) {
  WriteToSMBus(0x10, 0x02, 1, 0x80);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<I2CPowerOff>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10,%edi
mov    $0x2,%esi
mov    $0x1,%edx
mov    $0x80,%ecx
call   1030 <WriteToSMBus@plt>
jmp    112d <I2CPowerOff+0x1d>

x86 assembly (clang, -O2):
<I2CPowerOff>:
push   %rax
mov    $0x10,%edi
mov    $0x2,%esi
mov    $0x1,%edx
mov    $0x80,%ecx
call   1030 <WriteToSMBus@plt>
nopw   0x0(%rax,%rax,1)
jmp    1130 <I2CPowerOff+0x20>

LLVM IR (-O0):
define void @I2CPowerOff() {
%1 = call i32 @WriteToSMBus(i32 16, i32 2, i32 1, i32 128)
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
define void @I2CPowerOff() {
%1 = tail call i32 @WriteToSMBus(i32 16, i32 2, i32 1, i32 128)
br label %2
2: ; preds = %0, %2
br label %2
}
/* Variables and functions */
size_t greatest_power_of_2_le(size_t size) {
  size_t remaining_bits, low_bit;
  remaining_bits = size;
  while ((low_bit = (remaining_bits & -remaining_bits)) != remaining_bits)
    remaining_bits ^= low_bit;
  return low_bit;
}


x86 assembly (clang, -O0):
<greatest_power_of_2_le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    %rcx,%rax
mov    %rax,-0x18(%rbp)
cmp    -0x10(%rbp),%rax
je     113c <greatest_power_of_2_le+0x3c>
mov    -0x18(%rbp),%rax
xor    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <greatest_power_of_2_le+0x10>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<greatest_power_of_2_le>:
mov    %rdi,%rax
mov    %rdi,%rcx
neg    %rcx
and    %rdi,%rcx
mov    %rcx,%rdi
xor    %rax,%rdi
cmp    %rax,%rcx
jne    1100 <greatest_power_of_2_le>
ret

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

LLVM IR (-O2):
define i64 @greatest_power_of_2_le(i64 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %0, %1 ], [ %7, %2 ]
%4 = sub i64 0, %3
%5 = and i64 %3, %4
%6 = icmp eq i64 %5, %3
%7 = xor i64 %5, %3
br i1 %6, label %8, label %2
8: ; preds = %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ fail(char *);
int /*<<< orphan*/ pass(char *);
void ok(int cmp, char *name) {
  if (cmp)
    pass(name);
  else
    fail(name);
}


x86 assembly (clang, -O0):
<ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1147 <ok+0x27>
mov    -0x10(%rbp),%rdi
call   1040 <pass@plt>
jmp    1150 <ok+0x30>
mov    -0x10(%rbp),%rdi
call   1030 <fail@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ok>:
test   %edi,%edi
je     112c <ok+0xc>
mov    %rsi,%rdi
jmp    1040 <pass@plt>
mov    %rsi,%rdi
jmp    1030 <fail@plt>

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

LLVM IR (-O2):
define void @ok(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @pass(i8* %1)
br label %8
6: ; preds = %2
%7 = tail call i32 @fail(i8* %1)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ M_Menu_SaveGame_f();
void SaveGameFunc(void *unused) { M_Menu_SaveGame_f(); }


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

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

LLVM IR (-O0):
define void @SaveGameFunc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @M_Menu_SaveGame_f()
ret void
}

LLVM IR (-O2):
define void @SaveGameFunc(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @M_Menu_SaveGame_f()
ret void
}
char *fmt_o(unsigned char c) {
  static char x[8];
  x[4] = 0;
  x[3] = '0' + (c & 7);
  c >>= 3;
  x[2] = '0' + (c & 7);
  c >>= 3;
  x[1] = '0' + (c & 7);
  x[0] = '\\';
  return x;
}


x86 assembly (clang, -O0):
<fmt_o>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,0x2f14(%rip)
movzbl -0x1(%rbp),%eax
and    $0x7,%eax
add    $0x30,%eax
mov    %al,0x2f03(%rip)
movzbl -0x1(%rbp),%eax
sar    $0x3,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x7,%eax
add    $0x30,%eax
mov    %al,0x2ee8(%rip)
movzbl -0x1(%rbp),%eax
sar    $0x3,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x7,%eax
add    $0x30,%eax
mov    %al,0x2ecd(%rip)
movb   $0x5c,0x2ec5(%rip)
lea    0x2ebe(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmt_o>:
movb   $0x0,0x2f1e(%rip)
lea    0x2f13(%rip),%rax
mov    %edi,%ecx
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2f08(%rip)
mov    %edi,%ecx
shr    $0x3,%cl
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2ef6(%rip)
shr    $0x6,%dil
or     $0x30,%dil
mov    %dil,0x2ee6(%rip)
movb   $0x5c,0x2ede(%rip)
ret

LLVM IR (-O0):
@fmt_o.x = internal global [8 x i8] zeroinitializer
define i8* @fmt_o(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
store i8 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @fmt_o.x, i64 0, i64 4)
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 7
%6 = add nsw i32 48, %5
%7 = trunc i32 %6 to i8
store i8 %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @fmt_o.x, i64 0, i64 3)
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = ashr i32 %9, 3
%11 = trunc i32 %10 to i8
store i8 %11, i8* %2
%12 = load i8, i8* %2
%13 = zext i8 %12 to i32
%14 = and i32 %13, 7
%15 = add nsw i32 48, %14
%16 = trunc i32 %15 to i8
store i8 %16, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @fmt_o.x, i64 0, i64 2)
%17 = load i8, i8* %2
%18 = zext i8 %17 to i32
%19 = ashr i32 %18, 3
%20 = trunc i32 %19 to i8
store i8 %20, i8* %2
%21 = load i8, i8* %2
%22 = zext i8 %21 to i32
%23 = and i32 %22, 7
%24 = add nsw i32 48, %23
%25 = trunc i32 %24 to i8
store i8 %25, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @fmt_o.x, i64 0, i64 1)
store i8 92, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @fmt_o.x, i64 0, i64 0)
ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @fmt_o.x, i64 0, i64 0)
}

LLVM IR (-O2):
@fmt_o.x = internal global [8 x i8] zeroinitializer
define i8* @fmt_o(i8 zeroext %0) {
store i8 0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @fmt_o.x, i64 0, i64 4)
%2 = and i8 %0, 7
%3 = or i8 %2, 48
store i8 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @fmt_o.x, i64 0, i64 3)
%4 = lshr i8 %0, 3
%5 = and i8 %4, 7
%6 = or i8 %5, 48
store i8 %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @fmt_o.x, i64 0, i64 2)
%7 = lshr i8 %0, 6
%8 = or i8 %7, 48
store i8 %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @fmt_o.x, i64 0, i64 1)
store i8 92, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @fmt_o.x, i64 0, i64 0)
ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @fmt_o.x, i64 0, i64 0)
}
int ack(int x, int y) {
  if (x <= 0) {
    return y + 1;
  } else if (y <= 0) {
    return ack(x - 1, 1);
  } else {
    return ack(x - 1, ack(x, y - 1));
  }
}


x86 assembly (clang, -O0):
<ack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1136 <ack+0x26>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    117c <ack+0x6c>
cmpl   $0x0,-0xc(%rbp)
jg     1158 <ack+0x48>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    $0x1,%esi
call   1030 <ack@plt>
mov    %eax,-0x4(%rbp)
jmp    117c <ack+0x6c>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <ack@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
call   1030 <ack@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ack>:
push   %rbx
mov    %esi,%eax
test   %edi,%edi
jle    1141 <ack+0x31>
mov    %edi,%ebx
jmp    112f <ack+0x1f>
nopl   0x0(%rax,%rax,1)
mov    $0x1,%eax
lea    -0x1(%rbx),%ecx
cmp    $0x2,%ebx
mov    %ecx,%ebx
jl     1141 <ack+0x31>
test   %eax,%eax
jle    1120 <ack+0x10>
add    $0xffffffff,%eax
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <ack@plt>
jmp    1125 <ack+0x15>
add    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ack(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 sle i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
br label %26
11: ; preds = %2
%12 = load i32, i32* %5
%13 = icmp sle i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* %4
%16 = sub nsw i32 %15, 1
%17 = call i32 @ack(i32 %16, i32 1)
store i32 %17, i32* %3
br label %26
18: ; preds = %11
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 1
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = sub nsw i32 %22, 1
%24 = call i32 @ack(i32 %21, i32 %23)
%25 = call i32 @ack(i32 %20, i32 %24)
store i32 %25, i32* %3
br label %26
26: ; preds = %18, %14, %8
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @ack(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %11, %2
%5 = phi i32 [ %1, %2 ], [ %12, %11 ]
%6 = add nsw i32 %5, 1
ret i32 %6
7: ; preds = %2, %11
%8 = phi i32 [ %12, %11 ], [ %1, %2 ]
%9 = phi i32 [ %13, %11 ], [ %0, %2 ]
%10 = icmp slt i32 %8, 1
br i1 %10, label %11, label %15
11: ; preds = %7, %15
%12 = phi i32 [ %17, %15 ], [ 1, %7 ]
%13 = add nsw i32 %9, -1
%14 = icmp slt i32 %9, 2
br i1 %14, label %4, label %7
15: ; preds = %7
%16 = add nsw i32 %8, -1
%17 = tail call i32 @ack(i32 %9, i32 %16)
br label %11
}
int qux(int x) { return x < x; }


x86 assembly (clang, -O0):
<qux>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x4(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @qux(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @qux(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *prog) {
  printf("usage: %s filenamefmt count\n", prog);
  printf("       %s filenamefmt start count\n", prog);
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [29 x i8] c"usage: %s filenamefmt count\0A\00"
@.str.1 = [35 x i8] c" %s filenamefmt start count\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
void COM_StripExtension(const char *in, char *out) {
  while (*in && *in != '.') {
    *out++ = *in++;
  }
  *out = 0;
}


x86 assembly (clang, -O0):
<COM_StripExtension>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1131 <COM_StripExtension+0x31>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1141 <COM_StripExtension+0x41>
jmp    1168 <COM_StripExtension+0x68>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    110c <COM_StripExtension+0xc>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<COM_StripExtension>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rax,1),%ecx
test   %cl,%cl
je     1126 <COM_StripExtension+0x26>
cmp    $0x2e,%cl
je     1126 <COM_StripExtension+0x26>
mov    %cl,(%rsi,%rax,1)
add    $0x1,%rax
jmp    1110 <COM_StripExtension+0x10>
movb   $0x0,(%rsi,%rax,1)
ret

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

LLVM IR (-O2):
define void @COM_StripExtension(i8* nocapture %0, i8* nocapture writeonly %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i8* [ %0, %2 ], [ %8, %7 ]
%5 = phi i8* [ %1, %2 ], [ %9, %7 ]
%6 = load i8, i8* %4
switch i8 %6, label %7 [
i8 0, label %10
i8 46, label %10
]
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %6, i8* %5
br label %3
10: ; preds = %3, %3
store i8 0, i8* %5
ret void
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ serialInit();
int app_main() {
  char ch;
  serialInit();
  puts("\r\nSerial port initialization program \r\n");
  while (1) {
    ch = getchar();
    putchar(ch + 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<app_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <serialInit@plt>
lea    0xeaa(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    115b <app_main+0x1b>

x86 assembly (clang, -O2):
<app_main>:
push   %rax
xor    %eax,%eax
call   1050 <serialInit@plt>
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1060 <getchar@plt>
add    $0x1,%al
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1160 <app_main+0x20>

LLVM IR (-O0):
@.str = [40 x i8] c"\0D\0ASerial port initialization program \0D\0A\00"
define i32 @app_main() {
%1 = alloca i8
%2 = call i32 (...) @serialInit()
%3 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %0, %4
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %1
%6 = load i8, i8* %1
%7 = sext i8 %6 to i32
%8 = add nsw i32 %7, 1
%9 = trunc i32 %8 to i8
%10 = call i32 @putchar(i8 signext %9)
br label %4
}

LLVM IR (-O2):
@.str = [40 x i8] c"\0D\0ASerial port initialization program \0D\0A\00"
define i32 @app_main() {
%1 = tail call i32 (...) @serialInit()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %3, %0
%4 = tail call signext i8 (...) @getchar()
%5 = add i8 %4, 1
%6 = tail call i32 @putchar(i8 signext %5)
br label %3
}
char store_weight(int weight) {
  if (weight > 1024)
    weight = 1024;
  else if (weight < -1024)
    weight = -1024;
  if (weight > 0)
    weight -= (weight + 64) >> 7;
  return (weight + 4) >> 3;
}


x86 assembly (clang, -O0):
<store_weight>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x400,-0x4(%rbp)
jle    1120 <store_weight+0x20>
movl   $0x400,-0x4(%rbp)
jmp    1139 <store_weight+0x39>
cmpl   $0xfffffc00,-0x4(%rbp)
jge    1134 <store_weight+0x34>
movl   $0xfffffc00,-0x4(%rbp)
jmp    1139 <store_weight+0x39>
cmpl   $0x0,-0x4(%rbp)
jle    1154 <store_weight+0x54>
mov    -0x4(%rbp),%ecx
add    $0x40,%ecx
sar    $0x7,%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4,%eax
sar    $0x3,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<store_weight>:
cmp    $0xfffffc01,%edi
mov    $0xfffffc00,%eax
cmovge %edi,%eax
cmp    $0x400,%eax
mov    $0x400,%ecx
cmovl  %eax,%ecx
lea    0x40(%rcx),%edx
shr    $0x7,%edx
xor    %esi,%esi
test   %eax,%eax
cmovg  %edx,%esi
neg    %esi
lea    (%rcx,%rsi,1),%eax
add    $0x4,%eax
shr    $0x3,%eax
ret

LLVM IR (-O0):
define signext i8 @store_weight(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 1024
br i1 %4, label %5, label %6
5: ; preds = %1
store i32 1024, i32* %2
br label %11
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, -1024
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 -1024, i32* %2
br label %10
10: ; preds = %9, %6
br label %11
11: ; preds = %10, %5
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 64
%17 = ashr i32 %16, 7
%18 = load i32, i32* %2
%19 = sub nsw i32 %18, %17
store i32 %19, i32* %2
br label %20
20: ; preds = %14, %11
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 4
%23 = ashr i32 %22, 3
%24 = trunc i32 %23 to i8
ret i8 %24
}

LLVM IR (-O2):
define signext i8 @store_weight(i32 %0) {
%2 = icmp sgt i32 %0, -1024
%3 = select i1 %2, i32 %0, i32 -1024
%4 = icmp slt i32 %3, 1024
%5 = select i1 %4, i32 %3, i32 1024
%6 = icmp sgt i32 %3, 0
%7 = add nsw i32 %5, 64
%8 = lshr i32 %7, 7
%9 = select i1 %6, i32 %8, i32 0
%10 = add nsw i32 %5, 4
%11 = sub nsw i32 %10, %9
%12 = lshr i32 %11, 3
%13 = trunc i32 %12 to i8
ret i8 %13
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void ofl_queue_print(FILE *stream, uint32_t queue) {
  switch (queue) {
  case (0xffffffff): {
    fprintf(stream, "all");
    return;
  }
  default: {
    fprintf(stream, "%u", queue);
    return;
  }
  }
}


x86 assembly (clang, -O0):
<ofl_queue_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0xffffffff,%eax
jne    1147 <ofl_queue_print+0x37>
jmp    1130 <ofl_queue_print+0x20>
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    115c <ofl_queue_print+0x4c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xeaf(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ofl_queue_print>:
mov    %rdi,%rcx
cmp    $0xffffffff,%esi
je     113b <ofl_queue_print+0x1b>
mov    %esi,%edx
lea    0xed3(%rip),%rsi
mov    %rcx,%rdi
xor    %eax,%eax
jmp    1030 <fprintf@plt>
lea    0xebe(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"all\00"
@.str.1 = [3 x i8] c"%u\00"
define void @ofl_queue_print(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
switch i32 %5, label %9 [
i32 -1, label %6
]
6: ; preds = %2
%7 = load i32*, i32** %3
%8 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %13
9: ; preds = %2
%10 = load i32*, i32** %3
%11 = load i32, i32* %4
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"all\00"
@.str.1 = [3 x i8] c"%u\00"
define void @ofl_queue_print(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, -1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 3, i64 1, i32* %0)
br label %8
6: ; preds = %2
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %1)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ appendCODE(int /*<<< orphan*/);
int /*<<< orphan*/ makeCODEinvokevirtual(char *, int /*<<< orphan*/ *);
void code_invokevirtual(char *arg) {
  appendCODE(makeCODEinvokevirtual(arg, NULL));
}


x86 assembly (clang, -O0):
<code_invokevirtual>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <makeCODEinvokevirtual@plt>
mov    %eax,%edi
call   1040 <appendCODE@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<code_invokevirtual>:
push   %rax
xor    %esi,%esi
call   1030 <makeCODEinvokevirtual@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <appendCODE@plt>

LLVM IR (-O0):
define void @code_invokevirtual(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @makeCODEinvokevirtual(i8* %3, i32* null)
%5 = call i32 @appendCODE(i32 %4)
ret void
}

LLVM IR (-O2):
define void @code_invokevirtual(i8* %0) {
%2 = tail call i32 @makeCODEinvokevirtual(i8* %0, i32* null)
%3 = tail call i32 @appendCODE(i32 %2)
ret void
}
void Tcl_ValidateAllMemory(file, line) char *file;
int line;
{}


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

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

LLVM IR (-O0):
define void @Tcl_ValidateAllMemory(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @Tcl_ValidateAllMemory(i8* nocapture %0, i32 %1) {
ret void
}
char test_42_0(char *mem) { return __atomic_sub_fetch(mem + 0, 1, 4); }


x86 assembly (clang, -O0):
<test_42_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
movb   $0x1,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    %cl,%al
neg    %al
lock xadd %al,(%rdx)
sub    %cl,%al
mov    %al,-0xa(%rbp)
movsbl -0xa(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_42_0>:
mov    $0xff,%al
lock xadd %al,(%rdi)
add    $0xff,%al
ret

LLVM IR (-O0):
define signext i8 @test_42_0(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 0
store i8 1, i8* %3
%7 = load i8, i8* %3
%8 = atomicrmw sub i8* %6, i8 %7 acq_rel
%9 = sub i8 %8, %7
store i8 %9, i8* %4
%10 = load i8, i8* %4
ret i8 %10
}

LLVM IR (-O2):
define signext i8 @test_42_0(i8* nocapture %0) {
%2 = atomicrmw sub i8* %0, i8 1 acq_rel
%3 = add i8 %2, -1
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ Fdrop();
int /*<<< orphan*/ ignoreon();
void Idrop(void) {
  Fdrop();
  ignoreon();
}


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

x86 assembly (clang, -O2):
<Idrop>:
push   %rax
xor    %eax,%eax
call   1040 <Fdrop@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <ignoreon@plt>

LLVM IR (-O0):
define void @Idrop() {
%1 = call i32 (...) @Fdrop()
%2 = call i32 (...) @ignoreon()
ret void
}

LLVM IR (-O2):
define void @Idrop() {
%1 = tail call i32 (...) @Fdrop()
%2 = tail call i32 (...) @ignoreon()
ret void
}
float HMM_ToRadians(float Degrees) {
  float Result = Degrees * (3.14159265359f / 180.0f);
  return (Result);
}


x86 assembly (clang, -O0):
<HMM_ToRadians>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<HMM_ToRadians>:
mulss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @HMM_ToRadians(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = fmul float %4, 0x3F91DF46A0000000
store float %5, float* %3
%6 = load float, float* %3
ret float %6
}

LLVM IR (-O2):
define float @HMM_ToRadians(float %0) {
%2 = fmul float %0, 0x3F91DF46A0000000
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ test1();
int /*<<< orphan*/ test2();
int /*<<< orphan*/ test3();
int /*<<< orphan*/ test4();
int /*<<< orphan*/ test5();
int /*<<< orphan*/ test6();
int main() {
  test1();
  test2();
  test3();
  test4();
  test5();
  test6();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <test1@plt>
mov    $0x0,%al
call   1080 <test2@plt>
mov    $0x0,%al
call   1040 <test3@plt>
mov    $0x0,%al
call   1070 <test4@plt>
mov    $0x0,%al
call   1030 <test5@plt>
mov    $0x0,%al
call   1060 <test6@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <test1@plt>
xor    %eax,%eax
call   1080 <test2@plt>
xor    %eax,%eax
call   1040 <test3@plt>
xor    %eax,%eax
call   1070 <test4@plt>
xor    %eax,%eax
call   1030 <test5@plt>
xor    %eax,%eax
call   1060 <test6@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test1()
%3 = call i32 (...) @test2()
%4 = call i32 (...) @test3()
%5 = call i32 (...) @test4()
%6 = call i32 (...) @test5()
%7 = call i32 (...) @test6()
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test1()
%2 = tail call i32 (...) @test2()
%3 = tail call i32 (...) @test3()
%4 = tail call i32 (...) @test4()
%5 = tail call i32 (...) @test5()
%6 = tail call i32 (...) @test6()
%7 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(char const *progname) {
  fprintf(stderr, "Usage: %s /sysfs/path/to/device | /path/to/device/node\n",
          progname);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [56 x i8] c"Usage: %s /sysfs/path/to/device | /path/to/device/node\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [56 x i8] c"Usage: %s /sysfs/path/to/device | /path/to/device/node\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void HMR3IsVpidActive(void) {}


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

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

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

LLVM IR (-O2):
define void @HMR3IsVpidActive() {
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
size_t strlen(char *);
void strlen_malloc_Good() {
  int a[10];
  char *s = (char *)malloc(sizeof(char) * 6);
  s[0] = 'h';
  s[1] = 'e';
  s[2] = 'l';
  s[3] = 'l';
  s[4] = 'o';
  s[5] = '\0';
  a[strlen(s)] = 0;
}


x86 assembly (clang, -O0):
<strlen_malloc_Good>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    $0x6,%edi
call   1040 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movb   $0x68,(%rax)
mov    -0x38(%rbp),%rax
movb   $0x65,0x1(%rax)
mov    -0x38(%rbp),%rax
movb   $0x6c,0x2(%rax)
mov    -0x38(%rbp),%rax
movb   $0x6c,0x3(%rax)
mov    -0x38(%rbp),%rax
movb   $0x6f,0x4(%rax)
mov    -0x38(%rbp),%rax
movb   $0x0,0x5(%rax)
mov    -0x38(%rbp),%rdi
call   1030 <strlen@plt>
movl   $0x0,-0x30(%rbp,%rax,4)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen_malloc_Good>:
push   %rax
mov    $0x6,%edi
call   1030 <malloc@plt>
movl   $0x6c6c6568,(%rax)
movw   $0x6f,0x4(%rax)
pop    %rax
ret

LLVM IR (-O0):
define void @strlen_malloc_Good() {
%1 = alloca [10 x i32]
%2 = alloca i8*
%3 = call i64 @malloc(i32 6)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 0
store i8 104, i8* %6
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8 101, i8* %8
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 2
store i8 108, i8* %10
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i64 3
store i8 108, i8* %12
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 4
store i8 111, i8* %14
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 5
store i8 0, i8* %16
%17 = load i8*, i8** %2
%18 = call i64 @strlen(i8* %17)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %18
store i32 0, i32* %19
ret void
}

LLVM IR (-O2):
define void @strlen_malloc_Good() {
%1 = tail call i64 @malloc(i32 6)
%2 = inttoptr i64 %1 to i8*
store i8 104, i8* %2
%3 = getelementptr inbounds i8, i8* %2, i64 1
store i8 101, i8* %3
%4 = getelementptr inbounds i8, i8* %2, i64 2
store i8 108, i8* %4
%5 = getelementptr inbounds i8, i8* %2, i64 3
store i8 108, i8* %5
%6 = getelementptr inbounds i8, i8* %2, i64 4
store i8 111, i8* %6
%7 = getelementptr inbounds i8, i8* %2, i64 5
store i8 0, i8* %7
ret void
}