xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;
typedef int /*<<< orphan*/ wctrans_t;
typedef int /*<<< orphan*/ locale_t;

/* Variables and functions */
int /*<<< orphan*/ towctrans(int /*<<< orphan*/, int /*<<< orphan*/);
wint_t __towctrans_l(wint_t c, wctrans_t t, locale_t l) {
  return towctrans(c, t);
}


x86 assembly (clang, -O0):
<__towctrans_l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <towctrans@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__towctrans_l>:
jmp    1030 <towctrans@plt>

LLVM IR (-O0):
define i32 @__towctrans_l(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = call i32 @towctrans(i32 %7, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @__towctrans_l(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @towctrans(i32 %0, i32 %1)
ret i32 %4
}
int axp_set_freq(int frq) {
  int ret = 0;
  return ret;
}


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

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

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

LLVM IR (-O2):
define i32 @axp_set_freq(i32 %0) {
ret i32 0
}
int checkDivisible(long int smallestMultiple, int largestValue) {
  for (int a = 1; a <= largestValue; ++a) {
    if (smallestMultiple % a != 0)
      return 0;
  }
  return !0;
}


x86 assembly (clang, -O0):
<checkDivisible>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1154 <checkDivisible+0x54>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cqto
idiv   %rcx
cmp    $0x0,%rdx
je     1141 <checkDivisible+0x41>
movl   $0x0,-0x4(%rbp)
jmp    115b <checkDivisible+0x5b>
jmp    1146 <checkDivisible+0x46>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <checkDivisible+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkDivisible>:
test   %esi,%esi
jle    115a <checkDivisible+0x5a>
mov    %esi,%r8d
add    $0x1,%esi
mov    $0x2,%eax
jmp    1131 <checkDivisible+0x31>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rdi,%rax
cqto
idiv   %rcx
lea    0x1(%rcx),%rax
test   %rdx,%rdx
jne    114d <checkDivisible+0x4d>
mov    %rax,%rcx
cmp    %rax,%rsi
je     114d <checkDivisible+0x4d>
mov    %rdi,%rax
or     %rcx,%rax
shr    $0x20,%rax
jne    1120 <checkDivisible+0x20>
mov    %edi,%eax
xor    %edx,%edx
div    %ecx
jmp    1128 <checkDivisible+0x28>
add    $0xffffffffffffffff,%rcx
xor    %eax,%eax
cmp    %r8,%rcx
setae  %al
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @checkDivisible(i64 %0, i32 %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %18, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = add nuw i32 %1, 1
%7 = zext i32 %6 to i64
br label %8
8: ; preds = %4, %12
%9 = phi i64 [ 1, %4 ], [ %10, %12 ]
%10 = add nuw nsw i64 %9, 1
%11 = icmp eq i64 %10, %7
br i1 %11, label %15, label %12
12: ; preds = %8
%13 = srem i64 %0, %10
%14 = icmp eq i64 %13, 0
br i1 %14, label %8, label %15
15: ; preds = %12, %8
%16 = icmp uge i64 %9, %5
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %15, %2
%19 = phi i32 [ 1, %2 ], [ %17, %15 ]
ret i32 %19
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int UINT16_MAX;
uint32_t mp_sizeof_array(uint32_t size) {
  if (size <= 15) {
    return 1;
  } else if (size <= UINT16_MAX) {
    return 1 + sizeof(uint16_t);
  } else {
    return 1 + sizeof(uint32_t);
  }
}


x86 assembly (clang, -O0):
<mp_sizeof_array>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jg     111d <mp_sizeof_array+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    1142 <mp_sizeof_array+0x42>
mov    -0x8(%rbp),%eax
mov    0x2eb9(%rip),%rcx
cmp    (%rcx),%eax
jg     113b <mp_sizeof_array+0x3b>
movl   $0x5,-0x4(%rbp)
jmp    1142 <mp_sizeof_array+0x42>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_sizeof_array>:
xor    %eax,%eax
cmp    $0x10,%edi
setge  %al
lea    0x1(,%rax,4),%eax
ret

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

LLVM IR (-O2):
@UINT16_MAX = global i32 0
define i32 @mp_sizeof_array(i32 %0) {
%2 = icmp slt i32 %0, 16
%3 = select i1 %2, i32 1, i32 5
ret i32 %3
}
int test_imm_55uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x55 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_55uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 5570560
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
void test04_head() {
  do {
    printf("test04");
    puts("");
  } while (0);
}


x86 assembly (clang, -O0):
<test04_head>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <test04_head+0x9>
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test04_head>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"test04\00"
@.str.1 = [1 x i8] zeroinitializer
define void @test04_head() {
br label %1
1: ; preds = %0
%2 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %4
4: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"test04\00"
define void @test04_head() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 10)
ret void
}
void updateMovieRuntime(unsigned int movieID, const char *runtime) { return; }


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

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

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

LLVM IR (-O2):
define void @updateMovieRuntime(i32 %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ malloc(scalar_t__);
char *strcpy(int /*<<< orphan*/, char const *);
scalar_t__ strlen(char const *);
char *str_dup(const char *s1) { return strcpy(malloc(strlen(s1) + 1), s1); }


x86 assembly (clang, -O0):
<str_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_dup>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define i8* @str_dup(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strlen(i8* %3)
%5 = add nsw i64 %4, 1
%6 = call i32 @malloc(i64 %5)
%7 = load i8*, i8** %2
%8 = call i8* @strcpy(i32 %6, i8* %7)
ret i8* %8
}

LLVM IR (-O2):
define i8* @str_dup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i32 @malloc(i64 %3)
%5 = tail call i8* @strcpy(i32 %4, i8* %0)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usermode_aes(int argc, char **argv) { printf("aes \n"); }


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

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

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

LLVM IR (-O2):
@str = [5 x i8] c"aes \00"
define void @usermode_aes(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int send(int, char *, int, int);
int phSend(int m_hSocket, void *lpBuf, int nBufLen, int nFlag) {
  int nResult;
  nResult = send(m_hSocket, (char *)lpBuf, nBufLen, nFlag);
  return nResult;
}


x86 assembly (clang, -O0):
<phSend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1030 <send@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phSend>:
jmp    1030 <send@plt>

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

LLVM IR (-O2):
define i32 @phSend(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @send(i32 %0, i8* %1, i32 %2, i32 %3)
ret i32 %5
}
void restore_slash_c_str(char *__attribute__((nonnull)) const iter) {
  *iter = '/';
}


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

x86 assembly (clang, -O2):
<restore_slash_c_str>:
movb   $0x2f,(%rdi)
ret

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

LLVM IR (-O2):
define void @restore_slash_c_str(i8* nocapture writeonly %0) {
store i8 47, i8* %0
ret void
}
int main() {
  int x, y, z;
  x / y, z;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = sdiv i32 %4, %5
%7 = load i32, i32* %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
void LPCIntEnable(unsigned long ulBase, unsigned long ulIntFlags) {
  DEBUG_ASSERT(ulBase == 0x40080000);
  (*((volatile unsigned long *)(ulBase + 0x00000100))) |= ulIntFlags;
}


x86 assembly (clang, -O0):
<LPCIntEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x40080000,-0x8(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x100(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0x100(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LPCIntEnable>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
cmp    $0x40080000,%rbx
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
or     %r14,0x100(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @LPCIntEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = icmp eq i64 %5, 1074266112
%7 = zext i1 %6 to i32
%8 = call i32 @DEBUG_ASSERT(i32 %7)
%9 = load i64, i64* %4
%10 = load i64, i64* %3
%11 = add i64 %10, 256
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = or i64 %13, %9
store volatile i64 %14, i64* %12
ret void
}

LLVM IR (-O2):
define void @LPCIntEnable(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 1074266112
%4 = zext i1 %3 to i32
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = add i64 %0, 256
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = or i64 %8, %1
store volatile i64 %9, i64* %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ factorial(int);
int /*<<< orphan*/ printf(char *, int, int /*<<< orphan*/);
int strtol(char *, char **, int);
int main(int argc, char *argv[]) {
  char *p;
  int base = strtol(argv[1], &p, 10);
  printf("Factorial with the base of %d equals to %ld\n", base,
         factorial(base));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
call   1030 <factorial@plt>
mov    -0x20(%rbp),%esi
mov    %eax,%edx
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x8(%rsi),%rdi
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <factorial@plt>
lea    0xea8(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Factorial with the base of %d equals to %ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i8**, i8*** %4
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @strtol(i8* %9, i8** %5, i32 10)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = load i32, i32* %6
%13 = call i32 @factorial(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"Factorial with the base of %d equals to %ld\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = call i32 @strtol(i8* %6, i8** %3, i32 10)
%8 = tail call i32 @factorial(i32 %7)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void *malloc(size_t);
void *xmalloc(size_t len) {
  void *p = malloc(len);
  if (!p)
    die("Out of memory\n");
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <xmalloc+0x30>
lea    0xeb5(%rip),%rdi
call   1040 <die@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <xmalloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <die@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Out of memory\0A\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @die(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [15 x i8] c"Out of memory\0A\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @die(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
int pci_ats_enabled(struct pci_dev *dev) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.pci_dev = type opaque
define i32 @pci_ats_enabled(%struct.pci_dev* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int64_t clock_mono() {
  struct timespec ts;
  clock_gettime(CLOCK_MONOTONIC, &ts);
  return (int64_t)((int64_t)ts.tv_sec * 1000 + (int64_t)ts.tv_nsec / 1000000);
}


x86 assembly (clang, -O0):
<clock_mono>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x8(%rbp),%rax
imul   $0x3e8,%eax,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clock_mono>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3e8,0x10(%rsp),%ecx
movslq 0x8(%rsp),%rax
imul   $0x431bde83,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rax
add    %edx,%eax
add    %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
@CLOCK_MONOTONIC = global i32 0
define i32 @clock_mono() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = mul nsw i32 %6, 1000
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%9 = load i64, i64* %8
%10 = trunc i64 %9 to i32
%11 = sdiv i32 %10, 1000000
%12 = add nsw i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
@CLOCK_MONOTONIC = global i32 0
define i32 @clock_mono() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = mul nsw i32 %7, 1000
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = sdiv i32 %11, 1000000
%13 = add nsw i32 %12, %8
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ create_destroy_test();
int /*<<< orphan*/ gate_class_tests();
int /*<<< orphan*/ internal_Not_test();
int /*<<< orphan*/ internal_Or_test();
int /*<<< orphan*/ not_and_shorted();
int main(void) {
  create_destroy_test();
  gate_class_tests();
  internal_Or_test();
  internal_Not_test();
  not_and_shorted();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <create_destroy_test@plt>
mov    $0x0,%al
call   1060 <gate_class_tests@plt>
mov    $0x0,%al
call   1070 <internal_Or_test@plt>
mov    $0x0,%al
call   1040 <internal_Not_test@plt>
mov    $0x0,%al
call   1050 <not_and_shorted@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <create_destroy_test@plt>
xor    %eax,%eax
call   1060 <gate_class_tests@plt>
xor    %eax,%eax
call   1070 <internal_Or_test@plt>
xor    %eax,%eax
call   1040 <internal_Not_test@plt>
xor    %eax,%eax
call   1050 <not_and_shorted@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @create_destroy_test()
%2 = call i32 (...) @gate_class_tests()
%3 = call i32 (...) @internal_Or_test()
%4 = call i32 (...) @internal_Not_test()
%5 = call i32 (...) @not_and_shorted()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @create_destroy_test()
%2 = tail call i32 (...) @gate_class_tests()
%3 = tail call i32 (...) @internal_Or_test()
%4 = tail call i32 (...) @internal_Not_test()
%5 = tail call i32 (...) @not_and_shorted()
ret i32 0
}
/* Variables and functions */
double fmod(double, double);
double fmod2(double a, double n) {
  a = fmod(a, n);
  return a < 0 ? a + n : a;
}


x86 assembly (clang, -O0):
<fmod2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1158 <fmod2+0x48>
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1162 <fmod2+0x52>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmod2>:
sub    $0x18,%rsp
movapd %xmm1,(%rsp)
call   1030 <fmod@plt>
xorpd  %xmm1,%xmm1
movapd %xmm0,%xmm2
cmpltsd %xmm1,%xmm2
movapd (%rsp),%xmm3
andpd  %xmm2,%xmm3
movsd  0xec4(%rip),%xmm1
andnpd %xmm1,%xmm2
orpd   %xmm3,%xmm2
addsd  %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @fmod2(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @fmod(double %5, double %6)
store double %7, double* %3
%8 = load double, double* %3
%9 = fcmp olt double %8, 0.000000e+00
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load double, double* %3
%12 = load double, double* %4
%13 = fadd double %11, %12
br label %16
14: ; preds = %2
%15 = load double, double* %3
br label %16
16: ; preds = %14, %10
%17 = phi double [ %13, %10 ], [ %15, %14 ]
ret double %17
}

LLVM IR (-O2):
define double @fmod2(double %0, double %1) {
%3 = tail call double @fmod(double %0, double %1)
%4 = fcmp olt double %3, 0.000000e+00
%5 = select i1 %4, double %1, double -0.000000e+00
%6 = fadd double %3, %5
ret double %6
}
/* Variables and functions */
int read(int, char *, int);
int readPipe(char *s, int pipe) {
  int l = 0, i;
  while ((i = read(pipe, s, 1)) > 0) {
    s++;
    l++;
  }
  s[l + 1] = '\0';
  return l;
}


x86 assembly (clang, -O0):
<readPipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jle    115d <readPipe+0x4d>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <readPipe+0x16>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readPipe>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
mov    %esi,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <read@plt>
xor    %ebp,%ebp
test   %eax,%eax
jle    114b <readPipe+0x3b>
nop
add    $0x1,%rbx
add    $0x1,%ebp
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <read@plt>
test   %eax,%eax
jg     1130 <readPipe+0x20>
mov    %ebp,%eax
movb   $0x0,0x1(%rax,%rbx,1)
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @readPipe(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @read(i32 %1, i8* %0, i32 1)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2, %5
%6 = phi i8* [ %8, %5 ], [ %0, %2 ]
%7 = phi i32 [ %9, %5 ], [ 0, %2 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = add nuw nsw i32 %7, 1
%10 = tail call i32 @read(i32 %1, i8* %8, i32 1)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %5, label %12
12: ; preds = %5, %2
%13 = phi i32 [ 0, %2 ], [ %9, %5 ]
%14 = phi i8* [ %0, %2 ], [ %8, %5 ]
%15 = add nuw nsw i32 %13, 1
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 0, i8* %17
ret i32 %13
}
int isCpuIdSupported() {
  return 1;
  return 1;
}


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

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

LLVM IR (-O0):
define i32 @isCpuIdSupported() {
ret i32 1
}

LLVM IR (-O2):
define i32 @isCpuIdSupported() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printDigits(int *digit, int i) {
  int j = 0;
  while (j < i) {
    printf("%d", digit[j]);
    j++;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printDigits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <printDigits+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printDigits+0x16>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printDigits>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <printDigits+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <printDigits+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @printDigits(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LVD_LVW_DriverIRQHandler();
__attribute__((weak, section(".after_vectors"))) void LVD_LVW_IRQHandler(void) {
  LVD_LVW_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @LVD_LVW_IRQHandler() section ".after_vectors" {
%1 = call i32 (...) @LVD_LVW_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @LVD_LVW_IRQHandler() section ".after_vectors" {
%1 = tail call i32 (...) @LVD_LVW_DriverIRQHandler()
ret void
}
void RTLogGetDestinations(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLogGetDestinations() {
ret void
}
/* Variables and functions */
int M_RandomInt(int, int);
int M_RandomIntNoRepeat(int lower, int upper, int previous) {
  int randomint;
  while ((randomint = M_RandomInt(lower, upper)) == previous)
    ;
  return randomint;
}


x86 assembly (clang, -O0):
<M_RandomIntNoRepeat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <M_RandomInt@plt>
mov    %eax,-0x10(%rbp)
cmp    -0xc(%rbp),%eax
jne    113d <M_RandomIntNoRepeat+0x2d>
jmp    1121 <M_RandomIntNoRepeat+0x11>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M_RandomIntNoRepeat>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <M_RandomInt@plt>
cmp    %r14d,%eax
je     1120 <M_RandomIntNoRepeat+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @M_RandomIntNoRepeat(i32 %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %4, %3
%5 = tail call i32 @M_RandomInt(i32 %0, i32 %1)
%6 = icmp eq i32 %5, %2
br i1 %6, label %4, label %7
7: ; preds = %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ MYSQL_RES;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
unsigned long *mysql_fetch_lengths(MYSQL_RES *result) {
  printf("mysql_fetch_lengths(%s)\n", (result ? "MYSQL_RES" : "NULL"));
  return (0);
}


x86 assembly (clang, -O0):
<mysql_fetch_lengths>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    0xefc(%rip),%rsi
lea    0xeeb(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mysql_fetch_lengths>:
push   %rax
test   %rdi,%rdi
lea    0xf08(%rip),%rax
lea    0xef7(%rip),%rsi
cmove  %rax,%rsi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"mysql_fetch_lengths(%s)\0A\00"
@.str.1 = [10 x i8] c"MYSQL_RES\00"
@.str.2 = [5 x i8] c"NULL\00"
define i64* @mysql_fetch_lengths(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i64* null
}

LLVM IR (-O2):
@.str = [25 x i8] c"mysql_fetch_lengths(%s)\0A\00"
@.str.1 = [10 x i8] c"MYSQL_RES\00"
@.str.2 = [5 x i8] c"NULL\00"
define noalias i64* @mysql_fetch_lengths(i32* readnone %0) {
%2 = icmp eq i32* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i64* null
}
int main() {
  void dummy();
  dummy();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
tail call void (...) @dummy()
ret i32 0
}
/* Variables and functions */
int strlen(char *);
char *trim(char *s) {
  int end = strlen(s) - 1;
  if (s[end] == '\n')
    s[end] = '\0';
  return s;
}


x86 assembly (clang, -O0):
<trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    114c <trim+0x3c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    1127 <trim+0x17>
movb   $0x0,-0x1(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @trim(i8* returned %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 10
br i1 %7, label %8, label %9
8: ; preds = %1
store i8 0, i8* %5
br label %9
9: ; preds = %8, %1
ret i8* %0
}
/* Type definitions */
struct openconnect_info {
  int dummy;
};
typedef int /*<<< orphan*/ X509;

/* Variables and functions */
int /*<<< orphan*/ EVP_sha1();
int get_cert_fingerprint(struct openconnect_info *, int /*<<< orphan*/ *,
                         int /*<<< orphan*/, char *);
int openconnect_get_cert_sha1(struct openconnect_info *vpninfo, X509 *cert,
                              char *buf) {
  return get_cert_fingerprint(vpninfo, cert, EVP_sha1(), buf);
}


x86 assembly (clang, -O0):
<openconnect_get_cert_sha1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <EVP_sha1@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
mov    -0x18(%rbp),%rcx
call   1030 <get_cert_fingerprint@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openconnect_get_cert_sha1>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <EVP_sha1@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <get_cert_fingerprint@plt>

LLVM IR (-O0):
%struct.openconnect_info = type { i32 }
define i32 @openconnect_get_cert_sha1(%struct.openconnect_info* %0, i32* %1, i8* %2) {
%4 = alloca %struct.openconnect_info*
%5 = alloca i32*
%6 = alloca i8*
store %struct.openconnect_info* %0, %struct.openconnect_info** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
%7 = load %struct.openconnect_info*, %struct.openconnect_info** %4
%8 = load i32*, i32** %5
%9 = call i32 (...) @EVP_sha1()
%10 = load i8*, i8** %6
%11 = call i32 @get_cert_fingerprint(%struct.openconnect_info* %7, i32* %8, i32 %9, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
%struct.openconnect_info = type { i32 }
define i32 @openconnect_get_cert_sha1(%struct.openconnect_info* %0, i32* %1, i8* %2) {
%4 = tail call i32 (...) @EVP_sha1()
%5 = tail call i32 @get_cert_fingerprint(%struct.openconnect_info* %0, i32* %1, i32 %4, i8* %2)
ret i32 %5
}
int hashmap_default_key_equal(const void *l, const void *r) {
  unsigned long result = *((unsigned long *)l) - *((unsigned long *)r);
  if (result == 0) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<hashmap_default_key_equal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
sub    (%rcx),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1135 <hashmap_default_key_equal+0x35>
movl   $0x1,-0x4(%rbp)
jmp    113c <hashmap_default_key_equal+0x3c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashmap_default_key_equal>:
mov    (%rdi),%rcx
xor    %eax,%eax
cmp    (%rsi),%rcx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @hashmap_default_key_equal(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp eq i64 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
char get_locator_character_code(char ch) {
  if (ch >= 48 && ch <= 57) {
    return ch - 48;
  }
  if (ch == 32) {
    return 36;
  }
  if (ch >= 65 && ch <= 82) {
    return ch - 65;
  }
  return -1;
}


x86 assembly (clang, -O0):
<get_locator_character_code>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x30,%eax
jl     1133 <get_locator_character_code+0x33>
movsbl -0x2(%rbp),%eax
cmp    $0x39,%eax
jg     1133 <get_locator_character_code+0x33>
movsbl -0x2(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    1176 <get_locator_character_code+0x76>
movsbl -0x2(%rbp),%eax
cmp    $0x20,%eax
jne    1149 <get_locator_character_code+0x49>
movb   $0x24,-0x1(%rbp)
jmp    1176 <get_locator_character_code+0x76>
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     1172 <get_locator_character_code+0x72>
movsbl -0x2(%rbp),%eax
cmp    $0x52,%eax
jg     1172 <get_locator_character_code+0x72>
movsbl -0x2(%rbp),%eax
sub    $0x41,%eax
mov    %al,-0x1(%rbp)
jmp    1176 <get_locator_character_code+0x76>
movb   $0xff,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_locator_character_code>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
jb     1123 <get_locator_character_code+0x23>
mov    $0x24,%al
cmp    $0x20,%dil
je     1123 <get_locator_character_code+0x23>
add    $0xbf,%dil
cmp    $0x12,%dil
movzbl %dil,%ecx
mov    $0xff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @get_locator_character_code(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
%15 = trunc i32 %14 to i8
store i8 %15, i8* %2
br label %35
16: ; preds = %7, %1
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 32
br i1 %19, label %20, label %21
20: ; preds = %16
store i8 36, i8* %2
br label %35
21: ; preds = %16
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp sge i32 %23, 65
br i1 %24, label %25, label %34
25: ; preds = %21
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = icmp sle i32 %27, 82
br i1 %28, label %29, label %34
29: ; preds = %25
%30 = load i8, i8* %3
%31 = sext i8 %30 to i32
%32 = sub nsw i32 %31, 65
%33 = trunc i32 %32 to i8
store i8 %33, i8* %2
br label %35
34: ; preds = %25, %21
store i8 -1, i8* %2
br label %35
35: ; preds = %34, %29, %20, %11
%36 = load i8, i8* %2
ret i8 %36
}

LLVM IR (-O2):
define signext i8 @get_locator_character_code(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = icmp eq i8 %0, 32
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = add i8 %0, -65
%8 = icmp ult i8 %7, 18
%9 = select i1 %8, i8 %7, i8 -1
br label %10
10: ; preds = %1, %6, %4
%11 = phi i8 [ 36, %4 ], [ %9, %6 ], [ %2, %1 ]
ret i8 %11
}
int ILibGetLocalIPv4AddressList(struct sockaddr_in **addresslist,
                                int includeloopback) {}


x86 assembly (clang, -O0):
<ILibGetLocalIPv4AddressList>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.sockaddr_in = type opaque
define i32 @ILibGetLocalIPv4AddressList(%struct.sockaddr_in** %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in**
%5 = alloca i32
store %struct.sockaddr_in** %0, %struct.sockaddr_in*** %4
store i32 %1, i32* %5
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.sockaddr_in = type opaque
define i32 @ILibGetLocalIPv4AddressList(%struct.sockaddr_in** nocapture readnone %0, i32 %1) {
ret i32 undef
}
/* Variables and functions */
double EvalAngDist_alpha0_3minus_0plus_15097_L3(double);
double funcAngDist_alpha0_3minus_0plus_15097_L3(double *x, double *par) {
  double result;
  result = par[0] * EvalAngDist_alpha0_3minus_0plus_15097_L3(x[0]);
  return result;
}


x86 assembly (clang, -O0):
<funcAngDist_alpha0_3minus_0plus_15097_L3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <EvalAngDist_alpha0_3minus_0plus_15097_L3@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<funcAngDist_alpha0_3minus_0plus_15097_L3>:
push   %rax
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rsp)
movsd  (%rdi),%xmm0
call   1030 <EvalAngDist_alpha0_3minus_0plus_15097_L3@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @funcAngDist_alpha0_3minus_0plus_15097_L3(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %4
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = call double @EvalAngDist_alpha0_3minus_0plus_15097_L3(double %11)
%13 = fmul double %8, %12
store double %13, double* %5
%14 = load double, double* %5
ret double %14
}

LLVM IR (-O2):
define double @funcAngDist_alpha0_3minus_0plus_15097_L3(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = load double, double* %0
%5 = tail call double @EvalAngDist_alpha0_3minus_0plus_15097_L3(double %4)
%6 = fmul double %3, %5
ret double %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ crc32c_sw_little(int /*<<< orphan*/, void const *,
                                    unsigned int);
uint32_t _hdfs_sw_crc32c(uint32_t crc, const void *buf, unsigned len) {
  return crc32c_sw_little(crc, buf, len);
}


x86 assembly (clang, -O0):
<_hdfs_sw_crc32c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <crc32c_sw_little@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_hdfs_sw_crc32c>:
jmp    1030 <crc32c_sw_little@plt>

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

LLVM IR (-O2):
define i32 @_hdfs_sw_crc32c(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @crc32c_sw_little(i32 %0, i8* %1, i32 %2)
ret i32 %4
}