xunge/DecIR huggingface dataset:
/* Variables and functions */
float RAND_MAX;
scalar_t__ rand();
float helper_random_float_min_max(float f_min, float f_max) {
  float f = (float)rand() / RAND_MAX;
  return f_min + f * (f_max - f_min);
}


x86 assembly (clang, -O0):
<helper_random_float_min_max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2eb3(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
subss  -0x4(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<helper_random_float_min_max>:
push   %rax
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
xorps  %xmm1,%xmm1
cvtsi2ss %rax,%xmm1
mov    0x2eb6(%rip),%rax
divss  (%rax),%xmm1
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm2
subss  %xmm2,%xmm0
mulss  %xmm1,%xmm0
addss  %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global float 0.000000e+00
define float @helper_random_float_min_max(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = call i64 (...) @rand()
%7 = sitofp i64 %6 to float
%8 = load float, float* @RAND_MAX
%9 = fdiv float %7, %8
store float %9, float* %5
%10 = load float, float* %3
%11 = load float, float* %5
%12 = load float, float* %4
%13 = load float, float* %3
%14 = fsub float %12, %13
%15 = call float @llvm.fmuladd.f32(float %11, float %14, float %10)
ret float %15
}

LLVM IR (-O2):
@RAND_MAX = global float 0.000000e+00
define float @helper_random_float_min_max(float %0, float %1) {
%3 = tail call i64 (...) @rand()
%4 = sitofp i64 %3 to float
%5 = load float, float* @RAND_MAX
%6 = fdiv float %4, %5
%7 = fsub float %1, %0
%8 = tail call float @llvm.fmuladd.f32(float %6, float %7, float %0)
ret float %8
}
int bitwidth(int x) {
  int i = 0;
  while (x > 0) {
    x >>= 1;
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<bitwidth>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    112f <bitwidth+0x2f>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <bitwidth+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitwidth>:
xor    %eax,%eax
test   %edi,%edi
jle    111c <bitwidth+0x1c>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
shr    %ecx
add    $0x1,%eax
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <bitwidth+0x10>
ret

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

LLVM IR (-O2):
define i32 @bitwidth(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %5, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ luaL_buffer();
int /*<<< orphan*/ luaL_getsize();
int /*<<< orphan*/ lua_pushlstring(int /*<<< orphan*/, int /*<<< orphan*/);
void closeandpush(void) { lua_pushlstring(luaL_buffer(), luaL_getsize()); }


x86 assembly (clang, -O0):
<closeandpush>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <luaL_buffer@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <luaL_getsize@plt>
mov    -0x4(%rbp),%edi
mov    %eax,%esi
call   1050 <lua_pushlstring@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closeandpush>:
push   %rbx
xor    %eax,%eax
call   1030 <luaL_buffer@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <luaL_getsize@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1050 <lua_pushlstring@plt>

LLVM IR (-O0):
define void @closeandpush() {
%1 = call i32 (...) @luaL_buffer()
%2 = call i32 (...) @luaL_getsize()
%3 = call i32 @lua_pushlstring(i32 %1, i32 %2)
ret void
}

LLVM IR (-O2):
define void @closeandpush() {
%1 = tail call i32 (...) @luaL_buffer()
%2 = tail call i32 (...) @luaL_getsize()
%3 = tail call i32 @lua_pushlstring(i32 %1, i32 %2)
ret void
}
/* Type definitions */
typedef double GLdouble;

/* Variables and functions */
int figureDistCmpZeroSq(GLdouble squaredDistance) {
  return squaredDistance > 0.0001 * 0.0001;
}


x86 assembly (clang, -O0):
<figureDistCmpZeroSq>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<figureDistCmpZeroSq>:
xor    %eax,%eax
ucomisd 0xef6(%rip),%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @figureDistCmpZeroSq(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 1.000000e-08
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @figureDistCmpZeroSq(double %0) {
%2 = fcmp ogt double %0, 1.000000e-08
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void s337_set_data_stream(uint8_t *p_s337, uint8_t i_data_stream) {
  p_s337[4] &= ~0xe0;
  p_s337[4] |= (i_data_stream << 5) & 0xe0;
}


x86 assembly (clang, -O0):
<s337_set_data_stream>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%ecx
and    $0xffffff1f,%ecx
mov    %ecx,0x10(%rax)
mov    -0xc(%rbp),%ecx
shl    $0x5,%ecx
and    $0xe0,%ecx
mov    -0x8(%rbp),%rax
or     0x10(%rax),%ecx
mov    %ecx,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<s337_set_data_stream>:
mov    $0xffffff1f,%eax
and    0x10(%rdi),%eax
shl    $0x5,%esi
movzbl %sil,%ecx
or     %eax,%ecx
mov    %ecx,0x10(%rdi)
ret

LLVM IR (-O0):
define void @s337_set_data_stream(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 = getelementptr inbounds i32, i32* %5, i64 4
%7 = load i32, i32* %6
%8 = and i32 %7, -225
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = shl i32 %9, 5
%11 = and i32 %10, 224
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 4
%14 = load i32, i32* %13
%15 = or i32 %14, %11
store i32 %15, i32* %13
ret void
}

LLVM IR (-O2):
define void @s337_set_data_stream(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 4
%4 = load i32, i32* %3
%5 = and i32 %4, -225
%6 = shl i32 %1, 5
%7 = and i32 %6, 224
%8 = or i32 %5, %7
store i32 %8, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ f(int *);
main() {
  int i = 5;
  f(&i);
  if (i != 4)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <f@plt>
cmpl   $0x4,-0x8(%rbp)
je     1150 <main+0x30>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x5,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1040 <f@plt>
cmpl   $0x4,0x4(%rsp)
jne    113e <main+0x1e>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%3 = call i32 @f(i32* %2)
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 4
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%3 = call i32 @f(i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 4
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
ret i32 0
}
/* Variables and functions */
int emulate_cc();
int /*<<< orphan*/ fini();
int /*<<< orphan*/ init(int, char const **);
int main(int argc_, const char **argv_) {
  int rv;
  init(argc_, argv_);
  rv = emulate_cc();
  fini();
  return rv;
}


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)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <init@plt>
mov    $0x0,%al
call   1050 <emulate_cc@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <fini@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
call   1040 <init@plt>
xor    %eax,%eax
call   1050 <emulate_cc@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <fini@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @init(i32 %7, i8** %8)
%10 = call i32 (...) @emulate_cc()
store i32 %10, i32* %6
%11 = call i32 (...) @fini()
%12 = load i32, i32* %6
ret i32 %12
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @init(i32 %0, i8** %1)
%4 = tail call i32 (...) @emulate_cc()
%5 = tail call i32 (...) @fini()
ret i32 %4
}
void g_path_get_basename() {}


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

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

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

LLVM IR (-O2):
define void @g_path_get_basename() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ aa_endconv_st_be(double *, void *, int);
double aa_endconv_ld_be_d(void *src) {
  double r;
  aa_endconv_st_be(&r, src, sizeof(double));
  return r;
}


x86 assembly (clang, -O0):
<aa_endconv_ld_be_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdi
mov    $0x8,%edx
call   1030 <aa_endconv_st_be@plt>
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aa_endconv_ld_be_d>:
push   %rax
mov    %rdi,%rsi
mov    %rsp,%rdi
mov    $0x8,%edx
call   1030 <aa_endconv_st_be@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @aa_endconv_ld_be_d(i8* %0) {
%2 = alloca i8*
%3 = alloca double
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @aa_endconv_st_be(double* %3, i8* %4, i32 8)
%6 = load double, double* %3
ret double %6
}

LLVM IR (-O2):
define double @aa_endconv_ld_be_d(i8* %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = call i32 @aa_endconv_st_be(double* %2, i8* %0, i32 8)
%5 = load double, double* %2
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0x78() {
  Assert_real((isspace(120) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isspace.c",
              605, ("isspace should be 0 for x"));
}


x86 assembly (clang, -O0):
<t_isspace_0x78>:
push   %rbp
mov    %rsp,%rbp
mov    $0x78,%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x25d,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isspace_0x78>:
push   %rax
mov    $0x78,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x25d,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for x\00"
define void @t_isspace_0x78() {
%1 = call i64 @isspace(i32 120)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 605, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for x\00"
define void @t_isspace_0x78() {
%1 = tail call i64 @isspace(i32 120)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 605, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int env_strequal(char *a, char *b) {
  while ((*a) != '\0') {
    if ((*a) != (*b)) {
      return 0;
    }
    a += 1;
    b += 1;
  }
  return (*b) == '\0';
}


x86 assembly (clang, -O0):
<env_strequal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115b <env_strequal+0x5b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     113e <env_strequal+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    1170 <env_strequal+0x70>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    110c <env_strequal+0xc>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<env_strequal>:
mov    (%rdi),%al
test   %al,%al
je     1123 <env_strequal+0x23>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
cmp    (%rsi),%al
jne    112c <env_strequal+0x2c>
add    $0x1,%rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <env_strequal+0x10>
xor    %eax,%eax
cmpb   $0x0,(%rsi)
sete   %al
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @env_strequal(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %11
%6 = phi i8 [ %14, %11 ], [ %3, %2 ]
%7 = phi i8* [ %13, %11 ], [ %1, %2 ]
%8 = phi i8* [ %12, %11 ], [ %0, %2 ]
%9 = load i8, i8* %7
%10 = icmp eq i8 %6, %9
br i1 %10, label %11, label %21
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %12
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %11, %2
%17 = phi i8* [ %1, %2 ], [ %13, %11 ]
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %5, %16
%22 = phi i32 [ %20, %16 ], [ 0, %5 ]
ret i32 %22
}
int __mg_slot_clear_use(unsigned char *bitmap, int index) {
  bitmap += index >> 3;
  if (*bitmap & (0x80 >> (index % 8)))
    return 0;
  *bitmap |= (0x80 >> (index % 8));
  return 1;
}


x86 assembly (clang, -O0):
<__mg_slot_clear_use>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
sar    $0x3,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
mov    %edx,%ecx
mov    $0x80,%edx
sar    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1159 <__mg_slot_clear_use+0x59>
movl   $0x0,-0x4(%rbp)
jmp    117f <__mg_slot_clear_use+0x7f>
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x80,%edx
sar    %cl,%edx
mov    -0x10(%rbp),%rax
movzbl (%rax),%ecx
or     %edx,%ecx
mov    %cl,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__mg_slot_clear_use>:
mov    %esi,%ecx
mov    %esi,%eax
sar    $0x3,%eax
and    $0x7,%cl
mov    $0x80,%edx
shr    %cl,%edx
movslq %eax,%rcx
movzbl (%rdi,%rcx,1),%esi
xor    %eax,%eax
test   %esi,%edx
je     111f <__mg_slot_clear_use+0x1f>
ret
or     %sil,%dl
mov    %dl,(%rdi,%rcx,1)
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @__mg_slot_clear_use(i8* nocapture %0, i32 %1) {
%3 = ashr i32 %1, 3
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = and i32 %1, 7
%9 = lshr i32 128, %8
%10 = and i32 %9, %7
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = trunc i32 %9 to i8
%14 = or i8 %6, %13
store i8 %14, i8* %5
br label %15
15: ; preds = %2, %12
%16 = phi i32 [ 1, %12 ], [ 0, %2 ]
ret i32 %16
}
/* Variables and functions */
long FD_SETSIZE;
long __NFDBITS;
int /*<<< orphan*/ __chk_fail();
long int __fdelt_chk(long int d) {
  if (d < 0 || d >= FD_SETSIZE)
    __chk_fail();
  return d / __NFDBITS;
}


x86 assembly (clang, -O0):
<__fdelt_chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jl     113b <__fdelt_chk+0x2b>
mov    -0x8(%rbp),%rax
mov    0x2eae(%rip),%rcx
cmp    (%rcx),%rax
jl     1142 <__fdelt_chk+0x32>
mov    $0x0,%al
call   1030 <__chk_fail@plt>
mov    -0x8(%rbp),%rax
mov    0x2e83(%rip),%rcx
cqto
idivq  (%rcx)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fdelt_chk>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
js     1125 <__fdelt_chk+0x15>
mov    0x2ec0(%rip),%rax
cmp    %rbx,(%rax)
jg     112c <__fdelt_chk+0x1c>
xor    %eax,%eax
call   1030 <__chk_fail@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%rcx
mov    %rbx,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     114c <__fdelt_chk+0x3c>
mov    %rbx,%rax
cqto
idiv   %rcx
pop    %rbx
ret
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
pop    %rbx
ret

LLVM IR (-O0):
@FD_SETSIZE = global i64 0
@__NFDBITS = global i64 0
define i64 @__fdelt_chk(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = load i64, i64* %2
%7 = load i64, i64* @FD_SETSIZE
%8 = icmp sge i64 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %5, %1
%10 = call i32 (...) @__chk_fail()
br label %11
11: ; preds = %9, %5
%12 = load i64, i64* %2
%13 = load i64, i64* @__NFDBITS
%14 = sdiv i64 %12, %13
ret i64 %14
}

LLVM IR (-O2):
@FD_SETSIZE = global i64 0
@__NFDBITS = global i64 0
define i64 @__fdelt_chk(i64 %0) {
%2 = icmp sgt i64 %0, -1
%3 = load i64, i64* @FD_SETSIZE
%4 = icmp sgt i64 %3, %0
%5 = select i1 %2, i1 %4, i1 false
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 (...) @__chk_fail()
br label %8
8: ; preds = %1, %6
%9 = load i64, i64* @__NFDBITS
%10 = sdiv i64 %0, %9
ret i64 %10
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
double get_seconds(void) {
  struct timeval t;
  struct timezone z;
  gettimeofday(&t, &z);
  return (double)t.tv_sec + ((double)t.tv_usec / (double)1000000.0);
}


x86 assembly (clang, -O0):
<get_seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
movsd  0xec7(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_seconds>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
divsd  0xec9(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
%struct.timezone = type { i32 }
define double @get_seconds() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %6, %10
ret double %11
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
%struct.timezone = type { i32 }
define double @get_seconds() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%10 = load i64, i64* %9
%11 = sitofp i64 %10 to double
%12 = fdiv double %11, 1.000000e+06
%13 = fadd double %12, %8
ret double %13
}
unsigned int test_qbbc_reg(unsigned int a, unsigned int b, unsigned int val) {
  if (!(val & (1 << 19)))
    return a;
  return b;
}


x86 assembly (clang, -O0):
<test_qbbc_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x80000,%eax
cmp    $0x0,%eax
jne    1129 <test_qbbc_reg+0x29>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    112f <test_qbbc_reg+0x2f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_qbbc_reg>:
mov    %edi,%eax
test   $0x80000,%edx
cmovne %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @test_qbbc_reg(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %2, 524288
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 %0, i32 %1
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ unlink(char *);
void destroyFIFO(char *name) {
  if (unlink(name) < 0)
    printf("\t#ERROR# when destroying counter FIFO '%s'\n", name);
  else if (0)
    printf("\t#FIFO# Counter '%s' has been destroyed\n", name);
}


x86 assembly (clang, -O0):
<destroyFIFO>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <unlink@plt>
cmp    $0x0,%rax
jge    1154 <destroyFIFO+0x34>
mov    -0x8(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1040 <printf@plt>
jmp    1159 <destroyFIFO+0x39>
jmp    1159 <destroyFIFO+0x39>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<destroyFIFO>:
push   %rbx
mov    %rdi,%rbx
call   1030 <unlink@plt>
test   %rax,%rax
js     1130 <destroyFIFO+0x10>
pop    %rbx
ret
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"\09#ERROR# when destroying counter FIFO '%s'\0A\00"
define void @destroyFIFO(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @unlink(i8* %3)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %10
9: ; preds = %1
br label %10
10: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"\09#ERROR# when destroying counter FIFO '%s'\0A\00"
define void @destroyFIFO(i8* %0) {
%2 = tail call i64 @unlink(i8* %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %1, %4
ret void
}
int __fxstatat(int ver, int dirfd, const char *pathname, struct stat *buf,
               int flags) {
  ;
  return -1;
}


x86 assembly (clang, -O0):
<__fxstatat>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.stat = type opaque
define i32 @__fxstatat(i32 %0, i32 %1, i8* %2, %struct.stat* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca %struct.stat*
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store %struct.stat* %3, %struct.stat** %9
store i32 %4, i32* %10
ret i32 -1
}

LLVM IR (-O2):
%struct.stat = type opaque
define i32 @__fxstatat(i32 %0, i32 %1, i8* nocapture readnone %2, %struct.stat* nocapture readnone %3, i32 %4) {
ret i32 -1
}
/* Variables and functions */
int recurse(int);
int test(void) { return (recurse(5)); }


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

x86 assembly (clang, -O2):
<test>:
mov    $0x5,%edi
jmp    1030 <recurse@plt>

LLVM IR (-O0):
define i32 @test() {
%1 = call i32 @recurse(i32 5)
ret i32 %1
}

LLVM IR (-O2):
define i32 @test() {
%1 = tail call i32 @recurse(i32 5)
ret i32 %1
}
__attribute__((no)) unsigned long andc_pp(unsigned long *a, unsigned long *b) {
  return ~*b & *a;
}


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

x86 assembly (clang, -O2):
<andc_pp>:
mov    (%rsi),%rax
not    %rax
and    (%rdi),%rax
ret

LLVM IR (-O0):
define i64 @andc_pp(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
store i64* %0, i64** %3
store i64* %1, i64** %4
%5 = load i64*, i64** %4
%6 = load i64, i64* %5
%7 = xor i64 %6, -1
%8 = load i64*, i64** %3
%9 = load i64, i64* %8
%10 = and i64 %7, %9
ret i64 %10
}

LLVM IR (-O2):
define i64 @andc_pp(i64* nocapture %0, i64* nocapture %1) {
%3 = load i64, i64* %1
%4 = xor i64 %3, -1
%5 = load i64, i64* %0
%6 = and i64 %5, %4
ret i64 %6
}
float mph2kmph(float mph) { return mph * 1.609344f; }


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

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

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

LLVM IR (-O2):
define float @mph2kmph(float %0) {
%2 = fmul float %0, 0x3FF9BFDF80000000
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int PrintHelp(void) {
  fputs("Usage: gt <options> [lines]\n"
        "-c | Number of lines to generate.\n"
        "-f | File to read from.\n"
        "-h | Print this help.\n\n"
        "Example:\n"
        "gt -c 40 -f input.txt\n"
        "This will print input.txt 40 times.\n\n"
        "gt -c 20 'foo bar baz'\n"
        "This will print 'foo bar baz' 20 times. Newlines and such must be "
        "added by shell.\n",
        stderr);
  return 1;
}


x86 assembly (clang, -O0):
<PrintHelp>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintHelp>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [283 x i8] c"Usage: gt <options> [lines]\0A-c | Number of lines to generate.\0A-f | File to read from.\0A-h | Print this help.\0A\0AExample:\0Agt -c 40 -f input.txt\0AThis will print input.txt 40 times.\0A\0Agt -c 20 'foo bar baz'\0AThis will print 'foo bar baz' 20 times. Newlines and such must be added by shell.\0A\00"
@stderr = global i32 0
define i32 @PrintHelp() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([283 x i8], [283 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}

LLVM IR (-O2):
@.str = [283 x i8] c"Usage: gt <options> [lines]\0A-c | Number of lines to generate.\0A-f | File to read from.\0A-h | Print this help.\0A\0AExample:\0Agt -c 40 -f input.txt\0AThis will print input.txt 40 times.\0A\0Agt -c 20 'foo bar baz'\0AThis will print 'foo bar baz' 20 times. Newlines and such must be added by shell.\0A\00"
@stderr = global i32 0
define i32 @PrintHelp() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([283 x i8], [283 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}
unsigned char GetBubbleMaxIndex(unsigned short *src, unsigned char len) {
  while ((len > 1) && (src[len - 1] == 0))
    len--;
  return len - 1;
}


x86 assembly (clang, -O0):
<GetBubbleMaxIndex>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0xa(%rbp)
jle    113b <GetBubbleMaxIndex+0x3b>
mov    -0x8(%rbp),%rax
movzbl -0x9(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movzwl (%rax,%rcx,2),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    114b <GetBubbleMaxIndex+0x4b>
jmp    1158 <GetBubbleMaxIndex+0x58>
mov    -0x9(%rbp),%al
add    $0xff,%al
mov    %al,-0x9(%rbp)
jmp    110e <GetBubbleMaxIndex+0xe>
movzbl -0x9(%rbp),%eax
sub    $0x1,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetBubbleMaxIndex>:
mov    %esi,%eax
cmp    $0x2,%al
jb     1125 <GetBubbleMaxIndex+0x25>
cs nopw 0x0(%rax,%rax,1)
movzbl %al,%ecx
add    $0xffffffff,%ecx
cmpw   $0x0,(%rdi,%rcx,2)
jne    1125 <GetBubbleMaxIndex+0x25>
add    $0xff,%al
cmp    $0x1,%al
ja     1110 <GetBubbleMaxIndex+0x10>
mov    $0x1,%al
add    $0xff,%al
ret

LLVM IR (-O0):
define zeroext i8 @GetBubbleMaxIndex(i16* %0, i8 zeroext %1) {
%3 = alloca i16*
%4 = alloca i8
store i16* %0, i16** %3
store i8 %1, i8* %4
br label %5
5: ; preds = %21, %2
%6 = load i8, i8* %4
%7 = zext i8 %6 to i32
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %19
9: ; preds = %5
%10 = load i16*, i16** %3
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = sub nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i16, i16* %10, i64 %14
%16 = load i16, i16* %15
%17 = zext i16 %16 to i32
%18 = icmp eq i32 %17, 0
br label %19
19: ; preds = %9, %5
%20 = phi i1 [ false, %5 ], [ %18, %9 ]
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = load i8, i8* %4
%23 = add i8 %22, -1
store i8 %23, i8* %4
br label %5
24: ; preds = %19
%25 = load i8, i8* %4
%26 = zext i8 %25 to i32
%27 = sub nsw i32 %26, 1
%28 = trunc i32 %27 to i8
ret i8 %28
}

LLVM IR (-O2):
define zeroext i8 @GetBubbleMaxIndex(i16* nocapture %0, i8 zeroext %1) {
%3 = icmp ugt i8 %1, 1
br i1 %3, label %4, label %15
4: ; preds = %2, %12
%5 = phi i8 [ %13, %12 ], [ %1, %2 ]
%6 = zext i8 %5 to i64
%7 = add nuw nsw i64 %6, 4294967295
%8 = and i64 %7, 4294967295
%9 = getelementptr inbounds i16, i16* %0, i64 %8
%10 = load i16, i16* %9
%11 = icmp eq i16 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = add i8 %5, -1
%14 = icmp ugt i8 %13, 1
br i1 %14, label %4, label %15
15: ; preds = %4, %12, %2
%16 = phi i8 [ %1, %2 ], [ 1, %12 ], [ %5, %4 ]
%17 = add i8 %16, -1
ret i8 %17
}
/* Variables and functions */
int rand();
int ruspma_rand_from_range(int range) { return rand() % range; }


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

x86 assembly (clang, -O2):
<ruspma_rand_from_range>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ruspma_rand_from_range(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @ruspma_rand_from_range(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
ret i32 %3
}
/* Variables and functions */
double cdfStandard(double);
double cdfNormal(double m, double s, double x) {
  double t = (x - m) / s;
  return (cdfStandard(t));
}


x86 assembly (clang, -O0):
<cdfNormal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <cdfStandard@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdfNormal>:
subsd  %xmm0,%xmm2
divsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
jmp    1030 <cdfStandard@plt>

LLVM IR (-O0):
define double @cdfNormal(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %6
%9 = load double, double* %4
%10 = fsub double %8, %9
%11 = load double, double* %5
%12 = fdiv double %10, %11
store double %12, double* %7
%13 = load double, double* %7
%14 = call double @cdfStandard(double %13)
ret double %14
}

LLVM IR (-O2):
define double @cdfNormal(double %0, double %1, double %2) {
%4 = fsub double %2, %0
%5 = fdiv double %4, %1
%6 = tail call double @cdfStandard(double %5)
ret double %6
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ helloWorld();
int main(int argc, char **argv) {
  helloWorld();
  return EXIT_SUCCESS;
}


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)
mov    $0x0,%al
call   1030 <helloWorld@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
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 (...) @helloWorld()
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @helloWorld()
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
void nseel_asm_min_end(void) {}


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

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

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

LLVM IR (-O2):
define void @nseel_asm_min_end() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void *thr_fn2(void *arg) {
  printf("this is thread 2\n");
  return ((void *)2);
}


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

x86 assembly (clang, -O2):
<thr_fn2>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"this is thread 2\0A\00"
define i8* @thr_fn2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret i8* inttoptr (i64 2 to i8*)
}

LLVM IR (-O2):
@str = [17 x i8] c"this is thread 2\00"
define i8* @thr_fn2(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret i8* inttoptr (i64 2 to i8*)
}
/* Variables and functions */
int get_clcadc4(int, int, int *);
int /*<<< orphan*/ printf(char *, int, int, int, int, int);
void print_clcadc4(int a, int b, int mask) {
  int f, r;
  f = get_clcadc4(a, b, &r);
  f &= mask;
  printf("clcadc"
         " 4"
         " %08x %08x %08x %08x %08x\n",
         a, b, r, f, mask);
}


x86 assembly (clang, -O0):
<print_clcadc4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x14(%rbp),%rdx
call   1040 <get_clcadc4@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0xc(%rbp),%r9d
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_clcadc4>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xc(%rsp),%rdx
call   1040 <get_clcadc4@plt>
and    %r14d,%eax
mov    0xc(%rsp),%ecx
lea    0xeb9(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%r8d
mov    %r14d,%r9d
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"clcadc 4 %08x %08x %08x %08x %08x\0A\00"
define void @print_clcadc4(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = call i32 @get_clcadc4(i32 %9, i32 %10, i32* %8)
store i32 %11, i32* %7
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = and i32 %13, %12
store i32 %14, i32* %7
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = load i32, i32* %8
%18 = load i32, i32* %7
%19 = load i32, i32* %6
%20 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16, i32 %17, i32 %18, i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"clcadc 4 %08x %08x %08x %08x %08x\0A\00"
define void @print_clcadc4(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i32 @get_clcadc4(i32 %0, i32 %1, i32* %4)
%7 = and i32 %6, %2
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %8, i32 %7, i32 %2)
ret void
}
/* Variables and functions */
int GetAuidoType(char *, int);
int GuessAuidoType(char *descriptor) {
  int len = (int)descriptor[0];
  return GetAuidoType(descriptor + 1, len);
}


x86 assembly (clang, -O0):
<GuessAuidoType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0xc(%rbp),%esi
call   1030 <GetAuidoType@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GuessAuidoType>:
movsbl (%rdi),%esi
add    $0x1,%rdi
jmp    1030 <GetAuidoType@plt>

LLVM IR (-O0):
define i32 @GuessAuidoType(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
store i32 %7, i32* %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i32, i32* %3
%11 = call i32 @GetAuidoType(i8* %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @GuessAuidoType(i8* %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = tail call i32 @GetAuidoType(i8* %4, i32 %3)
ret i32 %5
}
/* Variables and functions */
void Reserved_Handler3(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<Reserved_Handler3>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <Reserved_Handler3+0x9>
jmp    1109 <Reserved_Handler3+0x9>

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

LLVM IR (-O0):
define void @Reserved_Handler3() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @Reserved_Handler3() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
void int_free_align(int *pA) { free(pA); }


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

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

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

LLVM IR (-O2):
define void @int_free_align(i32* nocapture %0) {
%2 = tail call i32 @free(i32* %0)
ret void
}
void average(int1, int2, int3) {
  int total = int1 + int2 + int3;
  int mean = total / 3;
  printf("The average of these numbers is %d.\n", mean);
}


x86 assembly (clang, -O0):
<average>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<average>:
add    %esi,%edi
add    %edx,%edi
movslq %edi,%rax
imul   $0x55555556,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
shr    $0x20,%rsi
add    %eax,%esi
lea    0xece(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"The average of these numbers is %d.\0A\00"
define void @average(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %6
%13 = add nsw i32 %11, %12
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = sdiv i32 %14, 3
store i32 %15, i32* %8
%16 = load i32, i32* %8
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %16)
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"The average of these numbers is %d.\0A\00"
define void @average(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = add nsw i32 %4, %2
%6 = sdiv i32 %5, 3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ read(int /*<<< orphan*/, char *, int);
void leaveMessage() {
  puts("I only read premium member messages but you can ");
  puts("try anyways:");
  char *msg = (char *)malloc(8);
  read(0, msg, 8);
}


x86 assembly (clang, -O0):
<leaveMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
mov    $0x8,%edx
call   1040 <read@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leaveMessage>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
mov    $0x8,%edi
call   1050 <malloc@plt>
xor    %edi,%edi
mov    %rax,%rsi
mov    $0x8,%edx
pop    %rax
jmp    1040 <read@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"I only read premium member messages but you can \00"
@.str.1 = [13 x i8] c"try anyways:\00"
define void @leaveMessage() {
%1 = alloca i8*
%2 = call i32 @puts(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%4 = call i64 @malloc(i32 8)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @read(i32 0, i8* %6, i32 8)
ret void
}

LLVM IR (-O2):
@.str = [49 x i8] c"I only read premium member messages but you can \00"
@.str.1 = [13 x i8] c"try anyways:\00"
define void @leaveMessage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i64 @malloc(i32 8)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @read(i32 0, i8* %4, i32 8)
ret void
}
int main(void) {
  double io = 4.0;
  __asm__("fsqrt" : "+t"(io) : :);
  assert(io == 2.0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
fldl   -0x18(%rbp)
fsqrt
fstpl  -0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeab(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
flds   0xee9(%rip)
fsqrt
fstpl  (%rsp)
movsd  0xee4(%rip),%xmm0
cmpeqsd (%rsp),%xmm0
movq   %xmm0,%rdi
and    $0x1,%edi
xor    %eax,%eax
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
store double 4.000000e+00, double* %2
%3 = load double, double* %2
%4 = call double asm "fsqrt", "={st},0,~{dirflag},~{fpsr},~{flags}"(double %3)
store double %4, double* %2
%5 = load double, double* %2
%6 = fcmp oeq double %5, 2.000000e+00
%7 = zext i1 %6 to i32
%8 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call double asm "fsqrt", "={st},0,~{dirflag},~{fpsr},~{flags}"(double 4.000000e+00)
%2 = fcmp oeq double %1, 2.000000e+00
%3 = zext i1 %2 to i32
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %3)
ret i32 0
}