xunge/DecIR huggingface dataset:
void ImNumErr(imnumber) int imnumber;
{
  if (imnumber < 0 || imnumber >= 5)
    error("%d is an illegal image number", imnumber);
}


x86 assembly (clang, -O0):
<ImNumErr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     112f <ImNumErr+0x1f>
cmpl   $0x5,-0x4(%rbp)
jl     1140 <ImNumErr+0x30>
mov    -0x4(%rbp),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ImNumErr>:
cmp    $0x5,%edi
jb     1125 <ImNumErr+0x15>
mov    %edi,%esi
lea    0xee2(%rip),%rdi
xor    %eax,%eax
jmp    1030 <error@plt>
ret

LLVM IR (-O0):
@.str = [30 x i8] c"%d is an illegal image number\00"
define void @ImNumErr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 5
br i1 %7, label %8, label %11
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %8, %5
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"%d is an illegal image number\00"
define void @ImNumErr(i32 %0) {
%2 = icmp ugt i32 %0, 4
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %5
5: ; preds = %1, %3
ret void
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int S_ISLNK(int /*<<< orphan*/);
int lstat(char *, struct stat *);
int isLink(char *path) {
  struct stat sbuf;
  int rc = 0;
  rc = lstat(path, &sbuf);
  if (!rc) {
    rc = S_ISLNK(sbuf.st_mode);
  }
  return rc;
}


x86 assembly (clang, -O0):
<isLink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <lstat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1158 <isLink+0x38>
mov    -0x10(%rbp),%edi
call   1030 <S_ISLNK@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLink>:
push   %rax
mov    %rsp,%rsi
call   1040 <lstat@plt>
test   %eax,%eax
je     112f <isLink+0xf>
pop    %rcx
ret
mov    (%rsp),%edi
pop    %rax
jmp    1030 <S_ISLNK@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @isLink(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
%5 = load i8*, i8** %2
%6 = call i32 @lstat(i8* %5, %struct.stat* %3)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @S_ISLNK(i32 %11)
store i32 %12, i32* %4
br label %13
13: ; preds = %9, %1
%14 = load i32, i32* %4
ret i32 %14
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @isLink(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @lstat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i32 @S_ISLNK(i32 %8)
br label %10
10: ; preds = %6, %1
%11 = phi i32 [ %4, %1 ], [ %9, %6 ]
ret i32 %11
}
int main() {
  int a;
  a = 3;
  if (a != 3)
    return 1;
  else
    return 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1128 <main+0x28>
movl   $0x1,-0x4(%rbp)
jmp    112f <main+0x2f>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool errata_31(void) {
  if ((*(uint32_t *)0x10000130ul == 0xAul) &&
      (*(uint32_t *)0x10000134ul == 0x0ul)) {
    return true;
  }
  return true;
}


x86 assembly (clang, -O0):
<errata_31>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10000130,%eax
movslq (%rax),%rax
cmp    $0xa,%rax
jne    1134 <errata_31+0x34>
mov    $0x10000134,%eax
movslq (%rax),%rax
cmp    $0x0,%rax
jne    1134 <errata_31+0x34>
movl   $0x1,-0x4(%rbp)
jmp    113b <errata_31+0x3b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @errata_31() {
%1 = alloca i32
%2 = load i32, i32* inttoptr (i64 268435760 to i32*)
%3 = sext i32 %2 to i64
%4 = icmp eq i64 %3, 10
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = load i32, i32* inttoptr (i64 268435764 to i32*)
%7 = sext i32 %6 to i64
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
store i32 1, i32* %1
br label %11
10: ; preds = %5, %0
store i32 1, i32* %1
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
define i32 @errata_31() {
ret i32 1
}
void Changed(long nSect, int changedType) {}


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

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

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

LLVM IR (-O2):
define void @Changed(i64 %0, i32 %1) {
ret void
}
char fn3(void) { return 'C'; }


x86 assembly (clang, -O0):
<fn3>:
push   %rbp
mov    %rsp,%rbp
mov    $0x43,%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn3>:
mov    $0x43,%al
ret

LLVM IR (-O0):
define signext i8 @fn3() {
ret i8 67
}

LLVM IR (-O2):
define signext i8 @fn3() {
ret i8 67
}
/* Variables and functions */
scalar_t__ sqrt(double);
float norm(float x, float y) { return (float)sqrt((double)(x * x + y * y)); }


x86 assembly (clang, -O0):
<norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <sqrt@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<norm>:
push   %rax
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @norm(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %3
%7 = load float, float* %4
%8 = load float, float* %4
%9 = fmul float %7, %8
%10 = call float @llvm.fmuladd.f32(float %5, float %6, float %9)
%11 = fpext float %10 to double
%12 = call i64 @sqrt(double %11)
%13 = sitofp i64 %12 to float
ret float %13
}

LLVM IR (-O2):
define float @norm(float %0, float %1) {
%3 = fmul float %1, %1
%4 = tail call float @llvm.fmuladd.f32(float %0, float %0, float %3)
%5 = fpext float %4 to double
%6 = tail call i64 @sqrt(double %5)
%7 = sitofp i64 %6 to float
ret float %7
}
/* Variables and functions */
int f(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  printf("\nf(n) = %d\n", f(n));
  printf("function calculates 2^n-1?\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <f@plt>
lea    0xea1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"\0Af(n) = %d\0A\00"
@.str.2 = [28 x i8] c"function calculates 2^n-1?\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = call i32 @f(i32 %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"\0Af(n) = %d\0A\00"
@str = [27 x i8] c"function calculates 2^n-1?\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @f(i32 %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int strlen(char const *);
int null_puts(BIO *bp, const char *str) {
  if (str == NULL)
    return (0);
  return (strlen(str));
}


x86 assembly (clang, -O0):
<null_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1137 <null_puts+0x27>
movl   $0x0,-0x4(%rbp)
jmp    1143 <null_puts+0x33>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<null_puts>:
test   %rsi,%rsi
je     111d <null_puts+0xd>
mov    %rsi,%rdi
jmp    1030 <strlen@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @null_puts(i32* nocapture readnone %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @strlen(i8* %1)
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ %5, %4 ], [ 0, %2 ]
ret i32 %7
}
/* Variables and functions */
double RAND_MAX;
scalar_t__ rand();
double random_number(void) {
  double temp;
  temp = (double)rand() / RAND_MAX;
  return temp;
}


x86 assembly (clang, -O0):
<random_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ebd(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_number>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
divsd  (%rax),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define double @random_number() {
%1 = alloca double
%2 = call i64 (...) @rand()
%3 = sitofp i64 %2 to double
%4 = load double, double* @RAND_MAX
%5 = fdiv double %3, %4
store double %5, double* %1
%6 = load double, double* %1
ret double %6
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define double @random_number() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load double, double* @RAND_MAX
%4 = fdiv double %2, %3
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ tzset();
int hazer_initialize(void) {
  tzset();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @hazer_initialize() {
%1 = tail call i32 (...) @tzset()
ret i32 0
}
void _buttonlight_on(void) {}


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

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

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

LLVM IR (-O2):
define void @_buttonlight_on() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ vwarnx(char const *, int /*<<< orphan*/);
void verrx(int e, const char *f, va_list ap) {
  vwarnx(f, ap);
  exit(e);
}


x86 assembly (clang, -O0):
<verrx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <vwarnx@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<verrx>:
push   %rbx
mov    %edi,%ebx
mov    %rsi,%rdi
mov    %edx,%esi
call   1030 <vwarnx@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @verrx(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = load i32, i32* %6
%9 = call i32 @vwarnx(i8* %7, i32 %8)
%10 = load i32, i32* %4
%11 = call i32 @exit(i32 %10)
unreachable
}

LLVM IR (-O2):
define void @verrx(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @vwarnx(i8* %1, i32 %2)
%5 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ write_imm(int);
int /*<<< orphan*/ write_instr(int);
int tab_handler(char **save) {
  write_instr(0x00);
  write_imm(0x2B);
  write_instr(0x28);
  return 0;
}


x86 assembly (clang, -O0):
<tab_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1040 <write_instr@plt>
mov    $0x2b,%edi
call   1030 <write_imm@plt>
mov    $0x28,%edi
call   1040 <write_instr@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tab_handler>:
push   %rax
xor    %edi,%edi
call   1040 <write_instr@plt>
mov    $0x2b,%edi
call   1030 <write_imm@plt>
mov    $0x28,%edi
call   1040 <write_instr@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @tab_handler(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @write_instr(i32 0)
%4 = call i32 @write_imm(i32 43)
%5 = call i32 @write_instr(i32 40)
ret i32 0
}

LLVM IR (-O2):
define i32 @tab_handler(i8** nocapture readnone %0) {
%2 = tail call i32 @write_instr(i32 0)
%3 = tail call i32 @write_imm(i32 43)
%4 = tail call i32 @write_instr(i32 40)
ret i32 0
}
void NETSCAPE_SPKI_free(void) {}


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

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

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

LLVM IR (-O2):
define void @NETSCAPE_SPKI_free() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void px4_arch_gpiowrite(uint32_t pinset, bool value) {}


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

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

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

LLVM IR (-O2):
define void @px4_arch_gpiowrite(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printHeader() {
  printf("CSCE 1030.001 Program 4 - Ahmad Rashed - arashed31@gmail.com - CSP03 "
         "\n\n");
}


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

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

LLVM IR (-O0):
@.str = [72 x i8] c"CSCE 1030.001 Program 4 - Ahmad Rashed - arashed31@gmail.com - CSP03 \0A\0A\00"
define void @printHeader() {
%1 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [71 x i8] c"CSCE 1030.001 Program 4 - Ahmad Rashed - arashed31@gmail.com - CSP03 \0A\00"
define void @printHeader() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str, i64 0, i64 0))
ret void
}
unsigned int convert_signed_int_to_unsigned_int(signed int x) { return x; }


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

x86 assembly (clang, -O2):
<convert_signed_int_to_unsigned_int>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @convert_signed_int_to_unsigned_int(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void Help() {
  printf("testV4L2FormatTool\n");
  printf("testV4L2FormatTool n     // get format of /dev/videon\n");
}


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

x86 assembly (clang, -O2):
<Help>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeef(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"testV4L2FormatTool\0A\00"
@.str.1 = [55 x i8] c"testV4L2FormatTool n // get format of /dev/videon\0A\00"
define void @Help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [19 x i8] c"testV4L2FormatTool\00"
@str.2 = [54 x i8] c"testV4L2FormatTool n // get format of /dev/videon\00"
define void @Help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.2, i64 0, i64 0))
ret void
}
int test_022(int a, int b, int c, int d) { return (a & 1) + b + b; }


x86 assembly (clang, -O0):
<test_022>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
add    -0x8(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_022>:
and    $0x1,%edi
lea    (%rdi,%rsi,2),%eax
ret

LLVM IR (-O0):
define i32 @test_022(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = and i32 %9, 1
%11 = load i32, i32* %6
%12 = add nsw i32 %10, %11
%13 = load i32, i32* %6
%14 = add nsw i32 %12, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @test_022(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = and i32 %0, 1
%6 = shl i32 %1, 1
%7 = or i32 %6, %5
ret i32 %7
}
void g_datalist_foreach() {}


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

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

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

LLVM IR (-O2):
define void @g_datalist_foreach() {
ret void
}
unsigned char API_frame_length(unsigned char *API_frame) {
  return 4 +
         ((((unsigned int)API_frame[1]) << 8) | ((unsigned int)API_frame[2]));
}


x86 assembly (clang, -O0):
<API_frame_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
or     %ecx,%eax
add    $0x4,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<API_frame_length>:
mov    0x2(%rdi),%al
add    $0x4,%al
ret

LLVM IR (-O0):
define zeroext i8 @API_frame_length(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl i32 %6, 8
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = or i32 %7, %11
%13 = add i32 4, %12
%14 = trunc i32 %13 to i8
ret i8 %14
}

LLVM IR (-O2):
define zeroext i8 @API_frame_length(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 2
%3 = load i8, i8* %2
%4 = add i8 %3, 4
ret i8 %4
}
void SubOscillatorOn(void) {}


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

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

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

LLVM IR (-O2):
define void @SubOscillatorOn() {
ret void
}
void test_non_identifiers() {
  int i, x;
#pragma omp target parallel for simd;
  for (i = 0; i < 16; ++i)
    ;
#pragma omp target parallel for simd private(x);
  for (i = 0; i < 16; ++i)
    ;
#pragma omp target parallel for simd, private(x);
  for (i = 0; i < 16; ++i)
    ;
}


x86 assembly (clang, -O0):
<test_non_identifiers>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1128 <test_non_identifiers+0x28>
jmp    111a <test_non_identifiers+0x1a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <test_non_identifiers+0xb>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    114c <test_non_identifiers+0x4c>
jmp    113e <test_non_identifiers+0x3e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <test_non_identifiers+0x2f>
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1170 <test_non_identifiers+0x70>
jmp    1162 <test_non_identifiers+0x62>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <test_non_identifiers+0x53>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @test_non_identifiers() {
ret void
}
void pthread_mutexattr_gettype() {}


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

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

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

LLVM IR (-O2):
define void @pthread_mutexattr_gettype() {
ret void
}
/* Type definitions */
struct object {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void __register_frame_info(const void *fi, struct object *obj) {
  printf("__register_frame_info()\n");
}


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

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

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

LLVM IR (-O2):
%struct.object = type { i32 }
@str = [24 x i8] c"__register_frame_info()\00"
define void @__register_frame_info(i8* nocapture readnone %0, %struct.object* nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret void
}
void g_signal_stop_emission_by_name() {}


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

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

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

LLVM IR (-O2):
define void @g_signal_stop_emission_by_name() {
ret void
}
/* Variables and functions */
int EXIT_FAILURE;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void amnesia_exit(char *msg, int code) {
  if (code < 0 || code > 255) {
    code = EXIT_FAILURE;
  }
  if (msg != NULL)
    printf("%s", msg);
  exit(code);
}


x86 assembly (clang, -O0):
<amnesia_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1146 <amnesia_exit+0x26>
cmpl   $0xff,-0xc(%rbp)
jle    1152 <amnesia_exit+0x32>
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116d <amnesia_exit+0x4d>
mov    -0x8(%rbp),%rsi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<amnesia_exit>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    0x2eb4(%rip),%rax
mov    (%rax),%ebp
test   %rdi,%rdi
je     1142 <amnesia_exit+0x22>
mov    %rdi,%rsi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x100,%ebx
cmovb  %ebx,%ebp
mov    %ebp,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [3 x i8] c"%s\00"
define void @amnesia_exit(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp slt i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 255
br i1 %9, label %10, label %12
10: ; preds = %7, %2
%11 = load i32, i32* @EXIT_FAILURE
store i32 %11, i32* %4
br label %12
12: ; preds = %10, %7
%13 = load i8*, i8** %3
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i8*, i8** %3
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %15, %12
%19 = load i32, i32* %4
%20 = call i32 @exit(i32 %19)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [3 x i8] c"%s\00"
define void @amnesia_exit(i8* %0, i32 %1) {
%3 = load i32, i32* @EXIT_FAILURE
%4 = icmp eq i8* %0, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %5, %2
%8 = icmp ugt i32 %1, 255
%9 = select i1 %8, i32 %3, i32 %1
%10 = tail call i32 @exit(i32 %9)
unreachable
}
/* Variables and functions */
int cat_main(int, char **);
int lsmod_main(int argc, char **argv) {
  char *cat_argv[] = {"cat", "/proc/modules", NULL};
  return cat_main(2, cat_argv);
}


x86 assembly (clang, -O0):
<lsmod_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2cda(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cd7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cd4(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x30(%rbp),%rsi
mov    $0x2,%edi
call   1030 <cat_main@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsmod_main>:
sub    $0x18,%rsp
mov    0x2cf5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0x2cd9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x2,%edi
call   1030 <cat_main@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"cat\00"
@.str.1 = [14 x i8] c"/proc/modules\00"
@__const.lsmod_main.cat_argv = [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i32 0, i32 0), i8* null]
define i32 @lsmod_main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [3 x i8*]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = bitcast [3 x i8*]* %5 to i8*
%7 = getelementptr inbounds [3 x i8*], [3 x i8*]* %5, i64 0, i64 0
%8 = call i32 @cat_main(i32 2, i8** %7)
ret i32 %8
}

LLVM IR (-O2):
@.str = [4 x i8] c"cat\00"
@.str.1 = [14 x i8] c"/proc/modules\00"
@__const.lsmod_main.cat_argv = [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i32 0, i32 0), i8* null]
define i32 @lsmod_main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i8*]
%4 = bitcast [3 x i8*]* %3 to i8*
%5 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 0
%6 = call i32 @cat_main(i32 2, i8** %5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
void shutdown_terminal(void) { endwin(); }


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

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

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

LLVM IR (-O2):
define void @shutdown_terminal() {
%1 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
#define XK_Alt_L 137
#define XK_Alt_R 136
#define XK_Caps_Lock 135
#define XK_Control_L 134
#define XK_Control_R 133
#define XK_Num_Lock 132
#define XK_Shift_L 131
#define XK_Shift_R 130
#define XK_Super_L 129
#define XK_Super_R 128
int is_modifier(int code) {
  switch (code) {
  default:
    return 0;
  case XK_Shift_L:
  case XK_Shift_R:
  case XK_Control_L:
  case XK_Control_R:
  case XK_Alt_L:
  case XK_Alt_R:
  case XK_Super_L:
  case XK_Super_R:
  case XK_Caps_Lock:
  case XK_Num_Lock:
    return 1;
  }
}


x86 assembly (clang, -O0):
<is_modifier>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff80,%eax
sub    $0xa,%eax
jb     1127 <is_modifier+0x27>
jmp    111b <is_modifier+0x1b>
movl   $0x0,-0x4(%rbp)
jmp    112e <is_modifier+0x2e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_modifier>:
add    $0xffffff80,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @is_modifier(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %5 [
i32 131, label %6
i32 130, label %6
i32 134, label %6
i32 133, label %6
i32 137, label %6
i32 136, label %6
i32 129, label %6
i32 128, label %6
i32 135, label %6
i32 132, label %6
]
5: ; preds = %1
store i32 0, i32* %2
br label %7
6: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_modifier(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
unsigned long oph_subset_id_to_index2(unsigned long id,
                                      unsigned long block_size,
                                      unsigned long size) {
  return (id / block_size) % size;
}


x86 assembly (clang, -O0):
<oph_subset_id_to_index2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
mov    %rdx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<oph_subset_id_to_index2>:
mov    %rdx,%rcx
mov    %rdi,%rax
mov    %rdi,%rdx
or     %rsi,%rdx
shr    $0x20,%rdx
je     1119 <oph_subset_id_to_index2+0x19>
xor    %edx,%edx
div    %rsi
jmp    111d <oph_subset_id_to_index2+0x1d>
xor    %edx,%edx
div    %esi
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     1132 <oph_subset_id_to_index2+0x32>
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
ret
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i64 @oph_subset_id_to_index2(i64 %0, i64 %1, i64 %2) {
%4 = udiv i64 %0, %1
%5 = urem i64 %4, %2
ret i64 %5
}
float mlClamp(float x, float a, float b) { return x < a ? a : (b < x ? b : x); }


x86 assembly (clang, -O0):
<mlClamp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1135 <mlClamp+0x35>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    116b <mlClamp+0x6b>
movss  -0xc(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1157 <mlClamp+0x57>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1161 <mlClamp+0x61>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlClamp>:
minss  %xmm0,%xmm2
cmpltss %xmm1,%xmm0
movaps %xmm0,%xmm3
andnps %xmm2,%xmm3
andps  %xmm1,%xmm0
orps   %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @mlClamp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = fcmp olt float %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load float, float* %5
br label %22
12: ; preds = %3
%13 = load float, float* %6
%14 = load float, float* %4
%15 = fcmp olt float %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load float, float* %6
br label %20
18: ; preds = %12
%19 = load float, float* %4
br label %20
20: ; preds = %18, %16
%21 = phi float [ %17, %16 ], [ %19, %18 ]
br label %22
22: ; preds = %20, %10
%23 = phi float [ %11, %10 ], [ %21, %20 ]
ret float %23
}

LLVM IR (-O2):
define float @mlClamp(float %0, float %1, float %2) {
%4 = fcmp olt float %0, %1
%5 = fcmp olt float %2, %0
%6 = select i1 %5, float %2, float %0
%7 = select i1 %4, float %1, float %6
ret float %7
}
int INHERENT_futimes() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @INHERENT_futimes() {
ret i32 0
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ putchar(int);
int main(int argc, const char *argv[]) {
  int ret = 0;
  while ((ret = getchar()) != EOF) {
    putchar(ret);
  }
  return 0;
}


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)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     1163 <main+0x43>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb9(%rip),%rbx
cmp    (%rbx),%eax
je     1152 <main+0x32>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
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
store i32 0, i32* %6
br label %7
7: ; preds = %11, %2
%8 = call i32 (...) @getchar()
store i32 %8, i32* %6
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %6
%13 = call i32 @putchar(i32 %12)
br label %7
14: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %9, %6 ], [ %3, %2 ]
%8 = tail call i32 @putchar(i32 %7)
%9 = tail call i32 (...) @getchar()
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %6
12: ; preds = %6, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ FiveFunction();
int /*<<< orphan*/ TwoFunction();
int /*<<< orphan*/ printf(char *);
int main() {
  FiveFunction();
  TwoFunction();
  printf("Dependency test executable ran successfully.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <FiveFunction@plt>
mov    $0x0,%al
call   1050 <TwoFunction@plt>
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <FiveFunction@plt>
xor    %eax,%eax
call   1050 <TwoFunction@plt>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Dependency test executable ran successfully.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @FiveFunction()
%3 = call i32 (...) @TwoFunction()
%4 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [45 x i8] c"Dependency test executable ran successfully.\00"
define i32 @main() {
%1 = tail call i32 (...) @FiveFunction()
%2 = tail call i32 (...) @TwoFunction()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int afunc(void *a, void *b) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @afunc(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
bool mrsh_is_ws(const char *c) {
  switch (*c) {
  case ' ':
  case '\t':
  case '\n':
  case '\a':
  case '\r':
    return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<mrsh_is_ws>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x7,%eax
je     1156 <mrsh_is_ws+0x56>
jmp    1120 <mrsh_is_ws+0x20>
mov    -0x14(%rbp),%eax
add    $0xfffffff7,%eax
sub    $0x2,%eax
jb     1156 <mrsh_is_ws+0x56>
jmp    1134 <mrsh_is_ws+0x34>
mov    -0x14(%rbp),%eax
sub    $0xd,%eax
je     1156 <mrsh_is_ws+0x56>
jmp    1145 <mrsh_is_ws+0x45>
mov    -0x14(%rbp),%eax
sub    $0x20,%eax
jne    1162 <mrsh_is_ws+0x62>
jmp    1156 <mrsh_is_ws+0x56>
movl   $0x1,-0x4(%rbp)
jmp    1169 <mrsh_is_ws+0x69>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mrsh_is_ws>:
movsbl (%rdi),%ecx
cmp    $0x20,%ecx
ja     111e <mrsh_is_ws+0x1e>
mov    $0x1,%eax
movabs $0x100002680,%rdx
bt     %rcx,%rdx
jae    111e <mrsh_is_ws+0x1e>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @mrsh_is_ws(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
switch i32 %3, label %4 [
i32 32, label %5
i32 9, label %5
i32 10, label %5
i32 7, label %5
i32 13, label %5
]
4: ; preds = %1
br label %5
5: ; preds = %1, %1, %1, %1, %1, %4
%6 = phi i32 [ 0, %4 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
unsigned long jbg_ceil_half(unsigned long x, int n) {
  unsigned long mask;
  mask = (1UL << n) - 1;
  return (x >> n) + ((mask & x) != 0);
}


x86 assembly (clang, -O0):
<jbg_ceil_half>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
sub    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shr    %cl,%rax
mov    -0x18(%rbp),%rcx
and    -0x8(%rbp),%rcx
cmp    $0x0,%rcx
setne  %cl
and    $0x1,%cl
movzbl %cl,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<jbg_ceil_half>:
mov    %esi,%ecx
mov    %rdi,%rax
mov    $0xffffffffffffffff,%rdx
shl    %cl,%rdx
not    %rdx
and    %rdi,%rdx
shr    %cl,%rax
cmp    $0x1,%rdx
sbb    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i64 @jbg_ceil_half(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i64
store i64 %0, i64* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = shl i64 1, %7
%9 = sub i64 %8, 1
store i64 %9, i64* %5
%10 = load i64, i64* %3
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = lshr i64 %10, %12
%14 = load i64, i64* %5
%15 = load i64, i64* %3
%16 = and i64 %14, %15
%17 = icmp ne i64 %16, 0
%18 = zext i1 %17 to i32
%19 = sext i32 %18 to i64
%20 = add i64 %13, %19
ret i64 %20
}

LLVM IR (-O2):
define i64 @jbg_ceil_half(i64 %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = shl nsw i64 -1, %3
%5 = xor i64 %4, -1
%6 = lshr i64 %0, %3
%7 = and i64 %5, %0
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i64
%10 = add i64 %6, %9
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ curs_set(int);
int /*<<< orphan*/ echo();
int /*<<< orphan*/ timeout(int);
void dcpu_dbgterm(void) {
  curs_set(1);
  timeout(-1);
  echo();
}


x86 assembly (clang, -O0):
<dcpu_dbgterm>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1050 <curs_set@plt>
mov    $0xffffffff,%edi
call   1040 <timeout@plt>
mov    $0x0,%al
call   1030 <echo@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcpu_dbgterm>:
push   %rax
mov    $0x1,%edi
call   1050 <curs_set@plt>
mov    $0xffffffff,%edi
call   1040 <timeout@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <echo@plt>

LLVM IR (-O0):
define void @dcpu_dbgterm() {
%1 = call i32 @curs_set(i32 1)
%2 = call i32 @timeout(i32 -1)
%3 = call i32 (...) @echo()
ret void
}

LLVM IR (-O2):
define void @dcpu_dbgterm() {
%1 = tail call i32 @curs_set(i32 1)
%2 = tail call i32 @timeout(i32 -1)
%3 = tail call i32 (...) @echo()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glMaterialf(unsigned int, unsigned int, float);
void Materialf(unsigned int f, unsigned int p, float v) {
  glMaterialf(f, p, v);
}


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

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

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

LLVM IR (-O2):
define void @Materialf(i32 %0, i32 %1, float %2) {
%4 = tail call i32 @glMaterialf(i32 %0, i32 %1, float %2)
ret void
}
double lerp(double t, double a, double b) { return (1. - t) * a + t * b; }


x86 assembly (clang, -O0):
<lerp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xee5(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<lerp>:
movsd  0xef8(%rip),%xmm3
subsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm3
addsd  %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @lerp(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = fsub double 1.000000e+00, %7
%9 = load double, double* %5
%10 = load double, double* %4
%11 = load double, double* %6
%12 = fmul double %10, %11
%13 = call double @llvm.fmuladd.f64(double %8, double %9, double %12)
ret double %13
}

LLVM IR (-O2):
define double @lerp(double %0, double %1, double %2) {
%4 = fsub double 1.000000e+00, %0
%5 = fmul double %0, %2
%6 = tail call double @llvm.fmuladd.f64(double %4, double %1, double %5)
ret double %6
}
int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
                             struct drm_minor *minor) {
  return 0;
}


x86 assembly (clang, -O0):
<drm_debugfs_remove_files>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.drm_info_list = type opaque
%struct.drm_minor = type opaque
define i32 @drm_debugfs_remove_files(%struct.drm_info_list* %0, i32 %1, %struct.drm_minor* %2) {
%4 = alloca %struct.drm_info_list*
%5 = alloca i32
%6 = alloca %struct.drm_minor*
store %struct.drm_info_list* %0, %struct.drm_info_list** %4
store i32 %1, i32* %5
store %struct.drm_minor* %2, %struct.drm_minor** %6
ret i32 0
}

LLVM IR (-O2):
%struct.drm_info_list = type opaque
%struct.drm_minor = type opaque
define i32 @drm_debugfs_remove_files(%struct.drm_info_list* nocapture readnone %0, i32 %1, %struct.drm_minor* nocapture readnone %2) {
ret i32 0
}