xunge/DecIR huggingface dataset:
int hash(char *line) {
  int i;
  unsigned sum = 0;
  for (i = 0; line[i] != '\0'; i++) {
    sum += line[i];
  }
  return (sum % 12);
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     114b <hash+0x4b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <hash+0x16>
mov    -0x10(%rbp),%eax
mov    $0xc,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1138 <hash+0x38>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
mov    %eax,%ecx
mov    $0xaaaaaaab,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
shl    $0x2,%edx
lea    (%rdx,%rdx,2),%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %10, %4 ], [ 0, %1 ]
%6 = phi i8 [ %12, %4 ], [ %2, %1 ]
%7 = phi i32 [ %9, %4 ], [ 0, %1 ]
%8 = sext i8 %6 to i32
%9 = add i32 %7, %8
%10 = add nuw nsw i64 %5, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = urem i32 %9, 12
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ multilibA_setup();
int /*<<< orphan*/ multilibB_setup();
void multilib_setup(void) {
  multilibA_setup();
  multilibB_setup();
}


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

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

LLVM IR (-O0):
define void @multilib_setup() {
%1 = call i32 (...) @multilibA_setup()
%2 = call i32 (...) @multilibB_setup()
ret void
}

LLVM IR (-O2):
define void @multilib_setup() {
%1 = tail call i32 (...) @multilibA_setup()
%2 = tail call i32 (...) @multilibB_setup()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ stdout;
int main() {
  int i = 0;
  double a = 2.3, s = 123.45;
  while (i < 2048576) {
    printf("s=%lf\n", s += a);
    fflush(stdout);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movsd  0xeca(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeb5(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x1f4240,-0x8(%rbp)
jge    1194 <main+0x74>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movsd  0xed0(%rip),%xmm0
mov    $0x1f4240,%ebp
lea    0xed4(%rip),%r14
mov    0x2e9d(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
addsd  0xeb0(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
movsd  0x8(%rsp),%xmm0
call   1030 <printf@plt>
mov    (%rbx),%edi
call   1040 <fflush@plt>
movsd  0x8(%rsp),%xmm0
add    $0xffffffff,%ebp
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"s=%lf\0A\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
store i32 0, i32* %2
store double 2.300000e+00, double* %3
store double 1.234500e+02, double* %4
br label %5
5: ; preds = %8, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 2048576
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load double, double* %3
%10 = load double, double* %4
%11 = fadd double %10, %9
store double %11, double* %4
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %11)
%13 = load i32, i32* @stdout
%14 = call i32 @fflush(i32 %13)
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %5
17: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"s=%lf\0A\00"
@stdout = global i32 0
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi double [ 1.234500e+02, %0 ], [ %4, %1 ]
%3 = phi i32 [ 0, %0 ], [ %8, %1 ]
%4 = fadd double %2, 2.300000e+00
%5 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %4)
%6 = load i32, i32* @stdout
%7 = tail call i32 @fflush(i32 %6)
%8 = add nuw nsw i32 %3, 1
%9 = icmp eq i32 %8, 2048576
br i1 %9, label %10, label %1
10: ; preds = %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ lua_check_string(int, char *);
int /*<<< orphan*/ lua_pushnumber(int /*<<< orphan*/);
int /*<<< orphan*/ system(int /*<<< orphan*/);
void io_execute(void) {
  lua_pushnumber(system(lua_check_string(1, "execute")));
}


x86 assembly (clang, -O0):
<io_execute>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xec0(%rip),%rsi
call   1030 <lua_check_string@plt>
mov    %eax,%edi
call   1040 <system@plt>
mov    %eax,%edi
call   1050 <lua_pushnumber@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_execute>:
push   %rax
lea    0xec8(%rip),%rsi
mov    $0x1,%edi
call   1030 <lua_check_string@plt>
mov    %eax,%edi
call   1040 <system@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <lua_pushnumber@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"execute\00"
define void @io_execute() {
%1 = call i32 @lua_check_string(i32 1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @system(i32 %1)
%3 = call i32 @lua_pushnumber(i32 %2)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"execute\00"
define void @io_execute() {
%1 = tail call i32 @lua_check_string(i32 1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i32 %1)
%3 = tail call i32 @lua_pushnumber(i32 %2)
ret void
}
/* Variables and functions */
double exp(double);
double sqrt(int);
double airGaussian(double x, double mean, double stdv) {
  x = x - mean;
  return exp(-(x * x) / (2 * stdv * stdv)) /
         (stdv * sqrt(2 * 3.14159265358979323846));
}


x86 assembly (clang, -O0):
<airGaussian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe91(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    $0x6,%edi
call   1040 <sqrt@plt>
movsd  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<airGaussian>:
sub    $0x18,%rsp
movsd  %xmm2,0x10(%rsp)
subsd  %xmm1,%xmm0
movapd 0xeca(%rip),%xmm1
xorpd  %xmm0,%xmm1
mulsd  %xmm1,%xmm0
movapd %xmm2,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x6,%edi
call   1040 <sqrt@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @airGaussian(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fsub double %7, %8
store double %9, double* %4
%10 = load double, double* %4
%11 = load double, double* %4
%12 = fmul double %10, %11
%13 = fneg double %12
%14 = load double, double* %6
%15 = fmul double 2.000000e+00, %14
%16 = load double, double* %6
%17 = fmul double %15, %16
%18 = fdiv double %13, %17
%19 = call double @exp(double %18)
%20 = load double, double* %6
%21 = call double @sqrt(i32 6)
%22 = fmul double %20, %21
%23 = fdiv double %19, %22
ret double %23
}

LLVM IR (-O2):
define double @airGaussian(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = fneg double %4
%6 = fmul double %4, %5
%7 = fmul double %2, 2.000000e+00
%8 = fmul double %7, %2
%9 = fdiv double %6, %8
%10 = tail call double @exp(double %9)
%11 = tail call double @sqrt(i32 6)
%12 = fmul double %11, %2
%13 = fdiv double %10, %12
ret double %13
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void die(const char *msg) {
  fprintf(stderr, "%s\n", msg);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @die(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Type definitions */
struct VectorVectorBase {
  int dummy;
};

/* Variables and functions */
void FreeVectorVectorBase(struct VectorVectorBase *);
void free_vector_vector_base(struct VectorVectorBase *basev) {
  return FreeVectorVectorBase(basev);
}


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

x86 assembly (clang, -O2):
<free_vector_vector_base>:
jmp    1030 <FreeVectorVectorBase@plt>

LLVM IR (-O0):
%struct.VectorVectorBase = type { i32 }
define void @free_vector_vector_base(%struct.VectorVectorBase* %0) {
%2 = alloca %struct.VectorVectorBase*
store %struct.VectorVectorBase* %0, %struct.VectorVectorBase** %2
%3 = load %struct.VectorVectorBase*, %struct.VectorVectorBase** %2
ret void
}

LLVM IR (-O2):
%struct.VectorVectorBase = type { i32 }
define void @free_vector_vector_base(%struct.VectorVectorBase* %0) {
tail call void @FreeVectorVectorBase(%struct.VectorVectorBase* %0)
ret void
}
/* Variables and functions */
int SIGINT;
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ nl();
int /*<<< orphan*/ nocbreak();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ signal(int, void (*)(int));
void catch (int sig) {
  if (sig == SIGINT) {
    signal(sig, catch);
    return;
  }
  nocbreak();
  nl();
  endwin();
  printf("Died on signal %d\n", sig);
  exit(2);
}


x86 assembly (clang, -O0):
<catch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%eax
jne    1192 <catch+0x32>
mov    -0x4(%rbp),%edi
mov    0x2e59(%rip),%rsi
call   1050 <signal@plt>
add    $0x10,%rsp
pop    %rbp
ret
mov    $0x0,%al
call   1070 <nocbreak@plt>
mov    $0x0,%al
call   1030 <nl@plt>
mov    $0x0,%al
call   1060 <endwin@plt>
mov    -0x4(%rbp),%esi
lea    0xe4f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<catch>:
push   %rbx
mov    %edi,%ebx
mov    0x2e7e(%rip),%rax
cmp    %edi,(%rax)
jne    117d <catch+0x1d>
mov    0x2e6b(%rip),%rsi
mov    %ebx,%edi
pop    %rbx
jmp    1050 <signal@plt>
xor    %eax,%eax
call   1070 <nocbreak@plt>
xor    %eax,%eax
call   1030 <nl@plt>
xor    %eax,%eax
call   1060 <endwin@plt>
lea    0xe67(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    $0x2,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
@.str = [19 x i8] c"Died on signal %d\0A\00"
define void @catch(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGINT
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @signal(i32 %7, void (i32)* @catch)
ret void
9: ; preds = %1
%10 = call i32 (...) @nocbreak()
%11 = call i32 (...) @nl()
%12 = call i32 (...) @endwin()
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@SIGINT = global i32 0
@.str = [19 x i8] c"Died on signal %d\0A\00"
define void @catch(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @signal(i32 %0, void (i32)* @catch)
ret void
6: ; preds = %1
%7 = tail call i32 (...) @nocbreak()
%8 = tail call i32 (...) @nl()
%9 = tail call i32 (...) @endwin()
%10 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %0)
%11 = tail call i32 @exit(i32 2)
unreachable
}
void endCapturing2RPAR() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ glRasterPos3sv(int /*<<< orphan*/ *);
void RasterPos3sv(GLshort v[3]) { glRasterPos3sv(v); }


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

x86 assembly (clang, -O2):
<RasterPos3sv>:
jmp    1030 <glRasterPos3sv@plt>

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

LLVM IR (-O2):
define void @RasterPos3sv(i32* %0) {
%2 = tail call i32 @glRasterPos3sv(i32* %0)
ret void
}
/* Variables and functions */
void *malloc_func(size_t);
void *malloc_via_ptr(size_t size) {
  void *ret = NULL;
  if (size <= 0) {
    return NULL;
  }
  ret = malloc_func(size);
  return ret;
}


x86 assembly (clang, -O0):
<malloc_via_ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
ja     113c <malloc_via_ptr+0x2c>
movq   $0x0,-0x8(%rbp)
jmp    1151 <malloc_via_ptr+0x41>
mov    -0x10(%rbp),%rdi
call   1030 <malloc_func@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc_via_ptr>:
test   %rdi,%rdi
je     111a <malloc_via_ptr+0xa>
jmp    1030 <malloc_func@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @malloc_via_ptr(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i8* @malloc_func(i64 %0)
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ %4, %3 ], [ null, %1 ]
ret i8* %6
}
void swap(char str[], int i, int j) {
  char temp;
  temp = str[i];
  str[i] = str[j];
  str[j] = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @swap(i8* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
store i8 %9, i8* %5
store i8 %6, i8* %8
ret void
}
/* Variables and functions */
double strtod(char const *, char **);
__attribute__((visibility("default"))) double trio_to_double(const char *source,
                                                             char **endp) {
  return strtod(source, endp);
}


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

x86 assembly (clang, -O2):
<trio_to_double>:
jmp    1030 <strtod@plt>

LLVM IR (-O0):
define double @trio_to_double(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 double @strtod(i8* %5, i8** %6)
ret double %7
}

LLVM IR (-O2):
define double @trio_to_double(i8* %0, i8** nocapture %1) {
%3 = tail call double @strtod(i8* %0, i8** %1)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ c();
int /*<<< orphan*/ d();
int /*<<< orphan*/ e();
int /*<<< orphan*/ f();
int /*<<< orphan*/ printf(char *);
void b(int i) {
  printf("this is b\n");
  if (i == 1) {
    c();
    f();
  } else {
    for (int i = 0; i < 2; i++) {
      d();
    }
    e();
  }
}


x86 assembly (clang, -O0):
<b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xe9e(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    1184 <b+0x34>
mov    $0x0,%al
call   1070 <c@plt>
mov    $0x0,%al
call   1040 <f@plt>
jmp    11b1 <b+0x61>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11aa <b+0x5a>
mov    $0x0,%al
call   1030 <d@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118b <b+0x3b>
mov    $0x0,%al
call   1060 <e@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<b>:
push   %rbx
mov    %edi,%ebx
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
cmp    $0x1,%ebx
jne    1173 <b+0x23>
call   1070 <c@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <f@plt>
call   1040 <d@plt>
xor    %eax,%eax
call   1040 <d@plt>
xor    %eax,%eax
pop    %rbx
jmp    1060 <e@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"this is b\0A\00"
define void @b(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = call i32 (...) @c()
%9 = call i32 (...) @f()
br label %21
10: ; preds = %1
store i32 0, i32* %3
br label %11
11: ; preds = %16, %10
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = call i32 (...) @d()
br label %16
16: ; preds = %14
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %11
19: ; preds = %11
%20 = call i32 (...) @e()
br label %21
21: ; preds = %19, %7
ret void
}

LLVM IR (-O2):
@str = [10 x i8] c"this is b\00"
define void @b(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%3 = icmp eq i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 (...) @d()
%6 = tail call i32 (...) @d()
%7 = tail call i32 (...) @e()
br label %11
8: ; preds = %1
%9 = tail call i32 (...) @c()
%10 = tail call i32 (...) @f()
br label %11
11: ; preds = %4, %8
ret void
}
/* Variables and functions */
scalar_t__ _syscall5(int, void *, void *, void *, void *, void *);
int errno;
int symlink(const char *target, const char *linkpath) {
  int ret = (int)_syscall5(45, (void *)target, (void *)linkpath, ((void *)0),
                           ((void *)0), ((void *)0));
  if (ret < 0) {
    errno = -ret;
    ret = -1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<symlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x2d,%edi
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%rcx
mov    %r9,%r8
call   1030 <_syscall5@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    115f <symlink+0x4f>
xor    %ecx,%ecx
sub    -0x14(%rbp),%ecx
mov    0x2e8a(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<symlink>:
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x2d,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <_syscall5@plt>
test   %eax,%eax
js     112f <symlink+0x1f>
pop    %rcx
ret
neg    %eax
mov    0x2ea8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @symlink(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i64 @_syscall5(i32 45, i8* %6, i8* %7, i8* null, i8* null, i8* null)
%9 = trunc i64 %8 to i32
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* %5
%14 = sub nsw i32 0, %13
store i32 %14, i32* @errno
store i32 -1, i32* %5
br label %15
15: ; preds = %12, %2
%16 = load i32, i32* %5
ret i32 %16
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @symlink(i8* %0, i8* %1) {
%3 = tail call i64 @_syscall5(i32 45, i8* %0, i8* %1, i8* null, i8* null, i8* null)
%4 = trunc i64 %3 to i32
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = sub nsw i32 0, %4
store i32 %7, i32* @errno
br label %8
8: ; preds = %6, %2
%9 = phi i32 [ -1, %6 ], [ %4, %2 ]
ret i32 %9
}
void testPA() {
  int a;
  int *p;
  p = &a;
  a = 65;
  *((int *)p) = (int *)50;
  test(a == 50);
}


x86 assembly (clang, -O0):
<testPA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x41,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x32,%ecx
mov    %ecx,(%rax)
cmpl   $0x32,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testPA>:
mov    $0x1,%edi
xor    %eax,%eax
jmp    1030 <test@plt>

LLVM IR (-O0):
define void @testPA() {
%1 = alloca i32
%2 = alloca i32*
store i32* %1, i32** %2
store i32 65, i32* %1
%3 = load i32*, i32** %2
store i32 ptrtoint (i32* inttoptr (i64 50 to i32*) to i32), i32* %3
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 50
%6 = zext i1 %5 to i32
%7 = call i32 (i32, ...) bitcast (i32 (...)* @test to i32 (i32, ...)*)(i32 %6)
ret void
}

LLVM IR (-O2):
define void @testPA() {
%1 = tail call i32 (i32, ...) bitcast (i32 (...)* @test to i32 (i32, ...)*)(i32 1)
ret void
}
void foo554(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo554(i32 %0) {
ret void
}
void alternate_case(char *s) {}


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

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

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

LLVM IR (-O2):
define void @alternate_case(i8* nocapture %0) {
ret void
}
/* Variables and functions */
size_t strlen(const char *s) {
  size_t i = 0;
  while (*s != '\0') {
    i++;
    s++;
  }
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     113d <strlen+0x3d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @strlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %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 i64, i64* %3
%11 = add i64 %10, 1
store i64 %11, i64* %3
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %2
br label %4
14: ; preds = %4
%15 = load i64, i64* %3
ret i64 %15
}

LLVM IR (-O2):
define i64 @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 i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = add i64 %5, 1
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i64 [ 0, %1 ], [ %7, %4 ]
ret i64 %12
}
char *langRomTypeCrossblaim() { return "Crossblaim"; }


x86 assembly (clang, -O0):
<langRomTypeCrossblaim>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<langRomTypeCrossblaim>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Crossblaim\00"
define i8* @langRomTypeCrossblaim() {
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [11 x i8] c"Crossblaim\00"
define i8* @langRomTypeCrossblaim() {
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
int fpeek(FILE *input) {
  int tmp = getc(input);
  ungetc(tmp, input);
  return tmp;
}


x86 assembly (clang, -O0):
<fpeek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1030 <ungetc@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fpeek>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <getc@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %rbx,%rsi
call   1030 <ungetc@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fpeek(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @getc(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i32*, i32** %2
%8 = call i32 @ungetc(i32 %6, i32* %7)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @fpeek(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = tail call i32 @ungetc(i32 %2, i32* %0)
ret i32 %2
}
/* Variables and functions */
int api0(int);
int getpid(void) { return api0(20); }


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

x86 assembly (clang, -O2):
<getpid>:
mov    $0x14,%edi
jmp    1030 <api0@plt>

LLVM IR (-O0):
define i32 @getpid() {
%1 = call i32 @api0(i32 20)
ret i32 %1
}

LLVM IR (-O2):
define i32 @getpid() {
%1 = tail call i32 @api0(i32 20)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ register_mtgnp_function_list();
void mtgnp_init() { register_mtgnp_function_list(); }


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

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

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

LLVM IR (-O2):
define void @mtgnp_init() {
%1 = tail call i32 (...) @register_mtgnp_function_list()
ret void
}
/* Variables and functions */
int longestPlateau(int *, int);
int /*<<< orphan*/ printf(char *, int);
void testPlateau() {
  int xs[] = {1, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 6, 6, 7};
  int count = 14;
  printf("longest plateau in array is of length %d\n",
         longestPlateau(xs, count));
}


x86 assembly (clang, -O0):
<testPlateau>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x38,%edx
call   1050 <memcpy@plt>
movl   $0xe,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1030 <longestPlateau@plt>
mov    %eax,%esi
lea    0xecf(%rip),%rdi
call   1040 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testPlateau>:
sub    $0x38,%rsp
mov    0xf05(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xe,%esi
call   1030 <longestPlateau@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.testPlateau.xs = [14 x i32] [i32 1, i32 2, i32 2, i32 3, i32 3, i32 3, i32 4, i32 5, i32 5, i32 6, i32 6, i32 6, i32 6, i32 7]
@.str = [42 x i8] c"longest plateau in array is of length %d\0A\00"
define void @testPlateau() {
%1 = alloca [14 x i32]
%2 = alloca i32
%3 = bitcast [14 x i32]* %1 to i8*
store i32 14, i32* %2
%4 = getelementptr inbounds [14 x i32], [14 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @longestPlateau(i32* %4, i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@__const.testPlateau.xs = [14 x i32] [i32 1, i32 2, i32 2, i32 3, i32 3, i32 3, i32 4, i32 5, i32 5, i32 6, i32 6, i32 6, i32 6, i32 7]
@.str = [42 x i8] c"longest plateau in array is of length %d\0A\00"
define void @testPlateau() {
%1 = alloca [14 x i32]
%2 = bitcast [14 x i32]* %1 to i8*
%3 = getelementptr inbounds [14 x i32], [14 x i32]* %1, i64 0, i64 0
%4 = call i32 @longestPlateau(i32* %3, i32 14)
%5 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ kb_wait_1();
int /*<<< orphan*/ kb_wait_2();
int /*<<< orphan*/ kb_wait_3();
int /*<<< orphan*/ kb_wait_4();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("begin\n");
  kb_wait_1();
  kb_wait_2();
  kb_wait_3();
  kb_wait_4();
  printf("end\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <kb_wait_1@plt>
mov    $0x0,%al
call   1030 <kb_wait_2@plt>
mov    $0x0,%al
call   1060 <kb_wait_3@plt>
mov    $0x0,%al
call   1040 <kb_wait_4@plt>
lea    0xe79(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1070 <kb_wait_1@plt>
xor    %eax,%eax
call   1030 <kb_wait_2@plt>
xor    %eax,%eax
call   1060 <kb_wait_3@plt>
xor    %eax,%eax
call   1050 <kb_wait_4@plt>
lea    0xe86(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [6 x i8] c"begin\00"
@str.2 = [4 x i8] c"end\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @kb_wait_1()
%3 = tail call i32 (...) @kb_wait_2()
%4 = tail call i32 (...) @kb_wait_3()
%5 = tail call i32 (...) @kb_wait_4()
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
void USBD_USR_Init(void) {}


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

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

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

LLVM IR (-O2):
define void @USBD_USR_Init() {
ret void
}
/* Variables and functions */
int usock_init(long const, int /*<<< orphan*/);
int cl_bind(const long my_mtype) { return usock_init(my_mtype, 0); }


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

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

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

LLVM IR (-O2):
define i32 @cl_bind(i64 %0) {
%2 = tail call i32 @usock_init(i64 %0, i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void Esys(void) {
  printf("syntax error!");
  exit(0);
}


x86 assembly (clang, -O0):
<Esys>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Esys>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"syntax error!\00"
define void @Esys() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [14 x i8] c"syntax error!\00"
define void @Esys() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int double_to_uint();
int double_to_ulong();
int float_to_uint();
int float_to_ulong();
int float_to_ushort();
int main(void) {
  return float_to_ushort() + float_to_uint() + float_to_ulong() +
         double_to_uint() + double_to_ulong();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <float_to_ushort@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1070 <float_to_uint@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <float_to_ulong@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <double_to_uint@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <double_to_ulong@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <float_to_ushort@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1070 <float_to_uint@plt>
mov    %eax,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1060 <float_to_ulong@plt>
mov    %eax,%ebx
add    %ebp,%ebx
xor    %eax,%eax
call   1050 <double_to_uint@plt>
mov    %eax,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1030 <double_to_ulong@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @float_to_ushort()
%3 = call i32 (...) @float_to_uint()
%4 = add nsw i32 %2, %3
%5 = call i32 (...) @float_to_ulong()
%6 = add nsw i32 %4, %5
%7 = call i32 (...) @double_to_uint()
%8 = add nsw i32 %6, %7
%9 = call i32 (...) @double_to_ulong()
%10 = add nsw i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @float_to_ushort()
%2 = tail call i32 (...) @float_to_uint()
%3 = add nsw i32 %2, %1
%4 = tail call i32 (...) @float_to_ulong()
%5 = add nsw i32 %3, %4
%6 = tail call i32 (...) @double_to_uint()
%7 = add nsw i32 %5, %6
%8 = tail call i32 (...) @double_to_ulong()
%9 = add nsw i32 %7, %8
ret i32 %9
}
/* Type definitions */
typedef int uid_t;

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int setreuid(int, int);
int /*<<< orphan*/ stderr;
int seteuid(uid_t uid) {
  switch (sizeof(uid_t)) {
  case 2:
    if (uid == 65535) {
      errno = EINVAL;
      return -1;
    }
    break;
  default:
    fprintf(stderr, "Uknown uid_t size and sign\n");
  }
  return setreuid(-1, uid);
}


x86 assembly (clang, -O0):
<seteuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%esi
mov    $0xffffffff,%edi
call   1040 <setreuid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seteuid>:
push   %rbx
mov    %edi,%ebx
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <setreuid@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Uknown uid_t size and sign\0A\00"
@EINVAL = global i32 0
@errno = global i32 0
define i32 @seteuid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = call i32 @setreuid(i32 -1, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Uknown uid_t size and sign\0A\00"
@EINVAL = global i32 0
@errno = global i32 0
define i32 @seteuid(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @setreuid(i32 -1, i32 %0)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ _ITM_initializeThread();
void tanger_stm_thread_init() { _ITM_initializeThread(); }


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

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

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

LLVM IR (-O2):
define void @tanger_stm_thread_init() {
%1 = tail call i32 (...) @_ITM_initializeThread()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutexattr_t;

/* Variables and functions */
int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr,
                                 int *pshared) {
  (void)attr;
  (void)pshared;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @pthread_mutexattr_getpshared(i32* nocapture readnone %0, i32* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Say(char *);
void NPrint(int num, char *cp) {
  char c;
  c = cp[num];
  cp[num] = 0;
  Say(cp);
  cp[num] = c;
}


x86 assembly (clang, -O0):
<NPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
call   1030 <Say@plt>
mov    -0x11(%rbp),%dl
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NPrint>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
movslq %edi,%r14
mov    (%rsi,%r14,1),%bpl
movb   $0x0,(%rsi,%r14,1)
mov    %rsi,%rdi
call   1030 <Say@plt>
mov    %bpl,(%rbx,%r14,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @NPrint(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
store i8 %10, i8* %5
%11 = load i8*, i8** %4
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 0, i8* %14
%15 = load i8*, i8** %4
%16 = call i32 @Say(i8* %15)
%17 = load i8, i8* %5
%18 = load i8*, i8** %4
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %17, i8* %21
ret void
}

LLVM IR (-O2):
define void @NPrint(i32 %0, i8* %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i8, i8* %1, i64 %3
%5 = load i8, i8* %4
store i8 0, i8* %4
%6 = tail call i32 @Say(i8* %1)
store i8 %5, i8* %4
ret void
}
void not_annotated_c_2_1() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ __cpu_to_be64(int /*<<< orphan*/);
void set64_be(uint64_t *p, uint64_t n) { *p = __cpu_to_be64(n); }


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

x86 assembly (clang, -O2):
<set64_be>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <__cpu_to_be64@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @set64_be(i32* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @__cpu_to_be64(i32 %1)
store i32 %3, i32* %0
ret void
}