xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int chtype;

/* Variables and functions */
int A_BOLD;
int A_NORMAL;
int COLOR_PAIR(int);
int /*<<< orphan*/ attrset(int);
int rand();
void get_color(void) {
  chtype bold = (rand() % 2) ? A_BOLD : A_NORMAL;
  attrset(COLOR_PAIR(rand() % 8) | bold);
}


x86 assembly (clang, -O0):
<get_color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1161 <get_color+0x31>
mov    0x2e81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    116d <get_color+0x3d>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1030 <COLOR_PAIR@plt>
mov    %eax,%edi
or     -0x4(%rbp),%edi
call   1040 <attrset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_color>:
push   %rbx
xor    %eax,%eax
call   1050 <rand@plt>
test   $0x1,%al
jne    1145 <get_color+0x15>
mov    0x2ea5(%rip),%rax
jmp    114c <get_color+0x1c>
mov    0x2e8c(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1050 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
mov    %eax,%edi
call   1030 <COLOR_PAIR@plt>
or     %eax,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1040 <attrset@plt>

LLVM IR (-O0):
@A_BOLD = global i32 0
@A_NORMAL = global i32 0
define void @get_color() {
%1 = alloca i32
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = load i32, i32* @A_BOLD
br label %9
7: ; preds = %0
%8 = load i32, i32* @A_NORMAL
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ %6, %5 ], [ %8, %7 ]
store i32 %10, i32* %1
%11 = call i32 (...) @rand()
%12 = srem i32 %11, 8
%13 = call i32 @COLOR_PAIR(i32 %12)
%14 = load i32, i32* %1
%15 = or i32 %13, %14
%16 = call i32 @attrset(i32 %15)
ret void
}

LLVM IR (-O2):
@A_BOLD = global i32 0
@A_NORMAL = global i32 0
define void @get_color() {
%1 = tail call i32 (...) @rand()
%2 = and i32 %1, 1
%3 = icmp eq i32 %2, 0
%4 = load i32, i32* @A_BOLD
%5 = load i32, i32* @A_NORMAL
%6 = select i1 %3, i32 %5, i32 %4
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 8
%9 = tail call i32 @COLOR_PAIR(i32 %8)
%10 = or i32 %9, %6
%11 = tail call i32 @attrset(i32 %10)
ret void
}
int main() {
  int ptr = 1;
#pragma omp target map(tofrom : ptr)
  { ptr = 1; }
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
double sqrt(double);
double matCalcLen(double *v) {
  double r;
  r = v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
  return sqrt(r);
}


x86 assembly (clang, -O0):
<matCalcLen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matCalcLen>:
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1141 <matCalcLen+0x31>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @matCalcLen(double* %0) {
%2 = alloca double*
%3 = alloca double
store double* %0, double** %2
%4 = load double*, double** %2
%5 = getelementptr inbounds double, double* %4, i64 0
%6 = load double, double* %5
%7 = load double*, double** %2
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double*, double** %2
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = load double*, double** %2
%14 = getelementptr inbounds double, double* %13, i64 1
%15 = load double, double* %14
%16 = fmul double %12, %15
%17 = call double @llvm.fmuladd.f64(double %6, double %9, double %16)
%18 = load double*, double** %2
%19 = getelementptr inbounds double, double* %18, i64 2
%20 = load double, double* %19
%21 = load double*, double** %2
%22 = getelementptr inbounds double, double* %21, i64 2
%23 = load double, double* %22
%24 = call double @llvm.fmuladd.f64(double %20, double %23, double %17)
store double %24, double* %3
%25 = load double, double* %3
%26 = call double @sqrt(double %25)
ret double %26
}

LLVM IR (-O2):
define double @matCalcLen(double* nocapture %0) {
%2 = load double, double* %0
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = fmul double %4, %4
%6 = tail call double @llvm.fmuladd.f64(double %2, double %2, double %5)
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = tail call double @llvm.fmuladd.f64(double %8, double %8, double %6)
%10 = tail call double @sqrt(double %9)
ret double %10
}
/* Type definitions */
struct SN_env {
  int dummy;
};

/* Variables and functions */
struct SN_env *SN_create_env(int /*<<< orphan*/, int, int);
extern struct SN_env *english_ISO_8859_1_create_env(void) {
  return SN_create_env(0, 2, 1);
}


x86 assembly (clang, -O0):
<english_ISO_8859_1_create_env>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <SN_create_env@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<english_ISO_8859_1_create_env>:
xor    %edi,%edi
mov    $0x2,%esi
mov    $0x1,%edx
jmp    1030 <SN_create_env@plt>

LLVM IR (-O0):
%struct.SN_env = type { i32 }
define %struct.SN_env* @english_ISO_8859_1_create_env() {
%1 = call %struct.SN_env* @SN_create_env(i32 0, i32 2, i32 1)
ret %struct.SN_env* %1
}

LLVM IR (-O2):
%struct.SN_env = type { i32 }
define %struct.SN_env* @english_ISO_8859_1_create_env() {
%1 = tail call %struct.SN_env* @SN_create_env(i32 0, i32 2, i32 1)
ret %struct.SN_env* %1
}
void vy86pid_reset(void) {}


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

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

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

LLVM IR (-O2):
define void @vy86pid_reset() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  char *msg;
  msg = "STDOUT TEST";
  write(STDOUT_FILENO, msg, strlen(msg));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2ea8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ec5(%rip),%rax
mov    (%rax),%ebx
lea    0xecc(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"STDOUT TEST\00"
@STDOUT_FILENO = global i32 0
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* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i32, i32* @STDOUT_FILENO
%8 = load i8*, i8** %6
%9 = load i8*, i8** %6
%10 = call i32 @strlen(i8* %9)
%11 = call i32 @write(i32 %7, i8* %8, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"STDOUT TEST\00"
@STDOUT_FILENO = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @STDOUT_FILENO
%4 = tail call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @write(i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
void lcd_swapBuffers(void) { return; }


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

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

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

LLVM IR (-O2):
define void @lcd_swapBuffers() {
ret void
}
void test_builtin_cimagf(_Complex float f) {
  if (__builtin_cimagf(f) != __builtin_cimagf(f))
    link_failure_builtin_cimagf();
}


x86 assembly (clang, -O0):
<test_builtin_cimagf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movlpd %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x4(%rbp),%xmm0
jne    1137 <test_builtin_cimagf+0x27>
jp     1137 <test_builtin_cimagf+0x27>
jmp    113e <test_builtin_cimagf+0x2e>
mov    $0x0,%al
call   1030 <link_failure_builtin_cimagf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_builtin_cimagf>:
shufps $0x55,%xmm0,%xmm0
ucomiss %xmm0,%xmm0
jp     111a <test_builtin_cimagf+0xa>
ret
xor    %eax,%eax
jmp    1030 <link_failure_builtin_cimagf@plt>

LLVM IR (-O0):
define void @test_builtin_cimagf(<2 x float> %0) {
%2 = alloca { float, float }
%3 = bitcast { float, float }* %2 to <2 x float>*
store <2 x float> %0, <2 x float>* %3
%4 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 0
%5 = load float, float* %4
%6 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 1
%7 = load float, float* %6
%8 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 0
%9 = load float, float* %8
%10 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 1
%11 = load float, float* %10
%12 = fcmp une float %7, %11
br i1 %12, label %13, label %15
13: ; preds = %1
%14 = call i32 (...) @link_failure_builtin_cimagf()
br label %15
15: ; preds = %13, %1
ret void
}

LLVM IR (-O2):
define void @test_builtin_cimagf(<2 x float> %0) {
%2 = extractelement <2 x float> %0, i64 1
%3 = fcmp uno float %2, 0.000000e+00
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @link_failure_builtin_cimagf()
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
unsigned int embedded_prints(char *, int /*<<< orphan*/, int /*<<< orphan*/);
unsigned int print_string(char *string) {
  return embedded_prints(string, 0, 0);
}


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

x86 assembly (clang, -O2):
<print_string>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <embedded_prints@plt>

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

LLVM IR (-O2):
define i32 @print_string(i8* %0) {
%2 = tail call i32 @embedded_prints(i8* %0, i32 0, i32 0)
ret i32 %2
}
/* Variables and functions */
int *malloc(int);
void f2() {
  int *p = malloc(12);
  p[3] = 4;
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x4,0xc(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
mov    $0xc,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define void @f2() {
%1 = alloca i32*
%2 = call i32* @malloc(i32 12)
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = getelementptr inbounds i32, i32* %3, i64 3
store i32 4, i32* %4
ret void
}

LLVM IR (-O2):
define void @f2() {
%1 = tail call i32* @malloc(i32 12)
ret void
}
char *test(char str[]) { return str; }


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

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

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

LLVM IR (-O2):
define i8* @test(i8* readnone returned %0) {
ret i8* %0
}
double secondsToJiffies(double seconds) { return seconds * 32768.0; }


x86 assembly (clang, -O0):
<secondsToJiffies>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @secondsToJiffies(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 3.276800e+04
ret double %4
}

LLVM IR (-O2):
define double @secondsToJiffies(double %0) {
%2 = fmul double %0, 3.276800e+04
ret double %2
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint64_t;

/* Variables and functions */
uint64_t load48(const void *src) {
  const uint8_t *p = (const uint8_t *)src;
  return ((uint64_t)(p[0]) << 0) | ((uint64_t)(p[1]) << 8) |
         ((uint64_t)(p[2]) << 16) | ((uint64_t)(p[3]) << 24) |
         ((uint64_t)(p[4]) << 32) | ((uint64_t)(p[5]) << 40);
}


x86 assembly (clang, -O0):
<load48>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
shl    $0x0,%eax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x10(%rcx),%rcx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x18(%rcx),%rcx
shl    $0x18,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x20(%rcx),%rcx
mov    %ecx,%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x28(%rcx),%rcx
mov    %ecx,%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @load48(i8* %0) {
%2 = alloca i8*
%3 = alloca i64*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i64*
store i64* %5, i64** %3
%6 = load i64*, i64** %3
%7 = getelementptr inbounds i64, i64* %6, i64 0
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i32
%10 = shl i32 %9, 0
%11 = load i64*, i64** %3
%12 = getelementptr inbounds i64, i64* %11, i64 1
%13 = load i64, i64* %12
%14 = trunc i64 %13 to i32
%15 = shl i32 %14, 8
%16 = or i32 %10, %15
%17 = load i64*, i64** %3
%18 = getelementptr inbounds i64, i64* %17, i64 2
%19 = load i64, i64* %18
%20 = trunc i64 %19 to i32
%21 = shl i32 %20, 16
%22 = or i32 %16, %21
%23 = load i64*, i64** %3
%24 = getelementptr inbounds i64, i64* %23, i64 3
%25 = load i64, i64* %24
%26 = trunc i64 %25 to i32
%27 = shl i32 %26, 24
%28 = or i32 %22, %27
%29 = load i64*, i64** %3
%30 = getelementptr inbounds i64, i64* %29, i64 4
%31 = load i64, i64* %30
%32 = trunc i64 %31 to i32
%33 = shl i32 %32, 32
%34 = or i32 %28, %33
%35 = load i64*, i64** %3
%36 = getelementptr inbounds i64, i64* %35, i64 5
%37 = load i64, i64* %36
%38 = trunc i64 %37 to i32
%39 = shl i32 %38, 40
%40 = or i32 %34, %39
ret i32 %40
}

LLVM IR (-O2):
define i32 @load48(i8* nocapture readnone %0) {
ret i32 poison
}
void pcp_print_io_stats(struct activity *a, int curr) {}


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

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

LLVM IR (-O0):
%struct.activity = type opaque
define void @pcp_print_io_stats(%struct.activity* %0, i32 %1) {
%3 = alloca %struct.activity*
%4 = alloca i32
store %struct.activity* %0, %struct.activity** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
%struct.activity = type opaque
define void @pcp_print_io_stats(%struct.activity* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test3() { printf("hello from test3 !\n"); }


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [20 x i8] c"hello from test3 !\0A\00"
define void @test3() {
%1 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [19 x i8] c"hello from test3 !\00"
define void @test3() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret void
}
int foo(int ParmN) {
  int a = 3;
  int b = 2;
  int d = -5;
  while (a) {
    b += 25;
    a += b;
    for (d = -5; d < 0; d++) {
      a += ParmN;
    }
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
movl   $0xfffffffb,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1165 <foo+0x65>
mov    -0x10(%rbp),%eax
add    $0x19,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0xfffffffb,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1160 <foo+0x60>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113f <foo+0x3f>
jmp    111c <foo+0x1c>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int snprintf(char *, int const, char *, char *, char *);
int handle_kick(char *channel, char *params, char *mesg, const int mesg_len) {
  return (*params)
             ? snprintf(mesg, mesg_len, "KICK %s %s\r\n", channel, params + 1)
             : 0;
}


x86 assembly (clang, -O0):
<handle_kick>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115e <handle_kick+0x4e>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
add    $0x1,%r8
lea    0xeaf(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x20(%rbp)
jmp    1168 <handle_kick+0x58>
xor    %eax,%eax
mov    %eax,-0x20(%rbp)
jmp    1168 <handle_kick+0x58>
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_kick>:
cmpb   $0x0,(%rsi)
je     1136 <handle_kick+0x26>
mov    %rsi,%r8
mov    %rdi,%rax
add    $0x1,%r8
lea    0xeda(%rip),%r9
mov    %rdx,%rdi
mov    %ecx,%esi
mov    %r9,%rdx
mov    %rax,%rcx
jmp    1030 <snprintf@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"KICK %s %s\0D\0A\00"
define i32 @handle_kick(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %1, i64 1
%9 = tail call i32 @snprintf(i8* %2, i32 %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %8)
br label %10
10: ; preds = %4, %7
%11 = phi i32 [ %9, %7 ], [ 0, %4 ]
ret i32 %11
}
/* Variables and functions */
char const *cgi_getnentrytype(char const *, int /*<<< orphan*/);
const char *cgi_getentrytype(const char *field_name) {
  return cgi_getnentrytype(field_name, 0);
}


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

x86 assembly (clang, -O2):
<cgi_getentrytype>:
xor    %esi,%esi
jmp    1030 <cgi_getnentrytype@plt>

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

LLVM IR (-O2):
define i8* @cgi_getentrytype(i8* %0) {
%2 = tail call i8* @cgi_getnentrytype(i8* %0, i32 0)
ret i8* %2
}
/* Variables and functions */
long long PAPI_get_real_nsec();
void papif_get_real_nsec(long long *time) { *time = PAPI_get_real_nsec(); }


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

x86 assembly (clang, -O2):
<papif_get_real_nsec>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <PAPI_get_real_nsec@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @papif_get_real_nsec(i64* nocapture writeonly %0) {
%2 = tail call i64 (...) @PAPI_get_real_nsec()
store i64 %2, i64* %0
ret void
}
int item_comp(void *unused, const void *k1, const void *k2) {
  int n1 = *((int *)k1), n2 = *((int *)k2);
  (void)unused;
  return n1 < n2 ? -1 : n1 != n2 ? +1 : 0;
}


x86 assembly (clang, -O0):
<item_comp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    113b <item_comp+0x3b>
mov    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1150 <item_comp+0x50>
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmovne %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<item_comp>:
mov    (%rsi),%eax
xor    %ecx,%ecx
cmp    (%rdx),%eax
setne  %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

LLVM IR (-O0):
define i32 @item_comp(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %5
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
store i32 %11, i32* %7
%12 = load i8*, i8** %6
%13 = bitcast i8* %12 to i32*
%14 = load i32, i32* %13
store i32 %14, i32* %8
%15 = load i8*, i8** %4
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %20
19: ; preds = %3
br label %26
20: ; preds = %3
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = icmp ne i32 %21, %22
%24 = zext i1 %23 to i64
%25 = select i1 %23, i32 1, i32 0
br label %26
26: ; preds = %20, %19
%27 = phi i32 [ -1, %19 ], [ %25, %20 ]
ret i32 %27
}

LLVM IR (-O2):
define i32 @item_comp(i8* nocapture readnone %0, i8* nocapture %1, i8* nocapture %2) {
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %4
%6 = bitcast i8* %2 to i32*
%7 = load i32, i32* %6
%8 = icmp slt i32 %5, %7
%9 = icmp ne i32 %5, %7
%10 = zext i1 %9 to i32
%11 = select i1 %8, i32 -1, i32 %10
ret i32 %11
}
void cube(double (*fun)(double), double x, double *result) {
  double y;
  y = (*fun)(x);
  *result = y * y * y;
  return;
}


x86 assembly (clang, -O0):
<cube>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
call   *%rax
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cube>:
push   %rbx
mov    %rsi,%rbx
call   *%rdi
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @cube(double (double)* %0, double %1, double* %2) {
%4 = alloca double (double)*
%5 = alloca double
%6 = alloca double*
%7 = alloca double
store double (double)* %0, double (double)** %4
store double %1, double* %5
store double* %2, double** %6
%8 = load double (double)*, double (double)** %4
%9 = load double, double* %5
%10 = call double %8(double %9)
store double %10, double* %7
%11 = load double, double* %7
%12 = load double, double* %7
%13 = fmul double %11, %12
%14 = load double, double* %7
%15 = fmul double %13, %14
%16 = load double*, double** %6
store double %15, double* %16
ret void
}

LLVM IR (-O2):
define void @cube(double (double)* nocapture %0, double %1, double* nocapture writeonly %2) {
%4 = tail call double %0(double %1)
%5 = fmul double %4, %4
%6 = fmul double %4, %5
store double %6, double* %2
ret void
}
/* Variables and functions */
float M_PI;
float Point_toRadians(float deg) { return (float)deg * M_PI / 180.0; }


x86 assembly (clang, -O0):
<Point_toRadians>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mov    0x2ed3(%rip),%rax
mulss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xedb(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Point_toRadians>:
mov    0x2ee1(%rip),%rax
mulss  (%rax),%xmm0
divss  0xeed(%rip),%xmm0
ret

LLVM IR (-O0):
@M_PI = global float 0.000000e+00
define float @Point_toRadians(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* @M_PI
%5 = fmul float %3, %4
%6 = fpext float %5 to double
%7 = fdiv double %6, 1.800000e+02
%8 = fptrunc double %7 to float
ret float %8
}

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
define float @Point_toRadians(float %0) {
%2 = load float, float* @M_PI
%3 = fmul float %2, %0
%4 = fdiv float %3, 1.800000e+02
ret float %4
}
/* Variables and functions */
int optind;
const char *get_argv_argument(int argc, char *const argv[]) {
  char *arg;
  if (optind >= argc)
    return NULL;
  arg = argv[optind];
  if (*arg == '-')
    return NULL;
  optind++;
  return arg;
}


x86 assembly (clang, -O0):
<get_argv_argument>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2ed6(%rip),%rax
mov    (%rax),%eax
cmp    -0xc(%rbp),%eax
jl     112a <get_argv_argument+0x2a>
movq   $0x0,-0x8(%rbp)
jmp    117a <get_argv_argument+0x7a>
mov    -0x18(%rbp),%rax
mov    0x2eb3(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    115d <get_argv_argument+0x5d>
movq   $0x0,-0x8(%rbp)
jmp    117a <get_argv_argument+0x7a>
mov    0x2e84(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    0x2e78(%rip),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_argv_argument>:
mov    0x2ee1(%rip),%rcx
movslq (%rcx),%rdx
cmp    %edi,%edx
jge    1117 <get_argv_argument+0x17>
mov    (%rsi,%rdx,8),%rax
cmpb   $0x2d,(%rax)
jne    111a <get_argv_argument+0x1a>
xor    %eax,%eax
ret
add    $0x1,%edx
mov    %edx,(%rcx)
ret

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

LLVM IR (-O2):
@optind = global i32 0
define i8* @get_argv_argument(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @optind
%4 = icmp slt i32 %3, %0
br i1 %4, label %5, label %13
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds i8*, i8** %1, i64 %6
%8 = load i8*, i8** %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 45
br i1 %10, label %13, label %11
11: ; preds = %5
%12 = add nsw i32 %3, 1
store i32 %12, i32* @optind
br label %13
13: ; preds = %5, %2, %11
%14 = phi i8* [ %8, %11 ], [ null, %2 ], [ null, %5 ]
ret i8* %14
}
OP(fd, b1) {
  illegal_1();
  op_b1();
}


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <illegal_1@plt>
mov    $0x0,%al
call   1040 <op_b1@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @OP(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = call i32 (...) @illegal_1()
%7 = call i32 (...) @op_b1()
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_1()
%4 = tail call i32 (...) @op_b1()
ret i32 undef
}
OP(op, c7) { RST(0x00); }


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %edi,%edi
mov    $0x0,%al
call   1030 <RST@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OP>:
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <RST@plt>

LLVM IR (-O0):
define i32 @OP(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = call i32 (i32, ...) bitcast (i32 (...)* @RST to i32 (i32, ...)*)(i32 0)
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @RST to i32 (i32, ...)*)(i32 0)
ret i32 undef
}
double fmod(double x, double div) { return __builtin_fmod(x, div); }


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

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

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

LLVM IR (-O2):
define double @fmod(double %0, double %1) {
br label %3
3: ; preds = %3, %2
br label %3
}
void extern_notused() {}


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

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

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

LLVM IR (-O2):
define void @extern_notused() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
void *sstk(int increment) {
  __set_errno(ENOSYS);
  return (void *)-1;
}


x86 assembly (clang, -O0):
<sstk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffffffffffff,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sstk>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffffffffffff,%rax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i8* @sstk(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @ENOSYS
%4 = call i32 @__set_errno(i32 %3)
ret i8* inttoptr (i64 -1 to i8*)
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i8* @sstk(i32 %0) {
%2 = load i32, i32* @ENOSYS
%3 = tail call i32 @__set_errno(i32 %2)
ret i8* inttoptr (i64 -1 to i8*)
}
unsigned FUZ_rand(unsigned *src) {
  static const unsigned prime1 = 2654435761U;
  static const unsigned prime2 = 2246822519U;
  *src = ((*src) * prime1) + prime2;
  return (*src) >> 11;
}


x86 assembly (clang, -O0):
<FUZ_rand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x9e3779b1,(%rax),%ecx
add    $0x85ebca77,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shr    $0xb,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FUZ_rand>:
imul   $0x9e3779b1,(%rdi),%eax
add    $0x85ebca77,%eax
mov    %eax,(%rdi)
shr    $0xb,%eax
ret

LLVM IR (-O0):
@FUZ_rand.prime1 = internal constant i32 -1640531535
@FUZ_rand.prime2 = internal constant i32 -2048144777
define i32 @FUZ_rand(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = mul i32 %4, -1640531535
%6 = add i32 %5, -2048144777
%7 = load i32*, i32** %2
store i32 %6, i32* %7
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
%10 = lshr i32 %9, 11
ret i32 %10
}

LLVM IR (-O2):
define i32 @FUZ_rand(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = mul i32 %2, -1640531535
%4 = add i32 %3, -2048144777
store i32 %4, i32* %0
%5 = lshr i32 %4, 11
ret i32 %5
}
int f3(void) {
  int i;
  int *p = &i;
  if (*p > 0)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jle    1125 <f3+0x25>
movl   $0x0,-0x4(%rbp)
jmp    112c <f3+0x2c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @f3() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int test_bit_parity(int);
int main() {
  int r0, r1;
  r0 = test_bit_parity(699050);
  assert(r0 == 0);
  r1 = test_bit_parity(699050 + 1);
  assert(r1 == 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xaaaaa,%edi
call   1030 <test_bit_parity@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0xaaaab,%edi
call   1030 <test_bit_parity@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xaaaaa,%edi
call   1030 <test_bit_parity@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    $0xaaaab,%edi
call   1030 <test_bit_parity@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @test_bit_parity(i32 699050)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = call i32 @test_bit_parity(i32 699051)
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 1
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test_bit_parity(i32 699050)
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @test_bit_parity(i32 699051)
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
ret i32 0
}
long FindBucket(long size) {
  long bucket;
  if (size > (1 << (16 - 1)))
    bucket = 16;
  else {
    bucket = 1;
    while (1 << bucket < size)
      bucket++;
  }
  return (bucket);
}


x86 assembly (clang, -O0):
<FindBucket>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x8000,-0x8(%rbp)
jle    1123 <FindBucket+0x23>
movq   $0x10,-0x10(%rbp)
jmp    115a <FindBucket+0x5a>
movq   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
cmp    -0x8(%rbp),%rax
jge    1155 <FindBucket+0x55>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112b <FindBucket+0x2b>
jmp    115a <FindBucket+0x5a>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FindBucket>:
mov    $0x10,%ecx
cmp    $0x8000,%rdi
jg     1122 <FindBucket+0x22>
xor    %ecx,%ecx
add    $0x1,%rcx
mov    $0x1,%eax
shl    %cl,%eax
cltq
cmp    %rdi,%rax
jl     1110 <FindBucket+0x10>
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @FindBucket(i64 %0) {
%2 = icmp sgt i64 %0, 32768
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %9, %3 ], [ 1, %1 ]
%5 = trunc i64 %4 to i32
%6 = shl nuw i32 1, %5
%7 = sext i32 %6 to i64
%8 = icmp slt i64 %7, %0
%9 = add nuw nsw i64 %4, 1
br i1 %8, label %3, label %10
10: ; preds = %3, %1
%11 = phi i64 [ 16, %1 ], [ %4, %3 ]
ret i64 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_max_epi16(int /*<<< orphan*/, int /*<<< orphan*/);
__m128i test_mm_max_epi16(__m128i A, __m128i B) { return _mm_max_epi16(A, B); }


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

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

LLVM IR (-O0):
define i32 @test_mm_max_epi16(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 = call i32 @_mm_max_epi16(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_mm_max_epi16(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_max_epi16(i32 %0, i32 %1)
ret i32 %3
}
void decrypt(char *message) {
  char c;
  while (*message) {
    *message = *message ^ 31;
    message++;
  }
}


x86 assembly (clang, -O0):
<decrypt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1138 <decrypt+0x38>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
xor    $0x1f,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <decrypt+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<decrypt>:
mov    (%rdi),%al
test   %al,%al
je     1120 <decrypt+0x20>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
xor    $0x1f,%al
mov    %al,-0x1(%rdi)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <decrypt+0x10>
ret

LLVM IR (-O0):
define void @decrypt(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
br label %4
4: ; preds = %8, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = xor i32 %11, 31
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %2
store i8 %13, i8* %14
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %2
br label %4
17: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @decrypt(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = xor i8 %5, 31
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ add_all_courses();
int /*<<< orphan*/ add_all_departments();
int /*<<< orphan*/ add_all_professors();
void generate_data() {
  add_all_professors();
  add_all_departments();
  add_all_courses();
}


x86 assembly (clang, -O0):
<generate_data>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <add_all_professors@plt>
mov    $0x0,%al
call   1030 <add_all_departments@plt>
mov    $0x0,%al
call   1040 <add_all_courses@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_data>:
push   %rax
xor    %eax,%eax
call   1050 <add_all_professors@plt>
xor    %eax,%eax
call   1030 <add_all_departments@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <add_all_courses@plt>

LLVM IR (-O0):
define void @generate_data() {
%1 = call i32 (...) @add_all_professors()
%2 = call i32 (...) @add_all_departments()
%3 = call i32 (...) @add_all_courses()
ret void
}

LLVM IR (-O2):
define void @generate_data() {
%1 = tail call i32 (...) @add_all_professors()
%2 = tail call i32 (...) @add_all_departments()
%3 = tail call i32 (...) @add_all_courses()
ret void
}
float oblicz_d(int a, int b, int c) { return b * b - 4 * a * c; }


x86 assembly (clang, -O0):
<oblicz_d>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
imul   -0xc(%rbp),%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<oblicz_d>:
imul   %esi,%esi
imul   %edx,%edi
shl    $0x2,%edi
sub    %edi,%esi
cvtsi2ss %esi,%xmm0
ret

LLVM IR (-O0):
define float @oblicz_d(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %5
%9 = mul nsw i32 %7, %8
%10 = load i32, i32* %4
%11 = mul nsw i32 4, %10
%12 = load i32, i32* %6
%13 = mul nsw i32 %11, %12
%14 = sub nsw i32 %9, %13
%15 = sitofp i32 %14 to float
ret float %15
}

LLVM IR (-O2):
define float @oblicz_d(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %1, %1
%5 = mul i32 %0, -4
%6 = mul i32 %5, %2
%7 = add i32 %6, %4
%8 = sitofp i32 %7 to float
ret float %8
}
/* Variables and functions */
double Vwca(double);
double Vwca_prime(double);
double exp(double);
double fp_wca(double r, double T) {
  return exp(-Vwca(r) / T) * (-Vwca_prime(r) / T);
}


x86 assembly (clang, -O0):
<fp_wca>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <Vwca@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x10(%rbp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <Vwca_prime@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
divsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fp_wca>:
sub    $0x18,%rsp
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x10(%rsp)
call   1030 <Vwca@plt>
xorpd  0xeb4(%rip),%xmm0
divsd  (%rsp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <Vwca_prime@plt>
xorpd  0xe91(%rip),%xmm0
divsd  (%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @fp_wca(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = call double @Vwca(double %5)
%7 = fneg double %6
%8 = load double, double* %4
%9 = fdiv double %7, %8
%10 = call double @exp(double %9)
%11 = load double, double* %3
%12 = call double @Vwca_prime(double %11)
%13 = fneg double %12
%14 = load double, double* %4
%15 = fdiv double %13, %14
%16 = fmul double %10, %15
ret double %16
}

LLVM IR (-O2):
define double @fp_wca(double %0, double %1) {
%3 = tail call double @Vwca(double %0)
%4 = fneg double %3
%5 = fdiv double %4, %1
%6 = tail call double @exp(double %5)
%7 = tail call double @Vwca_prime(double %0)
%8 = fneg double %7
%9 = fdiv double %8, %1
%10 = fmul double %6, %9
ret double %10
}
/* Variables and functions */
__attribute__((__const__)) bool utf8_is_control(int c) {
  return ((unsigned int)c < 0x1Fu) || (c >= 0x7F && c <= 0x9F);
}


x86 assembly (clang, -O0):
<utf8_is_control>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x1f,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jb     1138 <utf8_is_control+0x38>
xor    %eax,%eax
cmpl   $0x7f,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     1132 <utf8_is_control+0x32>
cmpl   $0x9f,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8_is_control>:
cmp    $0x1f,%edi
setb   %al
add    $0xffffff81,%edi
cmp    $0x21,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @utf8_is_control(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ult i32 %3, 31
br i1 %4, label %13, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 127
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 159
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ false, %5 ], [ %10, %8 ]
br label %13
13: ; preds = %11, %1
%14 = phi i1 [ true, %1 ], [ %12, %11 ]
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @utf8_is_control(i32 %0) {
%2 = icmp ult i32 %0, 31
%3 = add i32 %0, -127
%4 = icmp ult i32 %3, 33
%5 = or i1 %2, %4
%6 = zext i1 %5 to i32
ret i32 %6
}