xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_1();
int /*<<< orphan*/ test_2();
int /*<<< orphan*/ test_3();
int main(int argc, char *argv[]) {
  printf("Malloc test program.\n");
  test_1();
  test_2();
  test_3();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <test_1@plt>
xor    %eax,%eax
call   1050 <test_2@plt>
xor    %eax,%eax
call   1060 <test_3@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [21 x i8] c"Malloc test program.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @test_1()
%5 = tail call i32 (...) @test_2()
%6 = tail call i32 (...) @test_3()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ log(double);
double luaL_check_number(int);
int /*<<< orphan*/ lua_pushnumber(int /*<<< orphan*/);
void math_log(void) {
  double d = luaL_check_number(1);
  lua_pushnumber(log(d));
}


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

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

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

LLVM IR (-O2):
define void @math_log() {
%1 = tail call double @luaL_check_number(i32 1)
%2 = tail call i32 @log(double %1)
%3 = tail call i32 @lua_pushnumber(i32 %2)
ret void
}
int FnCompare_float(const void *v1, const void *v2) {
  const float *i1 = v1;
  const float *i2 = v2;
  if (*i1 < *i2)
    return (-1);
  else if (*i1 > *i2)
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<FnCompare_float>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm0
ucomiss %xmm1,%xmm0
jbe    1141 <FnCompare_float+0x41>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <FnCompare_float+0x69>
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x28(%rbp),%rax
ucomiss (%rax),%xmm0
jbe    1162 <FnCompare_float+0x62>
movl   $0x1,-0x4(%rbp)
jmp    1169 <FnCompare_float+0x69>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FnCompare_float>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
xor    %ecx,%ecx
ucomiss %xmm1,%xmm0
seta   %cl
ucomiss %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @FnCompare_float(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca float*
%7 = alloca float*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to float*
store float* %9, float** %6
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to float*
store float* %11, float** %7
%12 = load float*, float** %6
%13 = load float, float* %12
%14 = load float*, float** %7
%15 = load float, float* %14
%16 = fcmp olt float %13, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %26
18: ; preds = %2
%19 = load float*, float** %6
%20 = load float, float* %19
%21 = load float*, float** %7
%22 = load float, float* %21
%23 = fcmp ogt float %20, %22
br i1 %23, label %24, label %25
24: ; preds = %18
store i32 1, i32* %3
br label %26
25: ; preds = %18
store i32 0, i32* %3
br label %26
26: ; preds = %25, %24, %17
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @FnCompare_float(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to float*
%4 = bitcast i8* %1 to float*
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp olt float %5, %6
%8 = fcmp ogt float %5, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
void help() {
  puts("get package dependencies\n"
       "Usage: depends [OPTION] [PACKAGE]\n"
       "   -h              this usage message\n"
       "   -d[path]        path to database file\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [139 x i8] c"get package dependencies\0AUsage: depends [OPTION] [PACKAGE]\0A -h this usage message\0A -d[path] path to database file\0A\00"
define void @help() {
%1 = call i32 @puts(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [139 x i8] c"get package dependencies\0AUsage: depends [OPTION] [PACKAGE]\0A -h this usage message\0A -d[path] path to database file\0A\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ cel_is_prime(int);
extern int cel_next_prime(int n) {
  if (n % 2 == 0)
    n++;
  for (; !cel_is_prime(n); n = n + 2)
    ;
  return n;
}


x86 assembly (clang, -O0):
<cel_next_prime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1138 <cel_next_prime+0x28>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <cel_next_prime+0x2d>
mov    -0x4(%rbp),%edi
call   1030 <cel_is_prime@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    115a <cel_next_prime+0x4a>
jmp    116d <cel_next_prime+0x5d>
jmp    115f <cel_next_prime+0x4f>
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <cel_next_prime+0x2d>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cel_next_prime>:
push   %rbx
mov    %edi,%ebx
not    %ebx
and    $0x1,%ebx
add    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <cel_is_prime@plt>
add    $0x2,%ebx
test   %eax,%eax
je     1120 <cel_next_prime+0x10>
add    $0xfffffffe,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @cel_next_prime(i32 %0) {
%2 = and i32 %0, 1
%3 = xor i32 %2, 1
%4 = add nsw i32 %3, %0
br label %5
5: ; preds = %5, %1
%6 = phi i32 [ %4, %1 ], [ %9, %5 ]
%7 = tail call i32 @cel_is_prime(i32 %6)
%8 = icmp eq i32 %7, 0
%9 = add nsw i32 %6, 2
br i1 %8, label %5, label %10
10: ; preds = %5
ret i32 %6
}
void handleWillOptions(int iVal, void *pArg1, void *pArg2) {}


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

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

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

LLVM IR (-O2):
define void @handleWillOptions(i32 %0, i8* nocapture %1, i8* nocapture %2) {
ret void
}
int float2int(double d) { return (int)d; }


x86 assembly (clang, -O0):
<float2int>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<float2int>:
cvttsd2si %xmm0,%eax
ret

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

LLVM IR (-O2):
define i32 @float2int(double %0) {
%2 = fptosi double %0 to i32
ret i32 %2
}
int execute_stty() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_stty() {
ret i32 0
}
int set_sta_authmode(int radio) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @set_sta_authmode(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ device_close();
int yas_cdrv_term(void) {
  device_close();
  return (0);
}


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

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

LLVM IR (-O0):
define i32 @yas_cdrv_term() {
%1 = call i32 (...) @device_close()
ret i32 0
}

LLVM IR (-O2):
define i32 @yas_cdrv_term() {
%1 = tail call i32 (...) @device_close()
ret i32 0
}
/* Variables and functions */
scalar_t__ strncmp(char *, char *, int);
int getBoolean(char *value) {
  if (value != NULL && strncmp(value, "Yes", 3) == 0) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<getBoolean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1152 <getBoolean+0x42>
mov    -0x10(%rbp),%rdi
lea    0xece(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1152 <getBoolean+0x42>
movl   $0x1,-0x4(%rbp)
jmp    1159 <getBoolean+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBoolean>:
test   %rdi,%rdi
je     1131 <getBoolean+0x21>
push   %rax
lea    0xee3(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
lea    0x8(%rsp),%rsp
je     1134 <getBoolean+0x24>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"Yes\00"
define i32 @getBoolean(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = call i64 @strncmp(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %6
store i32 1, i32* %2
br label %12
11: ; preds = %6, %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@.str = [4 x i8] c"Yes\00"
define i32 @getBoolean(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %3, %1
br label %7
7: ; preds = %3, %6
%8 = phi i32 [ 0, %6 ], [ 1, %3 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ spiSendReceive(int);
void endFrame() {
  if (1) {
    spiSendReceive(0xff);
    spiSendReceive(0xff);
    spiSendReceive(0xff);
    spiSendReceive(0xff);
  }
}


x86 assembly (clang, -O0):
<endFrame>:
push   %rbp
mov    %rsp,%rbp
mov    $0xff,%edi
call   1030 <spiSendReceive@plt>
mov    $0xff,%edi
call   1030 <spiSendReceive@plt>
mov    $0xff,%edi
call   1030 <spiSendReceive@plt>
mov    $0xff,%edi
call   1030 <spiSendReceive@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<endFrame>:
push   %rax
mov    $0xff,%edi
call   1030 <spiSendReceive@plt>
mov    $0xff,%edi
call   1030 <spiSendReceive@plt>
mov    $0xff,%edi
call   1030 <spiSendReceive@plt>
mov    $0xff,%edi
pop    %rax
jmp    1030 <spiSendReceive@plt>

LLVM IR (-O0):
define void @endFrame() {
%1 = call i32 @spiSendReceive(i32 255)
%2 = call i32 @spiSendReceive(i32 255)
%3 = call i32 @spiSendReceive(i32 255)
%4 = call i32 @spiSendReceive(i32 255)
ret void
}

LLVM IR (-O2):
define void @endFrame() {
%1 = tail call i32 @spiSendReceive(i32 255)
%2 = tail call i32 @spiSendReceive(i32 255)
%3 = tail call i32 @spiSendReceive(i32 255)
%4 = tail call i32 @spiSendReceive(i32 255)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
void version() {
  fprintf(stdout,
          "jsoncat version "
          "\x1b[37m"
          "%s\n"
          "\x1b[0m",
          "0.7.2");
}


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

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

LLVM IR (-O0):
@stdout = global i32 0
@.str = [29 x i8] c"jsoncat version \1B[37m%s\0A\1B[0m\00"
@.str.1 = [6 x i8] c"0.7.2\00"
define void @version() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [29 x i8] c"jsoncat version \1B[37m%s\0A\1B[0m\00"
@.str.1 = [6 x i8] c"0.7.2\00"
define void @version() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _();
void call_() { _(); }


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

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

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

LLVM IR (-O2):
define void @call_() {
%1 = tail call i32 (...) @_()
ret void
}
int node_index(int idx) { return idx % 1024; }


x86 assembly (clang, -O0):
<node_index>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<node_index>:
mov    %edi,%eax
lea    0x3ff(%rax),%ecx
test   %edi,%edi
cmovns %edi,%ecx
and    $0xfffffc00,%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @node_index(i32 %0) {
%2 = srem i32 %0, 1024
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ SSL;

/* Variables and functions */
int select_server_ctx(int /*<<< orphan*/ *, void *, int);
int servername_ignore_cb(SSL *s, int *ad, void *arg) {
  return select_server_ctx(s, arg, 1);
}


x86 assembly (clang, -O0):
<servername_ignore_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1030 <select_server_ctx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<servername_ignore_cb>:
mov    %rdx,%rsi
mov    $0x1,%edx
jmp    1030 <select_server_ctx@plt>

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

LLVM IR (-O2):
define i32 @servername_ignore_cb(i32* %0, i32* nocapture readnone %1, i8* %2) {
%4 = tail call i32 @select_server_ctx(i32* %0, i8* %2, i32 1)
ret i32 %4
}
/* Variables and functions */
int isqrt4(int);
__attribute__((const)) unsigned ihypot(int x, int y) {
  return isqrt4(x * x + y * y);
}


x86 assembly (clang, -O0):
<ihypot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
imul   -0x4(%rbp),%edi
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
add    %eax,%edi
call   1030 <isqrt4@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ihypot>:
imul   %edi,%edi
imul   %esi,%esi
add    %esi,%edi
jmp    1030 <isqrt4@plt>

LLVM IR (-O0):
define i32 @ihypot(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %3
%7 = mul nsw i32 %5, %6
%8 = load i32, i32* %4
%9 = load i32, i32* %4
%10 = mul nsw i32 %8, %9
%11 = add nsw i32 %7, %10
%12 = call i32 @isqrt4(i32 %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @ihypot(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, %0
%4 = mul nsw i32 %1, %1
%5 = add nuw nsw i32 %4, %3
%6 = tail call i32 @isqrt4(i32 %5)
ret i32 %6
}
int fun568() { return 568; }


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

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

LLVM IR (-O0):
define i32 @fun568() {
ret i32 568
}

LLVM IR (-O2):
define i32 @fun568() {
ret i32 568
}
unsigned long long pyr(unsigned long long p) {
  return p * (p + 1) * (p + 2) / 6;
}


x86 assembly (clang, -O0):
<pyr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
add    $0x1,%rcx
imul   %rcx,%rax
mov    -0x8(%rbp),%rcx
add    $0x2,%rcx
imul   %rcx,%rax
mov    $0x6,%ecx
xor    %edx,%edx
div    %rcx
pop    %rbp
ret

x86 assembly (clang, -O2):
<pyr>:
lea    0x1(%rdi),%rcx
imul   %rdi,%rcx
lea    0x2(%rdi),%rax
imul   %rcx,%rax
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
mul    %rcx
mov    %rdx,%rax
shr    $0x2,%rax
ret

LLVM IR (-O0):
define i64 @pyr(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i64, i64* %2
%5 = add i64 %4, 1
%6 = mul i64 %3, %5
%7 = load i64, i64* %2
%8 = add i64 %7, 2
%9 = mul i64 %6, %8
%10 = udiv i64 %9, 6
ret i64 %10
}

LLVM IR (-O2):
define i64 @pyr(i64 %0) {
%2 = add i64 %0, 1
%3 = mul i64 %2, %0
%4 = add i64 %0, 2
%5 = mul i64 %3, %4
%6 = udiv i64 %5, 6
ret i64 %6
}
/* Type definitions */
typedef int __u8;
typedef int __u16;

/* Variables and functions */
__u8 pn_obj(__u16 handle) { return handle & 0xff; }


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

x86 assembly (clang, -O2):
<pn_obj>:
movzbl %dil,%eax
ret

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

LLVM IR (-O2):
define i32 @pn_obj(i32 %0) {
%2 = and i32 %0, 255
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ search_res_name(char const *, char const *);
int sbt_androidxml_get_array_length(const char *file_name,
                                    const char *res_name) {
  search_res_name(file_name, res_name);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @sbt_androidxml_get_array_length(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @search_res_name(i8* %5, i8* %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @sbt_androidxml_get_array_length(i8* %0, i8* %1) {
%3 = tail call i32 @search_res_name(i8* %0, i8* %1)
ret i32 0
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
scalar_t__ bind(int, struct sockaddr const *, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void Bind(int fd, const struct sockaddr *sa, socklen_t salen) {
  if (bind(fd, sa, salen) < 0) {
    perror("bind error");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<Bind>:
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 <bind@plt>
cmp    $0x0,%rax
jge    1171 <Bind+0x41>
lea    0xe9e(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bind>:
push   %rax
call   1030 <bind@plt>
test   %rax,%rax
js     113d <Bind+0xd>
pop    %rax
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@.str = [11 x i8] c"bind error\00"
define void @Bind(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load %struct.sockaddr*, %struct.sockaddr** %5
%9 = load i32, i32* %6
%10 = call i64 @bind(i32 %7, %struct.sockaddr* %8, i32 %9)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %3
ret void
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [11 x i8] c"bind error\00"
define void @Bind(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = tail call i64 @bind(i32 %0, %struct.sockaddr* %1, i32 %2)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
void leave(int sock) {
  close(sock);
  exit(1);
}


x86 assembly (clang, -O0):
<leave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<leave>:
push   %rax
call   1030 <close@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @leave(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @close(i32 %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @leave(i32 %0) {
%2 = tail call i32 @close(i32 %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
unsigned long fls(unsigned long);
unsigned long __fls(unsigned long word) { return fls(word) - 1; }


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

x86 assembly (clang, -O2):
<__fls>:
push   %rax
call   1030 <fls@plt>
add    $0xffffffffffffffff,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @__fls(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @fls(i64 %3)
%5 = sub i64 %4, 1
ret i64 %5
}

LLVM IR (-O2):
define i64 @__fls(i64 %0) {
%2 = tail call i64 @fls(i64 %0)
%3 = add i64 %2, -1
ret i64 %3
}
float asinf(float x) { return 0.0; }


x86 assembly (clang, -O0):
<asinf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<asinf>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @asinf(float %0) {
%2 = alloca float
store float %0, float* %2
ret float 0.000000e+00
}

LLVM IR (-O2):
define float @asinf(float %0) {
ret float 0.000000e+00
}
void SysCtlLDOConfigSet(unsigned long ulConfig) {

  ;
  (*((volatile unsigned long *)(0x400FE160))) = ulConfig;
}


x86 assembly (clang, -O0):
<SysCtlLDOConfigSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x400fe160,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlLDOConfigSet>:
mov    %rdi,0x400fe160
40
ret

LLVM IR (-O0):
define void @SysCtlLDOConfigSet(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
store volatile i64 %3, i64* inttoptr (i64 1074782560 to i64*)
ret void
}

LLVM IR (-O2):
define void @SysCtlLDOConfigSet(i64 %0) {
store volatile i64 %0, i64* inttoptr (i64 1074782560 to i64*)
ret void
}
unsigned char descale_and_clamp(int x, int shift) {
  __asm__("add %3,%1\n"
          "\tsar %2,%1\n"
          "\tsub $-128,%1\n"
          "\tcmovl %5,%1\n"
          "\tcmpl %4,%1\n"
          "\tcmovg %4,%1\n"
          : "=r"(x)
          : "0"(x), "Ic"((unsigned char)shift), "ir"(1U << (shift - 1)),
            "r"(0xff), "r"(0));
  return x;
}


x86 assembly (clang, -O0):
<descale_and_clamp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    %cl,-0x9(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x9(%rbp),%cl
mov    $0xff,%esi
xor    %edi,%edi
add    %edx,%eax
sar    %cl,%eax
sub    $0xffffff80,%eax
cmovl  %edi,%eax
cmp    %esi,%eax
cmovg  %esi,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<descale_and_clamp>:
lea    -0x1(%rsi),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edi,%eax
mov    $0xff,%r8d
xor    %edi,%edi
mov    %esi,%ecx
add    %edx,%eax
sar    %cl,%eax
sub    $0xffffff80,%eax
cmovl  %edi,%eax
cmp    %r8d,%eax
cmovg  %r8d,%eax
ret

LLVM IR (-O0):
define zeroext i8 @descale_and_clamp(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = trunc i32 %6 to i8
%8 = load i32, i32* %4
%9 = sub nsw i32 %8, 1
%10 = shl i32 1, %9
%11 = call i32 asm "add $3,$1\0A\09sar $2,$1\0A\09sub $$-128,$1\0A\09cmovl $5,$1\0A\09cmpl $4,$1\0A\09cmovg $4,$1\0A", "=r,0,I{cx},ir,r,r,~{dirflag},~{fpsr},~{flags}"(i32 %5, i8 %7, i32 %10, i32 255, i32 0)
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = trunc i32 %12 to i8
ret i8 %13
}

LLVM IR (-O2):
define zeroext i8 @descale_and_clamp(i32 %0, i32 %1) {
%3 = trunc i32 %1 to i8
%4 = add nsw i32 %1, -1
%5 = shl nuw i32 1, %4
%6 = tail call i32 asm "add $3,$1\0A\09sar $2,$1\0A\09sub $$-128,$1\0A\09cmovl $5,$1\0A\09cmpl $4,$1\0A\09cmovg $4,$1\0A", "=r,0,I{cx},ir,r,r,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8 %3, i32 %5, i32 255, i32 0)
%7 = trunc i32 %6 to i8
ret i8 %7
}
int f_blg_cr1(float a1) { return (__builtin_islessgreater(100, a1)); }


x86 assembly (clang, -O0):
<f_blg_cr1>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_blg_cr1>:
xor    %eax,%eax
ucomiss 0xef7(%rip),%xmm0
setne  %al
ret

LLVM IR (-O0):
define i32 @f_blg_cr1(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp one float 1.000000e+02, %3
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @f_blg_cr1(float %0) {
%2 = fcmp one float %0, 1.000000e+02
%3 = zext i1 %2 to i32
ret i32 %3
}
void glmGenerateZeroVector2d(double v[2]) {
  v[0] = 0;
  v[1] = 0;
}


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

x86 assembly (clang, -O2):
<glmGenerateZeroVector2d>:
xorps  %xmm0,%xmm0
movups %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @glmGenerateZeroVector2d(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
store double 0.000000e+00, double* %4
%5 = load double*, double** %2
%6 = getelementptr inbounds double, double* %5, i64 1
store double 0.000000e+00, double* %6
ret void
}

LLVM IR (-O2):
define void @glmGenerateZeroVector2d(double* nocapture writeonly %0) {
%2 = bitcast double* %0 to i8*
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void linenoiseClearScreen(void) { fprintf(stdout, "\x1b[H\x1b[2J"); }


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

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

LLVM IR (-O0):
@stdout = global i32 0
@.str = [8 x i8] c"\1B[H\1B[2J\00"
define void @linenoiseClearScreen() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [8 x i8] c"\1B[H\1B[2J\00"
define void @linenoiseClearScreen() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int fn_sq_ch_68_ch_97_ch_116_ch_97_ch_69_ch_120_ch_97_ch_99_ch_116_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121(
    char const *);
int fn_al_sq_ch_68_ch_97_ch_116_ch_97_ch_69_ch_120_ch_97_ch_99_ch_116_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121(
    const char *text) {
  int pos = 0;
  pos =
      fn_sq_ch_68_ch_97_ch_116_ch_97_ch_69_ch_120_ch_97_ch_99_ch_116_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121(
          text);
  if (pos != -1)
    return pos;
  return -1;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fn_sq_ch_68_ch_97_ch_116_ch_97_ch_69_ch_120_ch_97_ch_99_ch_116_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     1144 <fn_al_sq_ch_68_ch_97_ch_116_ch_97_ch_69_ch_120_ch_97_ch_99_ch_116_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <fn_al_sq_ch_68_ch_97_ch_116_ch_97_ch_69_ch_120_ch_97_ch_99_ch_116_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @fn_al_sq_ch_68_ch_97_ch_116_ch_97_ch_69_ch_120_ch_97_ch_99_ch_116_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121(i8* %0) {
%2 = tail call i32 @fn_sq_ch_68_ch_97_ch_116_ch_97_ch_69_ch_120_ch_97_ch_99_ch_116_ch_67_ch_97_ch_114_ch_100_ch_105_ch_110_ch_97_ch_108_ch_105_ch_116_ch_121(i8* %0)
ret i32 %2
}
/* Variables and functions */
float getRand();
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  float r;
  srand(time(NULL));
  r = getRand();
  printf("%2.f\n", r);
  r = getRand();
  printf("%2.f\n", r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x0,%al
call   1030 <getRand@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <getRand@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1030 <getRand@plt>
lea    0xea3(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <getRand@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%2.f\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call float (...) @getRand()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float %3)
%5 = tail call float (...) @getRand()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float %5)
ret i32 0
}
/* Variables and functions */
int fn_glutGetModifiers();
int glutGetModifiers() { return fn_glutGetModifiers(); }


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

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

LLVM IR (-O0):
define i32 @glutGetModifiers() {
%1 = call i32 (...) @fn_glutGetModifiers()
ret i32 %1
}

LLVM IR (-O2):
define i32 @glutGetModifiers() {
%1 = tail call i32 (...) @fn_glutGetModifiers()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ LogDateTime();
int /*<<< orphan*/ printf(char *, char *, int);
void LogMessage(int status, char *message, int address) {
  LogDateTime();
  if (!status)
    printf("%s on %#02x: error.\n", message, address);
  else
    printf("%s on %#02x: done.\n", message, address);
}


x86 assembly (clang, -O0):
<LogMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1040 <LogDateTime@plt>
cmpl   $0x0,-0x4(%rbp)
jne    115b <LogMessage+0x3b>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
jmp    116e <LogMessage+0x4e>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LogMessage>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <LogDateTime@plt>
test   %ebp,%ebp
lea    0xec4(%rip),%rax
lea    0xed2(%rip),%rdi
cmove  %rax,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"%s on %x: error.\0A\00"
@.str.1 = [20 x i8] c"%s on %x: done.\0A\00"
define void @LogMessage(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 = call i32 (...) @LogDateTime()
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %3
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %12)
br label %18
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = load i32, i32* %6
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %15, i32 %16)
br label %18
18: ; preds = %14, %10
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"%s on %x: error.\0A\00"
@.str.1 = [20 x i8] c"%s on %x: done.\0A\00"
define void @LogMessage(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 (...) @LogDateTime()
%5 = icmp eq i32 %0, 0
%6 = select i1 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0)
%7 = tail call i32 @printf(i8* %6, i8* %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SHM_RND;
scalar_t__ shmat(int, int /*<<< orphan*/, int /*<<< orphan*/);
int IPC_MapShm(int shmhdl, void **mapaddr) {
  void *tempptr = NULL;
  tempptr = (void *)shmat(shmhdl, 0, SHM_RND);
  if ((int)tempptr == -1)
    return -1;
  *mapaddr = tempptr;
  return 0;
}


x86 assembly (clang, -O0):
<IPC_MapShm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <shmat@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    $0xffffffff,%eax
jne    1157 <IPC_MapShm+0x47>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <IPC_MapShm+0x59>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IPC_MapShm>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    0x2eca(%rip),%rax
mov    (%rax),%edx
xor    %ebx,%ebx
xor    %esi,%esi
call   1030 <shmat@plt>
cmp    $0xffffffff,%eax
je     1133 <IPC_MapShm+0x23>
mov    %rax,(%r14)
jmp    1138 <IPC_MapShm+0x28>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@SHM_RND = global i32 0
define i32 @IPC_MapShm(i32 %0, i8** nocapture writeonly %1) {
%3 = load i32, i32* @SHM_RND
%4 = tail call i64 @shmat(i32 %0, i32 0, i32 %3)
%5 = trunc i64 %4 to i32
%6 = icmp eq i32 %5, -1
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = inttoptr i64 %4 to i8*
store i8* %8, i8** %1
br label %9
9: ; preds = %2, %7
%10 = phi i32 [ 0, %7 ], [ -1, %2 ]
ret i32 %10
}
int SND_play(int soundnumber) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @SND_play(i32 %0) {
ret i32 0
}
void moveCursor(int x, int y) {}


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

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

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

LLVM IR (-O2):
define void @moveCursor(i32 %0, i32 %1) {
ret void
}
int y(char *a) {
  char *b = a;
  while (*b != 0) {
    b++;
  }
  return b - a;
}


x86 assembly (clang, -O0):
<y>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1131 <y+0x31>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <y+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @y(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %10, %1
%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 %13
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
br label %5
13: ; preds = %5
%14 = load i8*, i8** %3
%15 = load i8*, i8** %2
%16 = ptrtoint i8* %14 to i64
%17 = ptrtoint i8* %15 to i64
%18 = sub i64 %16, %17
%19 = trunc i64 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @y(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
float _log(double);
float _logf(float x) { return (_log((double)x)); }


x86 assembly (clang, -O0):
<_logf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <_log@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_logf>:
cvtss2sd %xmm0,%xmm0
jmp    1030 <_log@plt>

LLVM IR (-O0):
define float @_logf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = call float @_log(double %4)
ret float %5
}

LLVM IR (-O2):
define float @_logf(float %0) {
%2 = fpext float %0 to double
%3 = tail call float @_log(double %2)
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ shell_killer();
int main(int argc, char **argv) {
  char option;
  option = 's';
  switch (option) {
  case 's':
    shell_killer();
  }
}


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)
movb   $0x73,-0x11(%rbp)
mov    -0x11(%rbp),%al
sub    $0x73,%al
jne    1141 <main+0x31>
jmp    113a <main+0x2a>
mov    $0x0,%al
call   1030 <shell_killer@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 115, i8* %6
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
switch i32 %8, label %11 [
i32 115, label %9
]
9: ; preds = %2
%10 = call i32 (...) @shell_killer()
br label %11
11: ; preds = %9, %2
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @shell_killer()
ret i32 0
}
unsigned long int thread_get_id(void) {
  static unsigned long int counter = 0;
  return ++counter;
}


x86 assembly (clang, -O0):
<thread_get_id>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1d(%rip),%rax
add    $0x1,%rax
mov    %rax,0x2f12(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_get_id>:
mov    0x2f21(%rip),%rax
add    $0x1,%rax
mov    %rax,0x2f16(%rip)
ret

LLVM IR (-O0):
@thread_get_id.counter = internal global i64 0
define i64 @thread_get_id() {
%1 = load i64, i64* @thread_get_id.counter
%2 = add i64 %1, 1
store i64 %2, i64* @thread_get_id.counter
ret i64 %2
}

LLVM IR (-O2):
@thread_get_id.counter = internal unnamed_addr global i64 0
define i64 @thread_get_id() {
%1 = load i64, i64* @thread_get_id.counter
%2 = add i64 %1, 1
store i64 %2, i64* @thread_get_id.counter
ret i64 %2
}