xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ assert(char *);
int atoi(char *);
int tolower(unsigned char);
int switch_dtmftoi(char *s) {
  int r;
  assert(s);
  if (!(r = atoi(s))) {
    int l = tolower((unsigned char)*s);
    if (l > 96 && l < 101) {
      r = l - 87;
    }
  }
  return r;
}


x86 assembly (clang, -O0):
<switch_dtmftoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jne    118b <switch_dtmftoi+0x5b>
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1040 <tolower@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x60,-0x10(%rbp)
jle    1186 <switch_dtmftoi+0x56>
cmpl   $0x65,-0x10(%rbp)
jge    1186 <switch_dtmftoi+0x56>
mov    -0x10(%rbp),%eax
sub    $0x57,%eax
mov    %eax,-0xc(%rbp)
jmp    118b <switch_dtmftoi+0x5b>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<switch_dtmftoi>:
push   %rbx
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1050 <atoi@plt>
test   %eax,%eax
je     1147 <switch_dtmftoi+0x17>
pop    %rbx
ret
movzbl (%rbx),%edi
call   1040 <tolower@plt>
mov    %eax,%ecx
lea    -0x61(%rcx),%edx
add    $0xffffffa9,%ecx
xor    %eax,%eax
cmp    $0x4,%edx
cmovb  %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @switch_dtmftoi(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @assert(i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @atoi(i8* %7)
store i32 %8, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %23, label %10
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
%13 = call i32 @tolower(i8 zeroext %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 96
br i1 %15, label %16, label %22
16: ; preds = %10
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 101
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %4
%21 = sub nsw i32 %20, 87
store i32 %21, i32* %3
br label %22
22: ; preds = %19, %16, %10
br label %23
23: ; preds = %22, %1
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @switch_dtmftoi(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = tail call i32 @atoi(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i8, i8* %0
%7 = tail call i32 @tolower(i8 zeroext %6)
%8 = add i32 %7, -97
%9 = icmp ult i32 %8, 4
%10 = add nsw i32 %7, -87
%11 = select i1 %9, i32 %10, i32 0
br label %12
12: ; preds = %5, %1
%13 = phi i32 [ %3, %1 ], [ %11, %5 ]
ret i32 %13
}
/* Variables and functions */
float fastlog2(float);
float fastlog(float x) { return (0.6931471805599453f) * fastlog2(x); }


x86 assembly (clang, -O0):
<fastlog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fastlog2@plt>
movaps %xmm0,%xmm1
movss  0xece(%rip),%xmm0
mulss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastlog>:
push   %rax
call   1030 <fastlog2@plt>
mulss  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @fastlog(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @fastlog2(float %3)
%5 = fmul float 0x3FE62E4300000000, %4
ret float %5
}

LLVM IR (-O2):
define float @fastlog(float %0) {
%2 = tail call float @fastlog2(float %0)
%3 = fmul float %2, 0x3FE62E4300000000
ret float %3
}
char input_char() {
  long n;
  n = *(long *)0x100000200;
  return (char)n;
}


x86 assembly (clang, -O0):
<input_char>:
push   %rbp
mov    %rsp,%rbp
movabs $0x100000200,%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_char>:
movabs $0x100000200,%rax
mov    (%rax),%al
ret

LLVM IR (-O0):
define signext i8 @input_char() {
%1 = alloca i64
%2 = load i64, i64* inttoptr (i64 4294967808 to i64*)
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = trunc i64 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @input_char() {
%1 = load i64, i64* inttoptr (i64 4294967808 to i64*)
%2 = trunc i64 %1 to i8
ret i8 %2
}
/* Variables and functions */
int CPUcpsid();
bool IntMasterDisable(void) { return (CPUcpsid()); }


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

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

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

LLVM IR (-O2):
define i32 @IntMasterDisable() {
%1 = tail call i32 (...) @CPUcpsid()
ret i32 %1
}
/* Type definitions */
typedef scalar_t__ time_t;

/* Variables and functions */
int /*<<< orphan*/ srand(unsigned int);
int /*<<< orphan*/ time(scalar_t__ *);
void randomInit(void) {
  time_t seconds;
  time(&seconds);
  srand((unsigned int)seconds);
}


x86 assembly (clang, -O0):
<randomInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1040 <time@plt>
mov    -0x8(%rbp),%rax
mov    %eax,%edi
call   1030 <srand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomInit>:
push   %rax
mov    %rsp,%rdi
call   1040 <time@plt>
mov    (%rsp),%edi
call   1030 <srand@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @randomInit() {
%1 = alloca i64
%2 = call i32 @time(i64* %1)
%3 = load i64, i64* %1
%4 = trunc i64 %3 to i32
%5 = call i32 @srand(i32 %4)
ret void
}

LLVM IR (-O2):
define void @randomInit() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @time(i64* %1)
%4 = load i64, i64* %1
%5 = trunc i64 %4 to i32
%6 = call i32 @srand(i32 %5)
ret void
}
float findafrom_x_vi_vf(float x, float vi, float vf) {
  return ((vf * vf) - vi * vi) / (2 * x);
}


x86 assembly (clang, -O0):
<findafrom_x_vi_vf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xebc(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<findafrom_x_vi_vf>:
mulss  %xmm1,%xmm1
mulss  %xmm2,%xmm2
subss  %xmm1,%xmm2
addss  %xmm0,%xmm0
divss  %xmm0,%xmm2
movaps %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @findafrom_x_vi_vf(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* %6
%8 = load float, float* %6
%9 = load float, float* %5
%10 = load float, float* %5
%11 = fmul float %9, %10
%12 = fneg float %11
%13 = call float @llvm.fmuladd.f32(float %7, float %8, float %12)
%14 = load float, float* %4
%15 = fmul float 2.000000e+00, %14
%16 = fdiv float %13, %15
ret float %16
}

LLVM IR (-O2):
define float @findafrom_x_vi_vf(float %0, float %1, float %2) {
%4 = fneg float %1
%5 = fmul float %4, %1
%6 = tail call float @llvm.fmuladd.f32(float %2, float %2, float %5)
%7 = fmul float %0, 2.000000e+00
%8 = fdiv float %6, %7
ret float %8
}
/* Variables and functions */
int strlen(char *c) {
  int n = 0;
  while (*c != '\0') {
    c++;
    n++;
  }
  return (n);
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1139 <strlen+0x39>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111c <strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
void bar(char *p, int n) {
  int i;
  for (i = 1; i < n; i++)
    p[i - 1] = p[i];
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1147 <bar+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <bar+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
cmp    $0x2,%esi
jl     1128 <bar+0x18>
push   %rax
mov    %esi,%edx
lea    0x1(%rdi),%rsi
add    $0xffffffff,%edx
call   1030 <memmove@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @bar(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr i8, i8* %0, i64 1
%6 = add nsw i32 %1, -1
%7 = zext i32 %6 to i64
br label %8
8: ; preds = %4, %2
ret void
}
A0AR1(r0, r1, x0, x1, p0, p1) signed char r0, r1;
signed char *p0, *p1;
{
  if ((*((signed char *)10000000)) <= (p1[1111111 / 4]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<A0AR1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    $0x989680,%eax
movsbl (%rax),%eax
mov    -0x20(%rbp),%rcx
movsbl 0x43d11(%rcx),%ecx
cmp    %ecx,%eax
jg     1145 <A0AR1+0x45>
movl   $0x1,-0x4(%rbp)
jmp    114c <A0AR1+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<A0AR1>:
mov    0x989680,%cl
xor    %eax,%eax
cmp    0x43d11(%r9),%cl
setle  %al
ret

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

LLVM IR (-O2):
define i32 @A0AR1(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture readnone %4, i8* nocapture %5) {
%7 = load i8, i8* inttoptr (i64 10000000 to i8*)
%8 = getelementptr inbounds i8, i8* %5, i64 277777
%9 = load i8, i8* %8
%10 = icmp sle i8 %7, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Type definitions */
struct reb_simulation {
  int dummy;
};

/* Variables and functions */
int log(double);
double reb_random_uniform(struct reb_simulation *, int, int);
double sqrt(int);
double reb_random_rayleigh(struct reb_simulation *r, double sigma) {
  double y = reb_random_uniform(r, 0., 1.);
  return sigma * sqrt(-2 * log(y));
}


x86 assembly (clang, -O0):
<reb_random_rayleigh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <reb_random_uniform@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
imul   $0xfffffffe,%eax,%edi
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reb_random_rayleigh>:
push   %rax
movsd  %xmm0,(%rsp)
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <reb_random_uniform@plt>
call   1030 <log@plt>
lea    (%rax,%rax,1),%edi
neg    %edi
call   1050 <sqrt@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
%struct.reb_simulation = type { i32 }
define double @reb_random_rayleigh(%struct.reb_simulation* %0, double %1) {
%3 = alloca %struct.reb_simulation*
%4 = alloca double
%5 = alloca double
store %struct.reb_simulation* %0, %struct.reb_simulation** %3
store double %1, double* %4
%6 = load %struct.reb_simulation*, %struct.reb_simulation** %3
%7 = call double @reb_random_uniform(%struct.reb_simulation* %6, i32 0, i32 1)
store double %7, double* %5
%8 = load double, double* %4
%9 = load double, double* %5
%10 = call i32 @log(double %9)
%11 = mul nsw i32 -2, %10
%12 = call double @sqrt(i32 %11)
%13 = fmul double %8, %12
ret double %13
}

LLVM IR (-O2):
%struct.reb_simulation = type { i32 }
define double @reb_random_rayleigh(%struct.reb_simulation* %0, double %1) {
%3 = tail call double @reb_random_uniform(%struct.reb_simulation* %0, i32 0, i32 1)
%4 = tail call i32 @log(double %3)
%5 = mul nsw i32 %4, -2
%6 = tail call double @sqrt(i32 %5)
%7 = fmul double %6, %1
ret double %7
}
/* Variables and functions */
scalar_t__ qe_isalnum_(int);
int qe_isword(int c) { return qe_isalnum_(c) || (c >= 128); }


x86 assembly (clang, -O0):
<qe_isword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <qe_isalnum_@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    1142 <qe_isword+0x32>
cmpl   $0x80,-0x4(%rbp)
setge  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qe_isword>:
push   %rbx
mov    %edi,%ebx
call   1030 <qe_isalnum_@plt>
test   %rax,%rax
setne  %al
cmp    $0x7f,%ebx
setg   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @qe_isword(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @qe_isalnum_(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp sge i32 %7, 128
br label %9
9: ; preds = %6, %1
%10 = phi i1 [ true, %1 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @qe_isword(i32 %0) {
%2 = tail call i64 @qe_isalnum_(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = icmp sgt i32 %0, 127
%5 = or i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
int f(int x) { return (x + 1); }


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

x86 assembly (clang, -O2):
<f>:
lea    0x1(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
unsigned long long my_exp2(int i) {
  unsigned long long val = 1;
  return val << i;
}


x86 assembly (clang, -O0):
<my_exp2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movq   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    %cl,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_exp2>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%rax
ret

LLVM IR (-O0):
define i64 @my_exp2(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
store i64 1, i64* %3
%4 = load i64, i64* %3
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
%7 = shl i64 %4, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @my_exp2(i32 %0) {
%2 = zext i32 %0 to i64
%3 = shl nuw i64 1, %2
ret i64 %3
}
swap(int arr[], int i, int j) {
  int tmp;
  tmp = arr[i];
  arr[i] = arr[j];
  arr[j] = tmp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

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

LLVM IR (-O2):
define i32 @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int main() {
  for (int i = 0; i < 10; ++i) {
    foo();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1145 <main+0x35>
mov    $0x0,%al
call   1030 <foo@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 (...) @foo()
%3 = tail call i32 (...) @foo()
%4 = tail call i32 (...) @foo()
%5 = tail call i32 (...) @foo()
%6 = tail call i32 (...) @foo()
%7 = tail call i32 (...) @foo()
%8 = tail call i32 (...) @foo()
%9 = tail call i32 (...) @foo()
%10 = tail call i32 (...) @foo()
ret i32 0
}
int rand() {
  static unsigned long next = 1;
  next = next * 1103515245 + 12345;
  return (unsigned int)(next / 65536) % 32768;
}


x86 assembly (clang, -O0):
<rand>:
push   %rbp
mov    %rsp,%rbp
imul   $0x41c64e6d,0x2f11(%rip),%rax
6d 4e c6 41
add    $0x3039,%rax
mov    %rax,0x2f04(%rip)
mov    0x2efd(%rip),%rax
shr    $0x10,%rax
and    $0x7fff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand>:
imul   $0x41c64e6d,0x2f15(%rip),%rax
6d 4e c6 41
add    $0x3039,%rax
mov    %rax,0x2f08(%rip)
shr    $0x10,%eax
and    $0x7fff,%eax
ret

LLVM IR (-O0):
@rand.next = internal global i64 1
define i32 @rand() {
%1 = load i64, i64* @rand.next
%2 = mul i64 %1, 1103515245
%3 = add i64 %2, 12345
store i64 %3, i64* @rand.next
%4 = load i64, i64* @rand.next
%5 = udiv i64 %4, 65536
%6 = trunc i64 %5 to i32
%7 = urem i32 %6, 32768
ret i32 %7
}

LLVM IR (-O2):
@rand.next = internal unnamed_addr global i64 1
define i32 @rand() {
%1 = load i64, i64* @rand.next
%2 = mul i64 %1, 1103515245
%3 = add i64 %2, 12345
store i64 %3, i64* @rand.next
%4 = trunc i64 %3 to i32
%5 = lshr i32 %4, 16
%6 = and i32 %5, 32767
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ print(int, int, int, int);
int main() {
  print(3, 1, 2, 3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%ecx
mov    $0x1,%esi
mov    $0x2,%edx
mov    %ecx,%edi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1030 <print@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @print(i32 3, i32 1, i32 2, i32 3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ FixedWingAirspeedsHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void FixedWingAirspeedsUpdated() { UAVObjUpdated(FixedWingAirspeedsHandle()); }


x86 assembly (clang, -O0):
<FixedWingAirspeedsUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <FixedWingAirspeedsHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<FixedWingAirspeedsUpdated>:
push   %rax
xor    %eax,%eax
call   1030 <FixedWingAirspeedsHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @FixedWingAirspeedsUpdated() {
%1 = call i32 (...) @FixedWingAirspeedsHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @FixedWingAirspeedsUpdated() {
%1 = tail call i32 (...) @FixedWingAirspeedsHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
/* Variables and functions */
int identifier_end(int);
int iterate_identifier_end(int start) {
  int x;
  while (1) {
    x = identifier_end(start);
    if (x == start)
      return x;
    start = x;
  }
}


x86 assembly (clang, -O0):
<iterate_identifier_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <identifier_end@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    113b <iterate_identifier_end+0x2b>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    111b <iterate_identifier_end+0xb>

x86 assembly (clang, -O2):
<iterate_identifier_end>:
push   %rbx
mov    %edi,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <identifier_end@plt>
cmp    %ebx,%eax
jne    1120 <iterate_identifier_end+0x10>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @iterate_identifier_end(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %4, %2 ]
%4 = tail call i32 @identifier_end(i32 %3)
%5 = icmp eq i32 %4, %3
br i1 %5, label %6, label %2
6: ; preds = %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ _SC_NPROCESSORS_ONLN;
scalar_t__ sysconf(int /*<<< orphan*/);
int Get_SMP_CPU_num(void) { return (int)sysconf(_SC_NPROCESSORS_ONLN); }


x86 assembly (clang, -O0):
<Get_SMP_CPU_num>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_SMP_CPU_num>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <sysconf@plt>

LLVM IR (-O0):
@_SC_NPROCESSORS_ONLN = global i32 0
define i32 @Get_SMP_CPU_num() {
%1 = load i32, i32* @_SC_NPROCESSORS_ONLN
%2 = call i64 @sysconf(i32 %1)
%3 = trunc i64 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
@_SC_NPROCESSORS_ONLN = global i32 0
define i32 @Get_SMP_CPU_num() {
%1 = load i32, i32* @_SC_NPROCESSORS_ONLN
%2 = tail call i64 @sysconf(i32 %1)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ kalman_gravity_demo();
int /*<<< orphan*/ kalman_gravity_demo_lambda();
int /*<<< orphan*/ matrix_unittests();
void main() {
  matrix_unittests();
  kalman_gravity_demo();
  kalman_gravity_demo_lambda();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <matrix_unittests@plt>
mov    $0x0,%al
call   1030 <kalman_gravity_demo@plt>
mov    $0x0,%al
call   1040 <kalman_gravity_demo_lambda@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <matrix_unittests@plt>
xor    %eax,%eax
call   1030 <kalman_gravity_demo@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <kalman_gravity_demo_lambda@plt>

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @matrix_unittests()
%2 = call i32 (...) @kalman_gravity_demo()
%3 = call i32 (...) @kalman_gravity_demo_lambda()
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @matrix_unittests()
%2 = tail call i32 (...) @kalman_gravity_demo()
%3 = tail call i32 (...) @kalman_gravity_demo_lambda()
ret void
}
void drawTri(int side_length, int x, int y) {}


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

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

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

LLVM IR (-O2):
define void @drawTri(i32 %0, i32 %1, i32 %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ move_file(char *, char *);
int /*<<< orphan*/ pre_write(char *);
void sendstl(char *path) {
  pre_write(" all stl ");
  move_file("mesh.stl", path);
}


x86 assembly (clang, -O0):
<sendstl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1040 <pre_write@plt>
mov    -0x8(%rbp),%rsi
lea    0xec7(%rip),%rdi
call   1030 <move_file@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendstl>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <pre_write@plt>
lea    0xed3(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <move_file@plt>

LLVM IR (-O0):
@.str = [10 x i8] c" all stl \00"
@.str.1 = [9 x i8] c"mesh.stl\00"
define void @sendstl(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @pre_write(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @move_file(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c" all stl \00"
@.str.1 = [9 x i8] c"mesh.stl\00"
define void @sendstl(i8* %0) {
%2 = tail call i32 @pre_write(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @move_file(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int M_PI;
int exp(double);
double function(double _x) {
  double t = _x - M_PI / 2;
  double y = 1 - exp(-t * t);
  return y;
}


x86 assembly (clang, -O0):
<function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2ebf(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
cvtsi2sd %ecx,%xmm1
subsd  %xmm1,%xmm0
movapd 0xecd(%rip),%xmm1
xorpd  %xmm0,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global i32 0
define double @function(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = load i32, i32* @M_PI
%7 = sdiv i32 %6, 2
%8 = sitofp i32 %7 to double
%9 = fsub double %5, %8
store double %9, double* %3
%10 = load double, double* %3
%11 = fneg double %10
%12 = load double, double* %3
%13 = fmul double %11, %12
%14 = call i32 @exp(double %13)
%15 = sub nsw i32 1, %14
%16 = sitofp i32 %15 to double
store double %16, double* %4
%17 = load double, double* %4
ret double %17
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @function(double %0) {
%2 = load i32, i32* @M_PI
%3 = sdiv i32 %2, 2
%4 = sitofp i32 %3 to double
%5 = fsub double %0, %4
%6 = fneg double %5
%7 = fmul double %5, %6
%8 = tail call i32 @exp(double %7)
%9 = sub nsw i32 1, %8
%10 = sitofp i32 %9 to double
ret double %10
}
double modf(double x, double *ip) {
  int a = (int)x;
  return (double)a;
}


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

x86 assembly (clang, -O2):
<modf>:
cvttpd2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @modf(double %0, double* %1) {
%3 = alloca double
%4 = alloca double*
%5 = alloca i32
store double %0, double* %3
store double* %1, double** %4
%6 = load double, double* %3
%7 = fptosi double %6 to i32
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = sitofp i32 %8 to double
ret double %9
}

LLVM IR (-O2):
define double @modf(double %0, double* nocapture readnone %1) {
%3 = fptosi double %0 to i32
%4 = sitofp i32 %3 to double
ret double %4
}
int fn3(dpy, winInfo, visrgn)
struct _XDisplay *dpy;
int winInfo, visrgn;
{
  int b = fn1(0, winInfo);
  fn4(0, 0, visrgn);
}


x86 assembly (clang, -O0):
<fn3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x14(%rbp),%esi
xor    %edi,%edi
mov    $0x0,%al
call   1030 <fn1@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%edx
xor    %esi,%esi
mov    %esi,%edi
mov    $0x0,%al
call   1040 <fn4@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn3>:
push   %rbx
mov    %edx,%ebx
xor    %edi,%edi
xor    %eax,%eax
call   1030 <fn1@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    %ebx,%edx
xor    %eax,%eax
pop    %rbx
jmp    1040 <fn4@plt>

LLVM IR (-O0):
%struct._XDisplay = type opaque
define i32 @fn3(%struct._XDisplay* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct._XDisplay*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct._XDisplay* %0, %struct._XDisplay** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %6
%10 = call i32 (i32, i32, ...) bitcast (i32 (...)* @fn1 to i32 (i32, i32, ...)*)(i32 0, i32 %9)
store i32 %10, i32* %8
%11 = load i32, i32* %7
%12 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @fn4 to i32 (i32, i32, i32, ...)*)(i32 0, i32 0, i32 %11)
%13 = load i32, i32* %4
ret i32 %13
}

LLVM IR (-O2):
%struct._XDisplay = type opaque
define i32 @fn3(%struct._XDisplay* nocapture readnone %0, i32 %1, i32 %2) {
%4 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @fn1 to i32 (i32, i32, ...)*)(i32 0, i32 %1)
%5 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @fn4 to i32 (i32, i32, i32, ...)*)(i32 0, i32 0, i32 %2)
ret i32 undef
}
int rtl931x_mac_port_ctrl(int p) { return (0x6000) + (p << 7); }


x86 assembly (clang, -O0):
<rtl931x_mac_port_ctrl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x7,%eax
add    $0x6000,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtl931x_mac_port_ctrl>:
shl    $0x7,%edi
lea    0x6000(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @rtl931x_mac_port_ctrl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 7
%5 = add nsw i32 24576, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @rtl931x_mac_port_ctrl(i32 %0) {
%2 = shl i32 %0, 7
%3 = add nsw i32 %2, 24576
ret i32 %3
}
/* Variables and functions */
short strpos2(char *, char *, int);
short STRPOS(char *S1, char *S2) { return strpos2(S2, S1, 1); }


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

x86 assembly (clang, -O2):
<STRPOS>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
mov    $0x1,%edx
jmp    1030 <strpos2@plt>

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

LLVM IR (-O2):
define signext i16 @STRPOS(i8* %0, i8* %1) {
%3 = tail call signext i16 @strpos2(i8* %1, i8* %0, i32 1)
ret i16 %3
}
/* Variables and functions */
int /*<<< orphan*/ Com_Printf(char *);
void R_TagInfo_f(void) { Com_Printf("command not functional\n"); }


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"command not functional\0A\00"
define void @R_TagInfo_f() {
%1 = call i32 @Com_Printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"command not functional\0A\00"
define void @R_TagInfo_f() {
%1 = tail call i32 @Com_Printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}
void __log__(const char *msg, ...) {}


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

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

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

LLVM IR (-O2):
define void @__log__(i8* nocapture %0, ...) {
ret void
}
void nfinish() {}


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

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

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

LLVM IR (-O2):
define void @nfinish() {
ret void
}
AR0AX1(r0, r1, x0, x1, p0, p1) unsigned int r0, r1;
unsigned int *p0, *p1;
{
  if ((p0[10000000]) <= (((unsigned int *)11111111)[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<AR0AX1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2625a00(%rax),%eax
movslq -0x14(%rbp),%rdx
mov    $0xa98ac7,%ecx
cmp    (%rcx,%rdx,4),%eax
ja     1140 <AR0AX1+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1147 <AR0AX1+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AR0AX1>:
mov    0x2625a00(%r8),%edx
movslq %ecx,%rcx
xor    %eax,%eax
cmp    0xa98ac7(,%rcx,4),%edx
setbe  %al
ret

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

LLVM IR (-O2):
define i32 @AR0AX1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4, i32* nocapture readnone %5) {
%7 = getelementptr inbounds i32, i32* %4, i64 10000000
%8 = load i32, i32* %7
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i32, i32* inttoptr (i64 11111111 to i32*), i64 %9
%11 = load i32, i32* %10
%12 = icmp ule i32 %8, %11
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Type definitions */
struct task_struct {
  int dummy;
};
struct rq {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ requeue_task_rt(struct rq *, struct task_struct *);
void yield_task_rt(struct rq *rq, struct task_struct *p) {
  requeue_task_rt(rq, p);
}


x86 assembly (clang, -O0):
<yield_task_rt>:
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 <requeue_task_rt@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.rq = type { i32 }
%struct.task_struct = type { i32 }
define void @yield_task_rt(%struct.rq* %0, %struct.task_struct* %1) {
%3 = alloca %struct.rq*
%4 = alloca %struct.task_struct*
store %struct.rq* %0, %struct.rq** %3
store %struct.task_struct* %1, %struct.task_struct** %4
%5 = load %struct.rq*, %struct.rq** %3
%6 = load %struct.task_struct*, %struct.task_struct** %4
%7 = call i32 @requeue_task_rt(%struct.rq* %5, %struct.task_struct* %6)
ret void
}

LLVM IR (-O2):
%struct.rq = type { i32 }
%struct.task_struct = type { i32 }
define void @yield_task_rt(%struct.rq* %0, %struct.task_struct* %1) {
%3 = tail call i32 @requeue_task_rt(%struct.rq* %0, %struct.task_struct* %1)
ret void
}
void testClosureBSBrV(void (*closure)(char, short, char), char a1, short a2,
                      char a3) {
  (*closure)(a1, a2, a3);
}


x86 assembly (clang, -O0):
<testClosureBSBrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dx,%cx
mov    %sil,%dl
mov    %rdi,-0x8(%rbp)
mov    %dl,-0x9(%rbp)
mov    %cx,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x9(%rbp),%dl
mov    -0xc(%rbp),%cx
movsbl %dl,%edi
movswl %cx,%esi
movsbl -0xd(%rbp),%edx
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureBSBrV>:
mov    %rdi,%rax
mov    %esi,%edi
mov    %edx,%esi
mov    %ecx,%edx
jmp    *%rax

LLVM IR (-O0):
define void @testClosureBSBrV(void (i8, i16, i8)* %0, i8 signext %1, i16 signext %2, i8 signext %3) {
%5 = alloca void (i8, i16, i8)*
%6 = alloca i8
%7 = alloca i16
%8 = alloca i8
store void (i8, i16, i8)* %0, void (i8, i16, i8)** %5
store i8 %1, i8* %6
store i16 %2, i16* %7
store i8 %3, i8* %8
%9 = load void (i8, i16, i8)*, void (i8, i16, i8)** %5
%10 = load i8, i8* %6
%11 = load i16, i16* %7
%12 = load i8, i8* %8
ret void
}

LLVM IR (-O2):
define void @testClosureBSBrV(void (i8, i16, i8)* nocapture %0, i8 signext %1, i16 signext %2, i8 signext %3) {
tail call void %0(i8 signext %1, i16 signext %2, i8 signext %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ trap_R_RegisterShaderNoMip(char *);
void UI_TeamOrdersMenu_Cache(void) {
  trap_R_RegisterShaderNoMip("menu/"
                             "art_blueish"
                             "/addbotframe");
  trap_R_RegisterShaderNoMip("menu/"
                             "art_blueish"
                             "/back_0");
  trap_R_RegisterShaderNoMip("menu/"
                             "art_blueish"
                             "/back_1");
}


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

x86 assembly (clang, -O2):
<UI_TeamOrdersMenu_Cache>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <trap_R_RegisterShaderNoMip@plt>
lea    0xef9(%rip),%rdi
call   1030 <trap_R_RegisterShaderNoMip@plt>
lea    0xf05(%rip),%rdi
pop    %rax
jmp    1030 <trap_R_RegisterShaderNoMip@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"menu/art_blueish/addbotframe\00"
@.str.1 = [24 x i8] c"menu/art_blueish/back_0\00"
@.str.2 = [24 x i8] c"menu/art_blueish/back_1\00"
define void @UI_TeamOrdersMenu_Cache() {
%1 = call i32 @trap_R_RegisterShaderNoMip(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @trap_R_RegisterShaderNoMip(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @trap_R_RegisterShaderNoMip(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"menu/art_blueish/addbotframe\00"
@.str.1 = [24 x i8] c"menu/art_blueish/back_0\00"
@.str.2 = [24 x i8] c"menu/art_blueish/back_1\00"
define void @UI_TeamOrdersMenu_Cache() {
%1 = tail call i32 @trap_R_RegisterShaderNoMip(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @trap_R_RegisterShaderNoMip(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @trap_R_RegisterShaderNoMip(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
void main(void) {
  int *p = malloc(sizeof(int) * 2);
  printf("O endereço alocado foi: %p\n", p);
  *p = 1500;
  printf("%i\n", *p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movl   $0x5dc,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xecb(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x5dc,(%rbx)
lea    0xed1(%rip),%rdi
mov    $0x5dc,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"O endere\C3\A7o alocado foi: %p\0A\00"
@.str.1 = [4 x i8] c"%i\0A\00"
define void @main() {
%1 = alloca i32*
%2 = call i32* @malloc(i32 8)
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32* %3)
%5 = load i32*, i32** %1
store i32 1500, i32* %5
%6 = load i32*, i32** %1
%7 = load i32, i32* %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"O endere\C3\A7o alocado foi: %p\0A\00"
@.str.1 = [4 x i8] c"%i\0A\00"
define void @main() {
%1 = tail call i32* @malloc(i32 8)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32* %1)
store i32 1500, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1500)
ret void
}
/* Variables and functions */
void *calloc(int, size_t);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void *checkedmalloc(size_t n) {
  void *p;
  if ((p = calloc(1, n)) == NULL) {
    fprintf(stderr, "Sorry, not enough memory available!\n");
    exit(1);
  }
  return p;
}


x86 assembly (clang, -O0):
<checkedmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1177 <checkedmalloc+0x47>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
lea    0xe98(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkedmalloc>:
push   %rax
mov    %rdi,%rsi
mov    $0x1,%edi
call   1030 <calloc@plt>
test   %rax,%rax
je     1145 <checkedmalloc+0x15>
pop    %rcx
ret
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xeab(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Sorry, not enough memory available!\0A\00"
define i8* @checkedmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @calloc(i32 1, i64 %4)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Sorry, not enough memory available!\0A\00"
define i8* @checkedmalloc(i64 %0) {
%2 = tail call i8* @calloc(i32 1, 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 ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
char const *utf8suffix(char const *, int);
const char *utf8getlastn(const char *x, int len) { return utf8suffix(x, len); }


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

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

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

LLVM IR (-O2):
define i8* @utf8getlastn(i8* %0, i32 %1) {
%3 = tail call i8* @utf8suffix(i8* %0, i32 %1)
ret i8* %3
}