xunge/DecIR huggingface dataset:
/* Variables and functions */
size_t zmax(size_t a, size_t b) { return (a > b) ? a : b; }


x86 assembly (clang, -O0):
<zmax>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    1127 <zmax+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <zmax+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zmax>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmova  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @zmax(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp ugt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @zmax(i64 %0, i64 %1) {
%3 = icmp ugt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
void INT_Excep_TPU5_TGI5B(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_TPU5_TGI5B() {
ret void
}
/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ unlink(char *);
int main(void) {
  if (0 > unlink("arnold.layne"))
    return EXIT_FAILURE;
  else
    return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <unlink@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    114a <main+0x3a>
mov    0x2ea0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <main+0x46>
mov    0x2e87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <unlink@plt>
test   %rax,%rax
jns    112b <main+0x1b>
mov    0x2eb7(%rip),%rax
jmp    1132 <main+0x22>
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"arnold.layne\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @unlink(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = icmp sgt i64 0, %2
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = load i32, i32* @EXIT_FAILURE
store i32 %5, i32* %1
br label %8
6: ; preds = %0
%7 = load i32, i32* @EXIT_SUCCESS
store i32 %7, i32* %1
br label %8
8: ; preds = %6, %4
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@.str = [13 x i8] c"arnold.layne\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i64 @unlink(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = icmp slt i64 %1, 0
%3 = load i32, i32* @EXIT_FAILURE
%4 = load i32, i32* @EXIT_SUCCESS
%5 = select i1 %2, i32 %3, i32 %4
ret i32 %5
}
void av_stristart() {}


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

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

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

LLVM IR (-O2):
define void @av_stristart() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ o5_reset();
void o5_type(int type) {
  static int oldtype = -1;
  if (type != oldtype) {
    oldtype = type;
    o5_reset();
  }
  oldtype = type;
}


x86 assembly (clang, -O0):
<o5_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    0x2f04(%rip),%eax
je     113a <o5_type+0x2a>
mov    -0x4(%rbp),%eax
mov    %eax,0x2ef5(%rip)
mov    $0x0,%al
call   1030 <o5_reset@plt>
mov    -0x4(%rbp),%eax
mov    %eax,0x2ee5(%rip)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<o5_type>:
push   %rbx
mov    %edi,%ebx
cmp    %edi,0x2f0f(%rip)
je     1128 <o5_type+0x18>
mov    %ebx,0x2f07(%rip)
xor    %eax,%eax
call   1030 <o5_reset@plt>
mov    %ebx,0x2efa(%rip)
pop    %rbx
ret

LLVM IR (-O0):
@o5_type.oldtype = internal global i32 -1
define void @o5_type(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @o5_type.oldtype
%5 = icmp ne i32 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
store i32 %7, i32* @o5_type.oldtype
%8 = call i32 (...) @o5_reset()
br label %9
9: ; preds = %6, %1
%10 = load i32, i32* %2
store i32 %10, i32* @o5_type.oldtype
ret void
}

LLVM IR (-O2):
@o5_type.oldtype = internal unnamed_addr global i32 -1
define void @o5_type(i32 %0) {
%2 = load i32, i32* @o5_type.oldtype
%3 = icmp eq i32 %2, %0
br i1 %3, label %6, label %4
4: ; preds = %1
store i32 %0, i32* @o5_type.oldtype
%5 = tail call i32 (...) @o5_reset()
br label %6
6: ; preds = %4, %1
store i32 %0, i32* @o5_type.oldtype
ret void
}
/* Variables and functions */
int free_fd(int);
int close(int fd) { return free_fd(fd); }


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

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

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

LLVM IR (-O2):
define i32 @close(i32 %0) {
%2 = tail call i32 @free_fd(i32 %0)
ret i32 %2
}
void halt_cb(unsigned long time) {}


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

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

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

LLVM IR (-O2):
define void @halt_cb(i64 %0) {
ret void
}
int STRCPY(char *dst, char *src) {
  int i = 0;
  for (; src[i] != '\0'; i++)
    dst[i] = src[i];
  return i;
}


x86 assembly (clang, -O0):
<STRCPY>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     114c <STRCPY+0x4c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <STRCPY+0x13>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<STRCPY>:
mov    (%rsi),%cl
xor    %eax,%eax
test   %cl,%cl
je     1120 <STRCPY+0x20>
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rdi,%rax,1)
movzbl 0x1(%rsi,%rax,1),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <STRCPY+0x10>
ret

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

LLVM IR (-O2):
define i32 @STRCPY(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8 [ %11, %5 ], [ %3, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %7, i8* %8
%9 = add nuw nsw i64 %6, 1
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = trunc i64 %9 to i32
br label %15
15: ; preds = %13, %2
%16 = phi i32 [ 0, %2 ], [ %14, %13 ]
ret i32 %16
}
/* Type definitions */
typedef scalar_t__ time_t;
struct timeval {
  double tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
time_t microseconds(struct timeval *t) {
  return t->tv_sec * 1000000.0 + t->tv_usec;
}


x86 assembly (clang, -O0):
<microseconds>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
cvtsi2sdq 0x8(%rax),%xmm1
movsd  0xede(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<microseconds>:
movsd  (%rdi),%xmm0
cvtsi2sdq 0x8(%rdi),%xmm1
mulsd  0xeee(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
ret

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

LLVM IR (-O2):
%struct.timeval = type { double, i64 }
define i64 @microseconds(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%3 = load double, double* %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = tail call double @llvm.fmuladd.f64(double %3, double 1.000000e+06, double %6)
%8 = fptosi double %7 to i64
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, size_t);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *smalloc(size_t s) {
  void *res = malloc(s);
  if (!res) {
    fprintf(stderr,
            "\033[1m"
            "\033[31m"
            "ERROR "
            "\033[0m"
            "\033[31m"
            "smalloc: Out of Memory. Requested size: %zd"
            "\033[0m"
            "\n",
            s);
    abort();
  }
  return res;
}


x86 assembly (clang, -O0):
<smalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1174 <smalloc+0x44>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe98(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smalloc>:
push   %rbx
mov    %rdi,%rbx
call   1050 <malloc@plt>
test   %rax,%rax
je     1140 <smalloc+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [73 x i8] c"\1B[1m\1B[31mERROR \1B[0m\1B[31msmalloc: Out of Memory. Requested size: %zd\1B[0m\0A\00"
define i8* @smalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i64, i64* %2
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [73 x i8] c"\1B[1m\1B[31mERROR \1B[0m\1B[31msmalloc: Out of Memory. Requested size: %zd\1B[0m\0A\00"
define noalias i8* @smalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i64 %0)
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
scalar_t__ ceil(float);
int iceilf(float a) { return (int)ceil(a); }


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

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

LLVM IR (-O0):
define i32 @iceilf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @ceil(float %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @iceilf(float %0) {
%2 = tail call i64 @ceil(float %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Msp430AlarmC__0__Alarm__stop();
void TransformAlarmC__0__AlarmFrom__stop(void) {
  Msp430AlarmC__0__Alarm__stop();
}


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

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

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

LLVM IR (-O2):
define void @TransformAlarmC__0__AlarmFrom__stop() {
%1 = tail call i32 (...) @Msp430AlarmC__0__Alarm__stop()
ret void
}
void call4b(union utag *unp) { unp = 0; }


x86 assembly (clang, -O0):
<call4b>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%union.utag = type opaque
define void @call4b(%union.utag* %0) {
%2 = alloca %union.utag*
store %union.utag* %0, %union.utag** %2
store %union.utag* null, %union.utag** %2
ret void
}

LLVM IR (-O2):
%union.utag = type opaque
define void @call4b(%union.utag* nocapture %0) {
ret void
}
/* Variables and functions */
float sla_ranorm_(float *);
float slaRanorm(float a) { return sla_ranorm_(&a); }


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

x86 assembly (clang, -O2):
<slaRanorm>:
push   %rax
movss  %xmm0,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <sla_ranorm_@plt>
pop    %rax
ret

LLVM IR (-O0):
define float @slaRanorm(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = call float @sla_ranorm_(float* %2)
ret float %3
}

LLVM IR (-O2):
define float @slaRanorm(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = call float @sla_ranorm_(float* %2)
ret float %3
}
/* Variables and functions */
char *sha512_crypt(char const *, char const *);
char *crypt(const char *key, const char *salt) {
  return sha512_crypt(key, salt);
}


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

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

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

LLVM IR (-O2):
define i8* @crypt(i8* %0, i8* %1) {
%3 = tail call i8* @sha512_crypt(i8* %0, i8* %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage() {
  printf("Usage: ./set_test_sched scheduler\n"
         "Scheduler should be one of NORMAL, FIFO or RR\n");
}


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

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

LLVM IR (-O0):
@.str = [81 x i8] c"Usage: ./set_test_sched scheduler\0AScheduler should be one of NORMAL, FIFO or RR\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [80 x i8] c"Usage: ./set_test_sched scheduler\0AScheduler should be one of NORMAL, FIFO or RR\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int gcd(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int x, y;
  printf("Enter two numbers: ");
  scanf("%d %d", &x, &y);
  printf("GCD = %d\n", gcd(x, y));
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1050 <gcd@plt>
lea    0xeb4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Enter two numbers: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [10 x i8] c"GCD = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = call i32 @gcd(i32 %5, i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Enter two numbers: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [10 x i8] c"GCD = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 @gcd(i32 %7, i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void pwp_msghandler_release(void *pc) { free(pc); }


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

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

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

LLVM IR (-O2):
define void @pwp_msghandler_release(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
void fooSub(char *s, int i) {
  s[i] = 'd';
  s[i - 2] = 'd';
}


x86 assembly (clang, -O0):
<fooSub>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x64,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x64,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fooSub>:
movslq %esi,%rax
movb   $0x64,(%rdi,%rax,1)
movb   $0x64,-0x2(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @fooSub(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 100, i8* %8
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %9, i64 %12
store i8 100, i8* %13
ret void
}

LLVM IR (-O2):
define void @fooSub(i8* nocapture writeonly %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
store i8 100, i8* %4
%5 = add nsw i32 %1, -2
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 100, i8* %7
ret void
}
int abs(int j) {
  if (j < 0) {
    return j * -1;
  } else {
    return j;
  }
}


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111d <abs+0x1d>
imul   $0xffffffff,-0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1123 <abs+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int BitVectorNoBitsSet(v, ipv)
register int *v;
register int ipv;
{
  do
    if (*v++)
      return 0;
  while (--ipv > 0);
  return 1;
}


x86 assembly (clang, -O0):
<BitVectorNoBitsSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
cmpl   $0x0,(%rax)
je     112f <BitVectorNoBitsSet+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    114d <BitVectorNoBitsSet+0x4d>
jmp    1134 <BitVectorNoBitsSet+0x34>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jg     110b <BitVectorNoBitsSet+0xb>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BitVectorNoBitsSet>:
add    $0x1,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpl   $0x0,(%rdi)
jne    1127 <BitVectorNoBitsSet+0x27>
add    $0x4,%rdi
add    $0xffffffff,%esi
cmp    $0x1,%esi
jg     1110 <BitVectorNoBitsSet+0x10>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @BitVectorNoBitsSet(i32* nocapture %0, i32 %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i32* [ %0, %2 ], [ %9, %8 ]
%5 = phi i32 [ %1, %2 ], [ %10, %8 ]
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = getelementptr inbounds i32, i32* %4, i64 1
%10 = add nsw i32 %5, -1
%11 = icmp sgt i32 %5, 1
br i1 %11, label %3, label %12
12: ; preds = %8, %3
%13 = phi i32 [ 0, %3 ], [ 1, %8 ]
ret i32 %13
}
double qv_star_c(const double p0, const double qt, const double pv) {
  return 0.6221018418201517 * (1.0 - qt) * pv / (p0 - pv);
}


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

x86 assembly (clang, -O2):
<qv_star_c>:
movsd  0xef8(%rip),%xmm3
subsd  %xmm1,%xmm3
mulsd  0xef4(%rip),%xmm3
mulsd  %xmm2,%xmm3
subsd  %xmm2,%xmm0
divsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @qv_star_c(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* %5
%8 = fsub double 1.000000e+00, %7
%9 = fmul double 0x3FE3E8421F2CC3ED, %8
%10 = load double, double* %6
%11 = fmul double %9, %10
%12 = load double, double* %4
%13 = load double, double* %6
%14 = fsub double %12, %13
%15 = fdiv double %11, %14
ret double %15
}

LLVM IR (-O2):
define double @qv_star_c(double %0, double %1, double %2) {
%4 = fsub double 1.000000e+00, %1
%5 = fmul double %4, 0x3FE3E8421F2CC3ED
%6 = fmul double %5, %2
%7 = fsub double %0, %2
%8 = fdiv double %6, %7
ret double %8
}
extern int fib(int n) {
  if (n == 0 || n == 1) {
    return 1;
  } else {
    return fib(n - 1) + fib(n - 2);
  }
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <fib+0x1f>
cmpl   $0x1,-0x8(%rbp)
jne    113b <fib+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    115e <fib+0x4e>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
cmp    $0x2,%edi
jb     1145 <fib+0x35>
mov    %edi,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rbx),%edi
call   1030 <fib@plt>
add    $0xfffffffe,%ebx
add    %eax,%ebp
cmp    $0x1,%ebx
ja     1130 <fib+0x20>
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fib(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fib(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %8, 2
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = add i32 %9, 1
br label %13
13: ; preds = %11, %1
%14 = phi i32 [ 1, %1 ], [ %12, %11 ]
ret i32 %14
}
/* Variables and functions */
unsigned int sm_get_current_micros();
unsigned int sm_get_current_seconds();
unsigned int time_reference_ticks(void) {
  unsigned int micros = sm_get_current_micros();
  unsigned int seconds = sm_get_current_seconds();
  return seconds * 25 + micros / (1000000 / 25);
}


x86 assembly (clang, -O0):
<time_reference_ticks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <sm_get_current_micros@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <sm_get_current_seconds@plt>
mov    %eax,-0x8(%rbp)
imul   $0x19,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x9c40,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_reference_ticks>:
push   %rbx
xor    %eax,%eax
call   1030 <sm_get_current_micros@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <sm_get_current_seconds@plt>
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,4),%ecx
mov    %ebx,%edx
mov    $0xd1b71759,%eax
imul   %rdx,%rax
shr    $0x2f,%rax
add    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @time_reference_ticks() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @sm_get_current_micros()
store i32 %3, i32* %1
%4 = call i32 (...) @sm_get_current_seconds()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = mul i32 %5, 25
%7 = load i32, i32* %1
%8 = udiv i32 %7, 40000
%9 = add i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @time_reference_ticks() {
%1 = tail call i32 (...) @sm_get_current_micros()
%2 = tail call i32 (...) @sm_get_current_seconds()
%3 = mul i32 %2, 25
%4 = udiv i32 %1, 40000
%5 = add i32 %3, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned int *, unsigned char *, int);
int tep_host_bigendian(void) {
  unsigned char str[] = {0x1, 0x2, 0x3, 0x4};
  unsigned int val;
  memcpy(&val, str, 4);
  return val == 0x01020304;
}


x86 assembly (clang, -O0):
<tep_host_bigendian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee2(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
cmpl   $0x1020304,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tep_host_bigendian>:
push   %rax
movl   $0x4030201,0x4(%rsp)
04
mov    %rsp,%rdi
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
cmpl   $0x1020304,(%rsp)
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
@__const.tep_host_bigendian.str = [4 x i8] c"\01\02\03\04"
define i32 @tep_host_bigendian() {
%1 = alloca [4 x i8]
%2 = alloca i32
%3 = bitcast [4 x i8]* %1 to i8*
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%5 = call i32 @memcpy(i32* %2, i8* %4, i32 4)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 16909060
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @tep_host_bigendian() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 67305985, i32* %1
%4 = bitcast i32* %2 to i8*
%5 = call i32 @memcpy(i32* %2, i8* %3, i32 4)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 16909060
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int *malloc(int);
main() {
  int *x;
  x = malloc(sizeof(int));
  *x = 1;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1030 <malloc@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ put8(unsigned char);
void add_reg32_imm8(unsigned long reg32, unsigned char imm8) {
  put8(0x83);
  put8(0xC0 + reg32);
  put8(imm8);
}


x86 assembly (clang, -O0):
<add_reg32_imm8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    $0x83,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%rax
add    $0xc0,%rax
movzbl %al,%edi
call   1030 <put8@plt>
movzbl -0x9(%rbp),%edi
call   1030 <put8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_reg32_imm8>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x83,%edi
call   1030 <put8@plt>
add    $0xc0,%bl
movzbl %bl,%edi
call   1030 <put8@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @add_reg32_imm8(i64 %0, i8 zeroext %1) {
%3 = alloca i64
%4 = alloca i8
store i64 %0, i64* %3
store i8 %1, i8* %4
%5 = call i32 @put8(i8 zeroext -125)
%6 = load i64, i64* %3
%7 = add i64 192, %6
%8 = trunc i64 %7 to i8
%9 = call i32 @put8(i8 zeroext %8)
%10 = load i8, i8* %4
%11 = call i32 @put8(i8 zeroext %10)
ret void
}

LLVM IR (-O2):
define void @add_reg32_imm8(i64 %0, i8 zeroext %1) {
%3 = tail call i32 @put8(i8 zeroext -125)
%4 = trunc i64 %0 to i8
%5 = add i8 %4, -64
%6 = tail call i32 @put8(i8 zeroext %5)
%7 = tail call i32 @put8(i8 zeroext %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *);
int /*<<< orphan*/ draw_status();
int /*<<< orphan*/ kill_this_task();
void drop(void) {
  debug("elixer removed");
  draw_status();
  kill_this_task();
}


x86 assembly (clang, -O0):
<drop>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1040 <debug@plt>
mov    $0x0,%al
call   1050 <draw_status@plt>
mov    $0x0,%al
call   1030 <kill_this_task@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<drop>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <debug@plt>
xor    %eax,%eax
call   1050 <draw_status@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <kill_this_task@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"elixer removed\00"
define void @drop() {
%1 = call i32 @debug(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @draw_status()
%3 = call i32 (...) @kill_this_task()
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"elixer removed\00"
define void @drop() {
%1 = tail call i32 @debug(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @draw_status()
%3 = tail call i32 (...) @kill_this_task()
ret void
}
int main(int argc, char *argv[]) {
  int ret = 0;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
int srec_is_head(unsigned char c) { return (c == 'S') ? 1 : 0; }


x86 assembly (clang, -O0):
<srec_is_head>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x53,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<srec_is_head>:
xor    %eax,%eax
cmp    $0x53,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @srec_is_head(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp eq i32 %4, 83
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 1, i32 0
ret i32 %7
}

LLVM IR (-O2):
define i32 @srec_is_head(i8 zeroext %0) {
%2 = icmp eq i8 %0, 83
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
void platform_linux_sleepMS(long);
extern void platform_delay(long valueMS) {
  return platform_linux_sleepMS(valueMS);
  return;
}


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

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

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

LLVM IR (-O2):
define void @platform_delay(i64 %0) {
tail call void @platform_linux_sleepMS(i64 %0)
ret void
}
double min2hour(double x) { return (x / 60.0); }


x86 assembly (clang, -O0):
<min2hour>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @min2hour(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 6.000000e+01
ret double %4
}

LLVM IR (-O2):
define double @min2hour(double %0) {
%2 = fdiv double %0, 6.000000e+01
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
int main(void) {
  foo(1000);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3e8,%edi
call   1030 <foo@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 1000)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ sem_t;

/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
int sem_wait(int /*<<< orphan*/ *);
int /*<<< orphan*/ terminal_error(char *);
void wait_sem(sem_t *s) {
retry:
  if ((sem_wait(s)) == -1) {
    if (errno == EINTR)
      goto retry;
    terminal_error("sem_wait");
  }
}


x86 assembly (clang, -O0):
<wait_sem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <sem_wait@plt>
cmp    $0xffffffff,%eax
jne    1169 <wait_sem+0x49>
mov    0x2e9b(%rip),%rax
mov    (%rax),%rax
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%rax
jne    115d <wait_sem+0x3d>
jmp    112c <wait_sem+0xc>
lea    0xe9c(%rip),%rdi
call   1040 <terminal_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_sem>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x2eb1(%rip),%r14
mov    0x2ea2(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <sem_wait@plt>
cmp    $0xffffffff,%eax
jne    1166 <wait_sem+0x46>
mov    (%r14),%rax
cmp    (%r15),%rax
je     1140 <wait_sem+0x20>
lea    0xea4(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <terminal_error@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
@.str = [9 x i8] c"sem_wait\00"
define void @wait_sem(i32* %0) {
br label %2
2: ; preds = %5, %1
%3 = tail call i32 @sem_wait(i32* %0)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i64, i64* @errno
%7 = load i64, i64* @EINTR
%8 = icmp eq i64 %6, %7
br i1 %8, label %2, label %9
9: ; preds = %5
%10 = tail call i32 @terminal_error(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %2, %9
ret void
}
int xtensa_ai4const(v)
int v;
{
  switch (v) {
  case -1:
  case 1:
  case 2:
  case 3:
  case 4:
  case 5:
  case 6:
  case 7:
  case 8:
  case 9:
  case 10:
  case 11:
  case 12:
  case 13:
  case 14:
  case 15: {
    return 1;
  } break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<xtensa_ai4const>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0xffffffff,%eax
je     112f <xtensa_ai4const+0x2f>
jmp    111b <xtensa_ai4const+0x1b>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
sub    $0xe,%eax
ja     113b <xtensa_ai4const+0x3b>
jmp    112f <xtensa_ai4const+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1142 <xtensa_ai4const+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtensa_ai4const>:
add    $0x1,%edi
xor    %eax,%eax
cmp    $0x10,%edi
ja     1117 <xtensa_ai4const+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

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

LLVM IR (-O2):
@switch.table.xtensa_ai4const = [17 x i32] [i32 1, i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1]
define i32 @xtensa_ai4const(i32 %0) {
%2 = add i32 %0, 1
%3 = icmp ult i32 %2, 17
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [17 x i32], [17 x i32]* @switch.table.xtensa_ai4const, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 0, %1 ]
ret i32 %9
}
int HelpItem123(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @HelpItem123() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
main() {
  int *p;
  int a = 2;
  p = 0;
  printf("%p\n", &a);
  printf("%p\n", p);
  *p = 3;
  printf("%d\n", a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2,-0xc(%rbp)
movq   $0x0,-0x8(%rbp)
lea    0xed2(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movl   $0x3,(%rax)
mov    -0xc(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x2,0xc(%rsp)
lea    0xedc(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 2, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* null)
unreachable
}
unsigned long elf_hash(const unsigned char *name) {
  unsigned long h = 0, g;
  while (*name) {
    h = (h << 4) + *name++;
    if ((g = h & 0xF0000000)) {
      h ^= g >> 24;
    }
    h &= ~g;
  }
  return h;
}


x86 assembly (clang, -O0):
<elf_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     117f <elf_hash+0x7f>
mov    -0x10(%rbp),%rax
shl    $0x4,%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movzbl (%rcx),%ecx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
movabs $0xf0000000,%rax
and    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     116a <elf_hash+0x6a>
mov    -0x18(%rbp),%rax
shr    $0x18,%rax
xor    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
xor    $0xffffffffffffffff,%rax
and    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <elf_hash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<elf_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     113d <elf_hash+0x3d>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
shl    $0x4,%rax
movzbl %cl,%ecx
add    %rax,%rcx
mov    %ecx,%eax
and    $0xf0000000,%eax
mov    %rax,%rdx
shr    $0x18,%rdx
xor    %rcx,%rdx
not    %rax
and    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <elf_hash+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @elf_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %17, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = phi i64 [ %16, %4 ], [ 0, %1 ]
%8 = shl i64 %7, 4
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = zext i8 %5 to i64
%11 = add i64 %8, %10
%12 = and i64 %11, 4026531840
%13 = lshr exact i64 %12, 24
%14 = xor i64 %13, %11
%15 = xor i64 %12, -1
%16 = and i64 %14, %15
%17 = load i8, i8* %9
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %4
19: ; preds = %4, %1
%20 = phi i64 [ 0, %1 ], [ %16, %4 ]
ret i64 %20
}
unsigned char equal(unsigned char a, unsigned char b) {
  unsigned char x = a ^ b;
  x -= 1;
  x >>= 7;
  return x;
}


x86 assembly (clang, -O0):
<equal>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
sub    $0x1,%eax
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
sar    $0x7,%eax
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<equal>:
xor    %esi,%edi
lea    -0x1(%rdi),%eax
shr    $0x7,%al
ret

LLVM IR (-O0):
define zeroext i8 @equal(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = xor i32 %7, %9
%11 = trunc i32 %10 to i8
store i8 %11, i8* %5
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = sub nsw i32 %13, 1
%15 = trunc i32 %14 to i8
store i8 %15, i8* %5
%16 = load i8, i8* %5
%17 = zext i8 %16 to i32
%18 = ashr i32 %17, 7
%19 = trunc i32 %18 to i8
store i8 %19, i8* %5
%20 = load i8, i8* %5
ret i8 %20
}

LLVM IR (-O2):
define zeroext i8 @equal(i8 zeroext %0, i8 zeroext %1) {
%3 = xor i8 %1, %0
%4 = add i8 %3, -1
%5 = lshr i8 %4, 7
ret i8 %5
}