xunge/DecIR huggingface dataset:
int ff_get_fourcc(const char *s) {
  assert(strlen(s) == 4);
  return (s[0]) + (s[1] << 8) + (s[2] << 16) + (s[3] << 24);
}


x86 assembly (clang, -O0):
<ff_get_fourcc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x4,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x2(%rcx),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x3(%rcx),%ecx
shl    $0x18,%ecx
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ff_get_fourcc>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
xor    %edi,%edi
cmp    $0x4,%rax
sete   %dil
xor    %eax,%eax
call   1040 <assert@plt>
movsbl (%rbx),%eax
movsbl 0x1(%rbx),%ecx
shl    $0x8,%ecx
add    %eax,%ecx
movsbl 0x2(%rbx),%edx
shl    $0x10,%edx
add    %ecx,%edx
movzbl 0x3(%rbx),%eax
shl    $0x18,%eax
add    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ff_get_fourcc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strlen(i8* %3)
%5 = icmp eq i64 %4, 4
%6 = zext i1 %5 to i32
%7 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %6)
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = shl i32 %15, 8
%17 = add nsw i32 %11, %16
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = shl i32 %21, 16
%23 = add nsw i32 %17, %22
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i64 3
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = shl i32 %27, 24
%29 = add nsw i32 %23, %28
ret i32 %29
}

LLVM IR (-O2):
define i32 @ff_get_fourcc(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp eq i64 %2, 4
%4 = zext i1 %3 to i32
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %4)
%6 = load i8, i8* %0
%7 = sext i8 %6 to i32
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = shl nsw i32 %10, 8
%12 = add nsw i32 %11, %7
%13 = getelementptr inbounds i8, i8* %0, i64 2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = shl nsw i32 %15, 16
%17 = add nsw i32 %12, %16
%18 = getelementptr inbounds i8, i8* %0, i64 3
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = shl nuw i32 %20, 24
%22 = add nsw i32 %17, %21
ret i32 %22
}
/* Variables and functions */
int /*<<< orphan*/ *lookup_external_id(char *);
int is_external_id(char *id) { return lookup_external_id(id) != NULL; }


x86 assembly (clang, -O0):
<is_external_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <lookup_external_id@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_external_id>:
push   %rax
call   1030 <lookup_external_id@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_external_id(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32* @lookup_external_id(i8* %3)
%5 = icmp ne i32* %4, null
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_external_id(i8* %0) {
%2 = tail call i32* @lookup_external_id(i8* %0)
%3 = icmp ne i32* %2, null
%4 = zext i1 %3 to i32
ret i32 %4
}
__attribute__((__no__)) do_nothing() { asm volatile("" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define i32 @do_nothing() {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret i32 undef
}
/* Variables and functions */
int PAPI_set_granularity(int);
void papif_set_granularity__(int *granularity, int *check) {
  *check = PAPI_set_granularity(*granularity);
}


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

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

LLVM IR (-O0):
define void @papif_set_granularity__(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* %5
%7 = call i32 @PAPI_set_granularity(i32 %6)
%8 = load i32*, i32** %4
store i32 %7, i32* %8
ret void
}

LLVM IR (-O2):
define void @papif_set_granularity__(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @PAPI_set_granularity(i32 %3)
store i32 %4, i32* %1
ret void
}
/* Variables and functions */
int getPoolFromBlock(int, size_t);
int CMEM_getPool(int blockid, size_t size) {
  ;
  return getPoolFromBlock(blockid, size);
}


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

x86 assembly (clang, -O2):
<CMEM_getPool>:
jmp    1030 <getPoolFromBlock@plt>

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

LLVM IR (-O2):
define i32 @CMEM_getPool(i32 %0, i64 %1) {
%3 = tail call i32 @getPoolFromBlock(i32 %0, i64 %1)
ret i32 %3
}
/* Variables and functions */
void atoi();
void mock_atoi() {
  void (*f)() = atoi;
  f();
}


x86 assembly (clang, -O0):
<mock_atoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ed9(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @mock_atoi() {
%1 = alloca void (...)*
store void (...)* @atoi, void (...)** %1
%2 = load void (...)*, void (...)** %1
ret void
}

LLVM IR (-O2):
define void @mock_atoi() {
tail call void (...) @atoi()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void xfree(void *v) { free(v); }


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

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

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

LLVM IR (-O2):
define void @xfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
double FxTan(double a) {
  return (
      (((sin((double)((a)*0.01745329)))) / ((cos((double)((a)*0.01745329))))));
}


x86 assembly (clang, -O0):
<FxTan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xecb(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  0xeb4(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FxTan>:
sub    $0x18,%rsp
mulsd  0xed4(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1030 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @FxTan(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 0x3F91DF467707C94D
%5 = call double @sin(double %4)
%6 = load double, double* %2
%7 = fmul double %6, 0x3F91DF467707C94D
%8 = call double @cos(double %7)
%9 = fdiv double %5, %8
ret double %9
}

LLVM IR (-O2):
define double @FxTan(double %0) {
%2 = fmul double %0, 0x3F91DF467707C94D
%3 = tail call double @sin(double %2)
%4 = tail call double @cos(double %2)
%5 = fdiv double %3, %4
ret double %5
}
/* Variables and functions */
int abs(int);
int pidCorrectSpeed(int input) {
  if (abs(input) > 80)
    return (input > 0) ? 80 : 80 * -1;
  return input;
}


x86 assembly (clang, -O0):
<pidCorrectSpeed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
cmp    $0x50,%eax
jle    1147 <pidCorrectSpeed+0x37>
mov    -0x8(%rbp),%edx
mov    $0xffffffb0,%eax
mov    $0x50,%ecx
cmp    $0x0,%edx
cmovg  %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    114d <pidCorrectSpeed+0x3d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pidCorrectSpeed>:
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
test   %edi,%edi
mov    $0x50,%edx
mov    $0xffffffb0,%eax
cmovg  %edx,%eax
cmp    $0x51,%ecx
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define i32 @pidCorrectSpeed(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @abs(i32 %4)
%6 = icmp sgt i32 %5, 80
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 80, i32 -80
store i32 %11, i32* %2
br label %14
12: ; preds = %1
%13 = load i32, i32* %3
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %7
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @pidCorrectSpeed(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%3 = icmp ugt i32 %2, 80
%4 = icmp sgt i32 %0, 0
%5 = select i1 %4, i32 80, i32 -80
%6 = select i1 %3, i32 %5, i32 %0
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ bool_t;

/* Variables and functions */
int /*<<< orphan*/ TRUE;
bool_t xdr_void() { return (TRUE); }


x86 assembly (clang, -O0):
<xdr_void>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_void>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@TRUE = global i32 0
define i32 @xdr_void() {
%1 = load i32, i32* @TRUE
ret i32 %1
}

LLVM IR (-O2):
@TRUE = global i32 0
define i32 @xdr_void() {
%1 = load i32, i32* @TRUE
ret i32 %1
}
/* Type definitions */
struct timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
double timespec_to_double(const struct timespec *time) {
  return time->tv_nsec * 1E-9 + (double)time->tv_sec;
}


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

x86 assembly (clang, -O2):
<timespec_to_double>:
cvtsi2sdl (%rdi),%xmm0
cvtsi2sdq 0x8(%rdi),%xmm1
mulsd  0xeee(%rip),%xmm0
addsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
define double @timespec_to_double(%struct.timespec* nocapture %0) {
%2 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%6 = load i64, i64* %5
%7 = sitofp i64 %6 to double
%8 = tail call double @llvm.fmuladd.f64(double %4, double 1.000000e-09, double %7)
ret double %8
}
rm(ps) char *ps;
{ brcstr(ps, 'l'); }


x86 assembly (clang, -O0):
<rm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x6c,%esi
mov    $0x0,%al
call   1030 <brcstr@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rm>:
mov    $0x6c,%esi
xor    %eax,%eax
jmp    1030 <brcstr@plt>

LLVM IR (-O0):
define i32 @rm(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @brcstr to i32 (i8*, i32, ...)*)(i8* %4, i32 108)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @rm(i8* %0) {
%2 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @brcstr to i32 (i8*, i32, ...)*)(i8* %0, i32 108)
ret i32 undef
}
/* Variables and functions */
double pop();
int /*<<< orphan*/ push(double);
void sub(void) {
  double subtrahend = pop();
  push(pop() - subtrahend);
}


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

x86 assembly (clang, -O2):
<sub>:
push   %rax
xor    %eax,%eax
call   1030 <pop@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <pop@plt>
subsd  (%rsp),%xmm0
pop    %rax
jmp    1040 <push@plt>

LLVM IR (-O0):
define void @sub() {
%1 = alloca double
%2 = call double (...) @pop()
store double %2, double* %1
%3 = call double (...) @pop()
%4 = load double, double* %1
%5 = fsub double %3, %4
%6 = call i32 @push(double %5)
ret void
}

LLVM IR (-O2):
define void @sub() {
%1 = tail call double (...) @pop()
%2 = tail call double (...) @pop()
%3 = fsub double %2, %1
%4 = tail call i32 @push(double %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("This line has no trailing newline");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"This line has no trailing newline\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"This line has no trailing newline\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SIGKILL;
int atoi(char *);
int /*<<< orphan*/ kill(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  if (argc != 2) {
    printf("Usage: kill <pid>\n");
    return -1;
  }
  int pid = atoi(argv[1]);
  kill(pid, SIGKILL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1168 <main+0x38>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1190 <main+0x60>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2e5e(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1153 <main+0x23>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    0x2e9a(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1040 <kill@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Usage: kill <pid>\0A\00"
@SIGKILL = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %19
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = load i32, i32* @SIGKILL
%18 = call i32 @kill(i32 %16, i32 %17)
store i32 0, i32* %3
br label %19
19: ; preds = %11, %9
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@SIGKILL = global i32 0
@str = [18 x i8] c"Usage: kill <pid>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %12
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = load i32, i32* @SIGKILL
%11 = tail call i32 @kill(i32 %9, i32 %10)
br label %12
12: ; preds = %6, %4
%13 = phi i32 [ -1, %4 ], [ 0, %6 ]
ret i32 %13
}
void free_vector(v, nl, nh) float *v;
int nl, nh;
{
  nh = nh;
  free((char *)(v + nl));
}


x86 assembly (clang, -O0):
<free_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_vector>:
movslq %esi,%rax
lea    (%rdi,%rax,4),%rdi
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_vector(float* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds float, float* %0, i64 %4
%6 = bitcast float* %5 to i8*
tail call void @free(i8* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(int /*<<< orphan*/, int /*<<< orphan*/, char *);
int prepare_profiling(char const *name) {
  error(0, 0, "warning: profiling not yet implemented");
  return -1;
}


x86 assembly (clang, -O0):
<prepare_profiling>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %esi,%esi
lea    0xedb(%rip),%rdx
mov    %esi,%edi
call   1030 <error@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prepare_profiling>:
push   %rax
lea    0xee8(%rip),%rdx
xor    %edi,%edi
xor    %esi,%esi
call   1030 <error@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"warning: profiling not yet implemented\00"
define i32 @prepare_profiling(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @error(i32 0, i32 0, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [39 x i8] c"warning: profiling not yet implemented\00"
define i32 @prepare_profiling(i8* nocapture readnone %0) {
%2 = tail call i32 @error(i32 0, i32 0, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, ...);
scalar_t__ strcmp(char *, char *);
void assertEquals(char str1[], char str2[]) {
  if (strcmp(str1, str2) != 0) {
    printf("Failed. Expected '%s', Actual '%s' ... exiting\n", str1, str2);
    exit(1);
  } else {
    printf("Passed: %s\n", str1);
  }
}


x86 assembly (clang, -O0):
<assertEquals>:
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   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1177 <assertEquals+0x47>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rsi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assertEquals>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strcmp@plt>
test   %rax,%rax
jne    115c <assertEquals+0x2c>
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>
lea    0xe9d(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"Failed. Expected '%s', Actual '%s' ... exiting\0A\00"
@.str.1 = [12 x i8] c"Passed: %s\0A\00"
define void @assertEquals(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 i64 @strcmp(i8* %5, i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = load i8*, i8** %3
%16 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %14
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"Failed. Expected '%s', Actual '%s' ... exiting\0A\00"
@.str.1 = [12 x i8] c"Passed: %s\0A\00"
define void @assertEquals(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
void screen_rotated(void) {
  do {
  } while (0);
}


x86 assembly (clang, -O0):
<screen_rotated>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <screen_rotated+0x9>
jmp    110e <screen_rotated+0xe>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @screen_rotated() {
br label %1
1: ; preds = %0
br label %2
2: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @screen_rotated() {
ret void
}
void unsupported(option, message) char *option;
char *message;
{
  show_who("compiler option ");
  writes(option);
  writes(" (");
  writes(message);
  writesn(") not supported yet");
}


x86 assembly (clang, -O0):
<unsupported>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <show_who@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <writes@plt>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1050 <writes@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <writes@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <writesn@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsupported>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1030 <show_who@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <writes@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1050 <writes@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <writes@plt>
lea    0xea3(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <writesn@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"compiler option \00"
@.str.1 = [3 x i8] c" (\00"
@.str.2 = [20 x i8] c") not supported yet\00"
define void @unsupported(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @show_who to i32 (i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @writes to i32 (i8*, ...)*)(i8* %6)
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @writes to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = load i8*, i8** %4
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @writes to i32 (i8*, ...)*)(i8* %9)
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @writesn to i32 (i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"compiler option \00"
@.str.1 = [3 x i8] c" (\00"
@.str.2 = [20 x i8] c") not supported yet\00"
define void @unsupported(i8* %0, i8* %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @show_who to i32 (i8*, ...)*)(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @writes to i32 (i8*, ...)*)(i8* %0)
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @writes to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @writes to i32 (i8*, ...)*)(i8* %1)
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @writesn to i32 (i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *dirname(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
char *get_tmpl_path(char *path) {
  static char buf[256] = {0};
  snprintf(buf, sizeof buf, "%s/template", dirname(path));
  return buf;
}


x86 assembly (clang, -O0):
<get_tmpl_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <dirname@plt>
mov    %rax,%rcx
lea    0x2f01(%rip),%rdi
mov    $0x100,%esi
lea    0xeb5(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2ee9(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_tmpl_path>:
push   %rbx
call   1040 <dirname@plt>
lea    0x2f13(%rip),%rbx
lea    0xecc(%rip),%rdx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %rax,%rcx
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@get_tmpl_path.buf = internal global [256 x i8] zeroinitializer
@.str = [12 x i8] c"%s/template\00"
define i8* @get_tmpl_path(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @dirname(i8* %3)
%5 = call i32 @snprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @get_tmpl_path.buf, i64 0, i64 0), i32 256, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @get_tmpl_path.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@get_tmpl_path.buf = internal global [256 x i8] zeroinitializer
@.str = [12 x i8] c"%s/template\00"
define i8* @get_tmpl_path(i8* %0) {
%2 = tail call i8* @dirname(i8* %0)
%3 = tail call i32 @snprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @get_tmpl_path.buf, i64 0, i64 0), i32 256, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @get_tmpl_path.buf, i64 0, i64 0)
}
/* Variables and functions */
scalar_t__ __builtin___bnd_set_ptr_bounds(int *, int);
int test(int *p) {
  p = (int *)__builtin___bnd_set_ptr_bounds(p, sizeof(int));
  return *p;
}


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

x86 assembly (clang, -O2):
<test>:
push   %rax
mov    $0x4,%esi
call   1030 <__builtin___bnd_set_ptr_bounds@plt>
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i64 @__builtin___bnd_set_ptr_bounds(i32* %3, i32 4)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @test(i32* %0) {
%2 = tail call i64 @__builtin___bnd_set_ptr_bounds(i32* %0, i32 4)
%3 = inttoptr i64 %2 to i32*
%4 = load i32, i32* %3
ret i32 %4
}
char dig2char(int d) { return (d < 10) ? '0' + d : 'a' + d - 10; }


x86 assembly (clang, -O0):
<dig2char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    111f <dig2char+0x1f>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x8(%rbp)
jmp    112b <dig2char+0x2b>
mov    -0x4(%rbp),%eax
add    $0x61,%eax
sub    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dig2char>:
lea    0x57(%rdi),%ecx
lea    0x30(%rdi),%eax
cmp    $0xa,%edi
cmovge %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @dig2char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 10
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = add nsw i32 48, %6
br label %12
8: ; preds = %1
%9 = load i32, i32* %2
%10 = add nsw i32 97, %9
%11 = sub nsw i32 %10, 10
br label %12
12: ; preds = %8, %5
%13 = phi i32 [ %7, %5 ], [ %11, %8 ]
%14 = trunc i32 %13 to i8
ret i8 %14
}

LLVM IR (-O2):
define signext i8 @dig2char(i32 %0) {
%2 = icmp slt i32 %0, 10
%3 = select i1 %2, i32 48, i32 87
%4 = add nsw i32 %3, %0
%5 = trunc i32 %4 to i8
ret i8 %5
}
/* Variables and functions */
int ssleay_rand_bytes(unsigned char *, int, int);
int ssleay_rand_pseudo_bytes(unsigned char *buf, int num) {
  return ssleay_rand_bytes(buf, num, 1);
}


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

x86 assembly (clang, -O2):
<ssleay_rand_pseudo_bytes>:
mov    $0x1,%edx
jmp    1030 <ssleay_rand_bytes@plt>

LLVM IR (-O0):
define i32 @ssleay_rand_pseudo_bytes(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 i32 @ssleay_rand_bytes(i8* %5, i32 %6, i32 1)
ret i32 %7
}

LLVM IR (-O2):
define i32 @ssleay_rand_pseudo_bytes(i8* %0, i32 %1) {
%3 = tail call i32 @ssleay_rand_bytes(i8* %0, i32 %1, i32 1)
ret i32 %3
}
int foo(int (*read)(void)) { return (*read)(); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
jmp    *%rdi

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

LLVM IR (-O2):
define i32 @foo(i32 ()* nocapture %0) {
%2 = tail call i32 %0()
ret i32 %2
}
void mm_destroy(int n, double **m) {
  int i;
  for (i = 0; i < n; ++i)
    free(m[i]);
  free(m);
}


x86 assembly (clang, -O0):
<mm_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1151 <mm_destroy+0x41>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <mm_destroy+0x16>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm_destroy>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
test   %edi,%edi
jle    1142 <mm_destroy+0x32>
mov    %edi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <mm_destroy+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @mm_destroy(i32 %0, double** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds double*, double** %1, i64 %7
%9 = bitcast double** %8 to i8**
%10 = load i8*, i8** %9
tail call void @free(i8* %10)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = bitcast double** %1 to i8*
tail call void @free(i8* %14)
ret void
}
/* Variables and functions */
double atan2(double, double);
double atan2_ieee(double y, double x) { return atan2(y, x); }


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

x86 assembly (clang, -O2):
<atan2_ieee>:
jmp    1030 <atan2@plt>

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

LLVM IR (-O2):
define double @atan2_ieee(double %0, double %1) {
%3 = tail call double @atan2(double %0, double %1)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void camellia_ctx_free(void *ctx) { free(ctx); }


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

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

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

LLVM IR (-O2):
define void @camellia_ctx_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void stampa(const char *dato, int len) {
  int i;
  for (i = 0; i < len; ++i) {
    printf("%c", dato[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<stampa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <stampa+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <stampa+0x16>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stampa>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1143 <stampa+0x33>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <stampa+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @stampa(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 0, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %21
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 = sext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @stampa(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = tail call i32 @putchar(i32 %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = tail call i32 @putchar(i32 10)
ret void
}
void unix_remove(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ AdjustBrightness();
int /*<<< orphan*/ InitApp();
int32_t main(void) {
  InitApp();
  while (1) {
    AdjustBrightness();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <InitApp@plt>
mov    $0x0,%al
call   1040 <AdjustBrightness@plt>
jmp    1136 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <InitApp@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <AdjustBrightness@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @InitApp()
br label %3
3: ; preds = %0, %3
%4 = call i32 (...) @AdjustBrightness()
br label %3
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @InitApp()
br label %2
2: ; preds = %0, %2
%3 = tail call i32 (...) @AdjustBrightness()
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ Carregar();
int /*<<< orphan*/ Gravar();
scalar_t__ InformarDadosUsuario();
int /*<<< orphan*/ Mostrar();
int /*<<< orphan*/ Ordenar();
int main(int argc, char *argv[]) {
  int continua = 1;
  Carregar();
  Ordenar();
  Mostrar();
  do {
    if (InformarDadosUsuario()) {
      Mostrar();
      Gravar();
    } else {
      continua = 0;
    }
  } while (continua);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    $0x0,%al
call   1060 <Carregar@plt>
mov    $0x0,%al
call   1050 <Ordenar@plt>
mov    $0x0,%al
call   1070 <Mostrar@plt>
mov    $0x0,%al
call   1040 <InformarDadosUsuario@plt>
cmp    $0x0,%rax
je     11a6 <main+0x56>
mov    $0x0,%al
call   1070 <Mostrar@plt>
mov    $0x0,%al
call   1030 <Gravar@plt>
jmp    11ad <main+0x5d>
movl   $0x0,-0x14(%rbp)
jmp    11b2 <main+0x62>
cmpl   $0x0,-0x14(%rbp)
jne    1182 <main+0x32>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <Carregar@plt>
xor    %eax,%eax
call   1050 <Ordenar@plt>
xor    %eax,%eax
call   1070 <Mostrar@plt>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <InformarDadosUsuario@plt>
test   %rax,%rax
je     118c <main+0x3c>
xor    %eax,%eax
call   1070 <Mostrar@plt>
xor    %eax,%eax
call   1030 <Gravar@plt>
jmp    1170 <main+0x20>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
%7 = call i32 (...) @Carregar()
%8 = call i32 (...) @Ordenar()
%9 = call i32 (...) @Mostrar()
br label %10
10: ; preds = %18, %2
%11 = call i64 (...) @InformarDadosUsuario()
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = call i32 (...) @Mostrar()
%15 = call i32 (...) @Gravar()
br label %17
16: ; preds = %10
store i32 0, i32* %6
br label %17
17: ; preds = %16, %13
br label %18
18: ; preds = %17
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 0
br i1 %20, label %10, label %21
21: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @Carregar()
%4 = tail call i32 (...) @Ordenar()
%5 = tail call i32 (...) @Mostrar()
%6 = tail call i64 (...) @InformarDadosUsuario()
%7 = icmp eq i64 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %2, %8
%9 = tail call i32 (...) @Mostrar()
%10 = tail call i32 (...) @Gravar()
%11 = tail call i64 (...) @InformarDadosUsuario()
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %8
13: ; preds = %8, %2
ret i32 0
}
/* Variables and functions */
float __nv_lgammaf(float);
float lgammaf(float __a) { return __nv_lgammaf(__a); }


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

x86 assembly (clang, -O2):
<lgammaf>:
jmp    1030 <__nv_lgammaf@plt>

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

LLVM IR (-O2):
define float @lgammaf(float %0) {
%2 = tail call float @__nv_lgammaf(float %0)
ret float %2
}
int test_imm_7Fint32_mem(int *val) {
  return ((*val) & (0x7F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_7Fint32_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    $0x7f,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_7Fint32_mem>:
testb  $0x7f,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_7Fint32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 127
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_7Fint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 127
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ ba();
int main() { ba(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @ba()
ret i32 0
}
void z80_reset(void) {}


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

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

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

LLVM IR (-O2):
define void @z80_reset() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lib_tsc();
int /*<<< orphan*/ rdtsc();
int /*<<< orphan*/ rdtsc_cpuid();
int /*<<< orphan*/ rdtscp();
int /*<<< orphan*/ rdtscp_cpuid();
int main(void) {
  rdtscp_cpuid();
  rdtsc();
  rdtsc_cpuid();
  rdtscp();
  lib_tsc();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rdtscp_cpuid@plt>
mov    $0x0,%al
call   1050 <rdtsc@plt>
mov    $0x0,%al
call   1060 <rdtsc_cpuid@plt>
mov    $0x0,%al
call   1040 <rdtscp@plt>
mov    $0x0,%al
call   1070 <lib_tsc@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <rdtscp_cpuid@plt>
xor    %eax,%eax
call   1050 <rdtsc@plt>
xor    %eax,%eax
call   1060 <rdtsc_cpuid@plt>
xor    %eax,%eax
call   1040 <rdtscp@plt>
xor    %eax,%eax
call   1070 <lib_tsc@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @rdtscp_cpuid()
%3 = call i32 (...) @rdtsc()
%4 = call i32 (...) @rdtsc_cpuid()
%5 = call i32 (...) @rdtscp()
%6 = call i32 (...) @lib_tsc()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @rdtscp_cpuid()
%2 = tail call i32 (...) @rdtsc()
%3 = tail call i32 (...) @rdtsc_cpuid()
%4 = tail call i32 (...) @rdtscp()
%5 = tail call i32 (...) @lib_tsc()
ret i32 0
}
/* Type definitions */
struct hashtable_itr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct hashtable_itr *);
void hashtable_iterator_destroy(struct hashtable_itr *itr) {
  if (itr)
    free(itr);
}


x86 assembly (clang, -O0):
<hashtable_iterator_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <hashtable_iterator_destroy+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.hashtable_itr = type { i32 }
define void @hashtable_iterator_destroy(%struct.hashtable_itr* %0) {
%2 = alloca %struct.hashtable_itr*
store %struct.hashtable_itr* %0, %struct.hashtable_itr** %2
%3 = load %struct.hashtable_itr*, %struct.hashtable_itr** %2
%4 = icmp ne %struct.hashtable_itr* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load %struct.hashtable_itr*, %struct.hashtable_itr** %2
%7 = call i32 @free(%struct.hashtable_itr* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
%struct.hashtable_itr = type { i32 }
define void @hashtable_iterator_destroy(%struct.hashtable_itr* %0) {
%2 = icmp eq %struct.hashtable_itr* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.hashtable_itr* %0)
br label %5
5: ; preds = %3, %1
ret void
}