xunge/DecIR huggingface dataset:
int opal_cube_dim(int value) {
  int dim, size;
  for (dim = 0, size = 1; size < value; ++dim, size <<= 1)
    ;
  return dim;
}


x86 assembly (clang, -O0):
<opal_cube_dim>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    113d <opal_cube_dim+0x3d>
jmp    1126 <opal_cube_dim+0x26>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <opal_cube_dim+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<opal_cube_dim>:
xor    %eax,%eax
cmp    $0x2,%edi
jl     1119 <opal_cube_dim+0x19>
xor    %eax,%eax
mov    $0x1,%ecx
xchg   %ax,%ax
add    $0x1,%eax
add    %ecx,%ecx
cmp    %edi,%ecx
jl     1110 <opal_cube_dim+0x10>
ret

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

LLVM IR (-O2):
define i32 @opal_cube_dim(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 1, %1 ]
%5 = phi i32 [ %6, %3 ], [ 0, %1 ]
%6 = add nuw nsw i32 %5, 1
%7 = shl i32 %4, 1
%8 = icmp slt i32 %7, %0
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %10
}
int main() {
  int foo[10];
  int sz = sizeof(int);
  char *bar = (char *)foo;
  bar[sz * 9] = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x34(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
imul   $0x9,-0x34(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i8*
store i32 0, i32* %1
store i32 4, i32* %3
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%6 = bitcast i32* %5 to i8*
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = load i32, i32* %3
%9 = mul nsw i32 %8, 9
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %7, i64 %10
store i8 0, i8* %11
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int ReadPinValue(int);
int digitalRead(int pin) { return ReadPinValue(pin); }


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

x86 assembly (clang, -O2):
<digitalRead>:
jmp    1030 <ReadPinValue@plt>

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

LLVM IR (-O2):
define i32 @digitalRead(i32 %0) {
%2 = tail call i32 @ReadPinValue(i32 %0)
ret i32 %2
}
void dbAdd(void) {
  _serverPanic("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/"
               "heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c",
               56, "Function '%s' is disabled.", __func__);
}


x86 assembly (clang, -O0):
<dbAdd>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x38,%esi
lea    0xf79(%rip),%rdx
lea    0xf8d(%rip),%rcx
mov    $0x0,%al
call   1030 <_serverPanic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbAdd>:
lea    0xee9(%rip),%rdi
lea    0xf82(%rip),%rdx
lea    0xf96(%rip),%rcx
mov    $0x38,%esi
xor    %eax,%eax
jmp    1030 <_serverPanic@plt>

LLVM IR (-O0):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.dbAdd = [6 x i8] c"dbAdd\00"
define void @dbAdd() {
%1 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 56, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__func__.dbAdd, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.dbAdd = [6 x i8] c"dbAdd\00"
define void @dbAdd() {
%1 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 56, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__func__.dbAdd, i64 0, i64 0))
ret void
}
double chop_ident(double x) { return (x); }


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

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

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

LLVM IR (-O2):
define double @chop_ident(double returned %0) {
ret double %0
}
void debugpins_task_toggle() {}


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

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

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

LLVM IR (-O2):
define void @debugpins_task_toggle() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ emit_adc(int, int, int);
int /*<<< orphan*/ emit_adcs(int, int, int);
int /*<<< orphan*/ emit_lsrs_imm(int, int, int);
void emit_rotclsr(int t, int sr) {
  emit_lsrs_imm(sr, 1, sr);
  emit_adcs(t, t, t);
  emit_adc(sr, sr, sr);
}


x86 assembly (clang, -O0):
<emit_rotclsr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    $0x1,%esi
call   1030 <emit_lsrs_imm@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
call   1040 <emit_adcs@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1050 <emit_adc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_rotclsr>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %esi,%edi
mov    $0x1,%esi
mov    %ebx,%edx
call   1030 <emit_lsrs_imm@plt>
mov    %ebp,%edi
mov    %ebp,%esi
mov    %ebp,%edx
call   1040 <emit_adcs@plt>
mov    %ebx,%edi
mov    %ebx,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <emit_adc@plt>

LLVM IR (-O0):
define void @emit_rotclsr(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 = load i32, i32* %4
%7 = call i32 @emit_lsrs_imm(i32 %5, i32 1, i32 %6)
%8 = load i32, i32* %3
%9 = load i32, i32* %3
%10 = load i32, i32* %3
%11 = call i32 @emit_adcs(i32 %8, i32 %9, i32 %10)
%12 = load i32, i32* %4
%13 = load i32, i32* %4
%14 = load i32, i32* %4
%15 = call i32 @emit_adc(i32 %12, i32 %13, i32 %14)
ret void
}

LLVM IR (-O2):
define void @emit_rotclsr(i32 %0, i32 %1) {
%3 = tail call i32 @emit_lsrs_imm(i32 %1, i32 1, i32 %1)
%4 = tail call i32 @emit_adcs(i32 %0, i32 %0, i32 %0)
%5 = tail call i32 @emit_adc(i32 %1, i32 %1, i32 %1)
ret void
}
/* Variables and functions */
unsigned int strlen(char *);
int takeDigits(char a[], int nums[]) {
  for (unsigned int i = 0; i < strlen(a); i++) {
    nums[i] = a[i] - '0';
  }
}


x86 assembly (clang, -O0):
<takeDigits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jae    1169 <takeDigits+0x59>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movsbl (%rax,%rcx,1),%edx
sub    $0x30,%edx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1127 <takeDigits+0x17>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<takeDigits>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
test   %eax,%eax
je     114f <takeDigits+0x3f>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%eax
add    $0xffffffd0,%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%eax
cmp    %rax,%rbx
jb     1130 <takeDigits+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @takeDigits(i8* %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %6, %2
ret i32 undef
6: ; preds = %2, %6
%7 = phi i64 [ %13, %6 ], [ 0, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = add nsw i32 %10, -48
%12 = getelementptr inbounds i32, i32* %1, i64 %7
store i32 %11, i32* %12
%13 = add nuw nsw i64 %7, 1
%14 = tail call i32 @strlen(i8* %0)
%15 = zext i32 %14 to i64
%16 = icmp ult i64 %13, %15
br i1 %16, label %6, label %5
}
/* Variables and functions */
int unhex(char);
unsigned char _decode_hex(char *hex) {
  return ((unhex(hex[0]) << 4) | unhex(hex[1]));
}


x86 assembly (clang, -O0):
<_decode_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <unhex@plt>
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <unhex@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
or     %ecx,%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_decode_hex>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <unhex@plt>
mov    %eax,%ebp
shl    $0x4,%ebp
movsbl 0x1(%rbx),%edi
call   1030 <unhex@plt>
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define zeroext i8 @_decode_hex(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @unhex(i8 signext %2)
%4 = shl i32 %3, 4
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = tail call i32 @unhex(i8 signext %6)
%8 = or i32 %7, %4
%9 = trunc i32 %8 to i8
ret i8 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
double kjg_geno_count(size_t const, int /*<<< orphan*/ const *);
scalar_t__ kjg_geno_sum_alt(size_t const, int /*<<< orphan*/ const *);
double kjg_geno_af(const size_t n, const uint8_t *p) {
  return (((double)kjg_geno_sum_alt(n, p)) / kjg_geno_count(n, p) / 2);
}


x86 assembly (clang, -O0):
<kjg_geno_af>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <kjg_geno_sum_alt@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <kjg_geno_count@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  0xe98(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kjg_geno_af>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <kjg_geno_sum_alt@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <kjg_geno_count@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
mulsd  0xeab(%rip),%xmm1
movapd %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @kjg_geno_af(i64 %0, i32* %1) {
%3 = alloca i64
%4 = alloca i32*
store i64 %0, i64* %3
store i32* %1, i32** %4
%5 = load i64, i64* %3
%6 = load i32*, i32** %4
%7 = call i64 @kjg_geno_sum_alt(i64 %5, i32* %6)
%8 = sitofp i64 %7 to double
%9 = load i64, i64* %3
%10 = load i32*, i32** %4
%11 = call double @kjg_geno_count(i64 %9, i32* %10)
%12 = fdiv double %8, %11
%13 = fdiv double %12, 2.000000e+00
ret double %13
}

LLVM IR (-O2):
define double @kjg_geno_af(i64 %0, i32* %1) {
%3 = tail call i64 @kjg_geno_sum_alt(i64 %0, i32* %1)
%4 = sitofp i64 %3 to double
%5 = tail call double @kjg_geno_count(i64 %0, i32* %1)
%6 = fdiv double %4, %5
%7 = fmul double %6, 5.000000e-01
ret double %7
}
int min(int a, int b, int c) {
  return a > b ? (b > c ? c : b) : (a > c ? c : a);
}


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1141 <min+0x41>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1130 <min+0x30>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <min+0x36>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1164 <min+0x64>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1158 <min+0x58>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    115e <min+0x5e>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
mov    %esi,%eax
cmp    %edx,%esi
cmovg  %edx,%eax
cmp    %edi,%eax
cmovge %edi,%eax
ret

LLVM IR (-O0):
define i32 @min(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = icmp sgt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %3
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = icmp sgt i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i32, i32* %6
br label %18
16: ; preds = %10
%17 = load i32, i32* %5
br label %18
18: ; preds = %16, %14
%19 = phi i32 [ %15, %14 ], [ %17, %16 ]
br label %30
20: ; preds = %3
%21 = load i32, i32* %4
%22 = load i32, i32* %6
%23 = icmp sgt i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = load i32, i32* %6
br label %28
26: ; preds = %20
%27 = load i32, i32* %4
br label %28
28: ; preds = %26, %24
%29 = phi i32 [ %25, %24 ], [ %27, %26 ]
br label %30
30: ; preds = %28, %18
%31 = phi i32 [ %19, %18 ], [ %29, %28 ]
ret i32 %31
}

LLVM IR (-O2):
define i32 @min(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, %2
%5 = select i1 %4, i32 %2, i32 %1
%6 = icmp slt i32 %5, %0
%7 = select i1 %6, i32 %5, i32 %0
ret i32 %7
}
extern struct Sequence *nextseq(dbase)
struct Database *dbase;
{
  return (readentry(dbase));
}


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

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

LLVM IR (-O0):
%struct.Sequence = type opaque
%struct.Database = type opaque
define %struct.Sequence* @nextseq(%struct.Database* %0) {
%2 = alloca %struct.Database*
store %struct.Database* %0, %struct.Database** %2
%3 = load %struct.Database*, %struct.Database** %2
%4 = call i32 (%struct.Database*, ...) bitcast (i32 (...)* @readentry to i32 (%struct.Database*, ...)*)(%struct.Database* %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to %struct.Sequence*
ret %struct.Sequence* %6
}

LLVM IR (-O2):
%struct.Sequence = type opaque
%struct.Database = type opaque
define %struct.Sequence* @nextseq(%struct.Database* %0) {
%2 = tail call i32 (%struct.Database*, ...) bitcast (i32 (...)* @readentry to i32 (%struct.Database*, ...)*)(%struct.Database* %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to %struct.Sequence*
ret %struct.Sequence* %4
}
/* Variables and functions */
unsigned short crc16(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char const *);
int /*<<< orphan*/ strlen(char *);
unsigned short _user_name_to_hash(const char *username) {
  char buf[40];
  strcpy(buf, username);
  return crc16(buf, strlen(buf));
}


x86 assembly (clang, -O0):
<_user_name_to_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%esi
call   1050 <crc16@plt>
movzwl %ax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_user_name_to_hash>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <crc16@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i16 @_user_name_to_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca [40 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @strcpy(i8* %4, i8* %5)
%7 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
%10 = call zeroext i16 @crc16(i8* %7, i32 %9)
ret i16 %10
}

LLVM IR (-O2):
define zeroext i16 @_user_name_to_hash(i8* %0) {
%2 = alloca [40 x i8]
%3 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* %0)
%5 = call i32 @strlen(i8* %3)
%6 = call zeroext i16 @crc16(i8* %3, i32 %5)
ret i16 %6
}
usleep(useconds) unsigned useconds;
{ sleep(1); }


x86 assembly (clang, -O0):
<usleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x1,%edi
mov    $0x0,%al
call   1030 <sleep@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @usleep(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 1)
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
define i32 @usleep(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ sink(char *);
void test_char_vla_location(void) {
  unsigned nelts = 7;
  char vla[nelts];
  vla[0] = 14;
  vla[nelts] = 0;
  sink(vla);
}


x86 assembly (clang, -O0):
<test_char_vla_location>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x7,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
movb   $0xe,(%rdi)
mov    -0x4(%rbp),%eax
movb   $0x0,(%rdi,%rax,1)
call   1030 <sink@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_char_vla_location>:
push   %rax
movb   $0xe,(%rsp)
movb   $0x0,0x7(%rsp)
mov    %rsp,%rdi
call   1030 <sink@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @test_char_vla_location() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
store i32 7, i32* %1
%4 = load i32, i32* %1
%5 = zext i32 %4 to i64
%6 = call i8* @llvm.stacksave()
store i8* %6, i8** %2
%7 = alloca i8, i64 %5
store i64 %5, i64* %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
store i8 14, i8* %8
%9 = load i32, i32* %1
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %7, i64 %10
store i8 0, i8* %11
%12 = call i32 @sink(i8* %7)
%13 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @test_char_vla_location() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
store i8 14, i8* %2
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 7
store i8 0, i8* %3
%4 = call i32 @sink(i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _ARC4_LOCK();
int /*<<< orphan*/ _ARC4_UNLOCK();
int arc4_stir();
int arc4random_stir(void) {
  int val;
  _ARC4_LOCK();
  val = arc4_stir();
  _ARC4_UNLOCK();
  return val;
}


x86 assembly (clang, -O0):
<arc4random_stir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <_ARC4_LOCK@plt>
mov    $0x0,%al
call   1040 <arc4_stir@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <_ARC4_UNLOCK@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arc4random_stir>:
push   %rbx
xor    %eax,%eax
call   1030 <_ARC4_LOCK@plt>
xor    %eax,%eax
call   1040 <arc4_stir@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <_ARC4_UNLOCK@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @arc4random_stir() {
%1 = alloca i32
%2 = call i32 (...) @_ARC4_LOCK()
%3 = call i32 (...) @arc4_stir()
store i32 %3, i32* %1
%4 = call i32 (...) @_ARC4_UNLOCK()
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
define i32 @arc4random_stir() {
%1 = tail call i32 (...) @_ARC4_LOCK()
%2 = tail call i32 (...) @arc4_stir()
%3 = tail call i32 (...) @_ARC4_UNLOCK()
ret i32 %2
}
void f2(void) {
  int a, b[100];
#pragma acc parallel firstprivate(b [10:20])
  ;
}


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

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

LLVM IR (-O0):
define void @f2() {
%1 = alloca i32
%2 = alloca [100 x i32]
ret void
}

LLVM IR (-O2):
define void @f2() {
ret void
}
unsigned int bcm2835_version(void) { return 10046; }


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

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

LLVM IR (-O0):
define i32 @bcm2835_version() {
ret i32 10046
}

LLVM IR (-O2):
define i32 @bcm2835_version() {
ret i32 10046
}
float *f() {
  float a[2];
  a[0] = 1.0;
  a[1] = 1.1;
  return a;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movss  0xef8(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xee7(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
lea    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
lea    -0x8(%rsp),%rax
ret

LLVM IR (-O0):
define float* @f() {
%1 = alloca [2 x float]
%2 = getelementptr inbounds [2 x float], [2 x float]* %1, i64 0, i64 0
store float 1.000000e+00, float* %2
%3 = getelementptr inbounds [2 x float], [2 x float]* %1, i64 0, i64 1
store float 0x3FF19999A0000000, float* %3
%4 = getelementptr inbounds [2 x float], [2 x float]* %1, i64 0, i64 0
ret float* %4
}

LLVM IR (-O2):
define noalias float* @f() {
%1 = alloca [2 x float]
%2 = bitcast [2 x float]* %1 to i8*
%3 = getelementptr inbounds [2 x float], [2 x float]* %1, i64 0, i64 0
ret float* %3
}
/* Variables and functions */
char *four_numbering_system_get_quartet();
char *mincrypt_get_four_system_quartet(void) {
  return four_numbering_system_get_quartet();
}


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

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

LLVM IR (-O0):
define i8* @mincrypt_get_four_system_quartet() {
%1 = call i8* (...) @four_numbering_system_get_quartet()
ret i8* %1
}

LLVM IR (-O2):
define i8* @mincrypt_get_four_system_quartet() {
%1 = tail call i8* (...) @four_numbering_system_get_quartet()
ret i8* %1
}
/* Variables and functions */
scalar_t__ memcpy(char *, char *, int);
char *ncpy(char *dest, char *src, int n) {
  return (char *)memcpy(dest, src, n * sizeof(char));
}


x86 assembly (clang, -O0):
<ncpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncpy>:
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define i8* @ncpy(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = mul i64 %10, 1
%12 = trunc i64 %11 to i32
%13 = call i64 @memcpy(i8* %7, i8* %8, i32 %12)
%14 = inttoptr i64 %13 to i8*
ret i8* %14
}

LLVM IR (-O2):
define i8* @ncpy(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 @memcpy(i8* %0, i8* %1, i32 %2)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
/* Variables and functions */
void *cfe_realloc(void *, size_t);
void *cfe_realloc_secure(void *ptr, size_t size) {
  return cfe_realloc(ptr, size);
}


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

x86 assembly (clang, -O2):
<cfe_realloc_secure>:
jmp    1030 <cfe_realloc@plt>

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

LLVM IR (-O2):
define i8* @cfe_realloc_secure(i8* %0, i64 %1) {
%3 = tail call i8* @cfe_realloc(i8* %0, i64 %1)
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void af_fclose(FILE **fp) {
  if (*fp) {
    fclose(*fp);
  }
}


x86 assembly (clang, -O0):
<af_fclose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1136 <af_fclose+0x26>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<af_fclose>:
mov    (%rdi),%rdi
test   %rdi,%rdi
je     111d <af_fclose+0xd>
jmp    1030 <fclose@plt>
ret

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

LLVM IR (-O2):
define void @af_fclose(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int rand();
void wo_self_assignement() {
  int a;
  a = rand();
  return;
}


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

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

LLVM IR (-O0):
define void @wo_self_assignement() {
%1 = alloca i32
%2 = call i32 (...) @rand()
store i32 %2, i32* %1
ret void
}

LLVM IR (-O2):
define void @wo_self_assignement() {
%1 = tail call i32 (...) @rand()
ret void
}
int hideme(int x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @hideme(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int foo(int);
int main(void) {
  int i = 3;
  return foo(i);
}


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

x86 assembly (clang, -O2):
<main>:
mov    $0x3,%edi
jmp    1030 <foo@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 3)
ret i32 %1
}
/* Variables and functions */
int EXIT_SUCCESS;
int numXifres(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int num;
  printf("Introdueix un numero enter: ");
  scanf("%d", &num);
  printf("\nNumero de xifres: %d\n\n", numXifres(num));
  return (EXIT_SUCCESS);
}


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)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%edi
call   1040 <numXifres@plt>
mov    %eax,%esi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [29 x i8] c"Introdueix un numero enter: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"\0ANumero de xifres: %d\0A\0A\00"
@EXIT_SUCCESS = 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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%9 = load i32, i32* %6
%10 = call i32 @numXifres(i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = load i32, i32* @EXIT_SUCCESS
ret i32 %12
}

LLVM IR (-O2):
@.str = [29 x i8] c"Introdueix un numero enter: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"\0ANumero de xifres: %d\0A\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = call i32 @numXifres(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @EXIT_SUCCESS
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
void OptickAPI_AttachTag_String(uint64_t inEventDescription,
                                const char *inValue, uint16_t intValueLength) {}


x86 assembly (clang, -O0):
<OptickAPI_AttachTag_String>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @OptickAPI_AttachTag_String(i32 %0, i8* nocapture %1, i32 %2) {
ret void
}
/* Variables and functions */
void bfin_gpio_free(unsigned int);
void gpio_free(unsigned gpio) { return bfin_gpio_free(gpio); }


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

x86 assembly (clang, -O2):
<gpio_free>:
jmp    1030 <bfin_gpio_free@plt>

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

LLVM IR (-O2):
define void @gpio_free(i32 %0) {
tail call void @bfin_gpio_free(i32 %0)
ret void
}
void g_queue_peek_tail() {}


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

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

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

LLVM IR (-O2):
define void @g_queue_peek_tail() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pwm_release_brightness();
void DemoState_leave() { pwm_release_brightness(); }


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

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

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

LLVM IR (-O2):
define void @DemoState_leave() {
%1 = tail call i32 (...) @pwm_release_brightness()
ret void
}
void Act_Rooms(void) { ; }


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

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

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

LLVM IR (-O2):
define void @Act_Rooms() {
ret void
}
int f7(void) {
  int v7i = 6, v7j = 7, v7k = 9, v7l = 0, v7n = 0, v7o = 1;
#pragma omp parallel
  {
#pragma omp master
    v7o++;
#pragma omp for private(v7i) firstprivate(v7k) reduction(+ : v7l)
    for (v7n = 0; v7n < 3; v7n++) {
      int v7m = v7j + v7k;
      v7i = 8;
      v7l++;
    }
  }
  return v7i + v7j + v7k + v7l + v7n;
}


x86 assembly (clang, -O0):
<f7>:
push   %rbp
mov    %rsp,%rbp
movl   $0x6,-0x4(%rbp)
movl   $0x7,-0x8(%rbp)
movl   $0x9,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    116f <f7+0x6f>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x8,-0x4(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113e <f7+0x3e>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @f7() {
ret i32 30
}
int arraySize(int *array) {
  int i, x = 0;
  for (i = 0; i < (sizeof(array) / sizeof(int)); i++) {
    if (!array[i] == 0) {
      x = x + 1;
    }
  }
  return x;
}


x86 assembly (clang, -O0):
<arraySize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    $0x2,%rax
jae    115f <arraySize+0x5f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
jne    114c <arraySize+0x4c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1151 <arraySize+0x51>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <arraySize+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<arraySize>:
xor    %eax,%eax
cmpl   $0x0,(%rdi)
setne  %al
cmpl   $0x1,0x4(%rdi)
sbb    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @arraySize(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp ne i32 %2, 0
%4 = zext i1 %3 to i32
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = load i32, i32* %5
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %4, %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_noswap(void *ptr, int size) { free(ptr); }


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

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

LLVM IR (-O0):
define void @free_noswap(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 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @free_noswap(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @free(i8* %0)
ret void
}
void g_type_test_flags() {}


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

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

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

LLVM IR (-O2):
define void @g_type_test_flags() {
ret void
}
void dma_start() { (*((volatile unsigned long *)0x7DB00114)) = 1; }


x86 assembly (clang, -O0):
<dma_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7db00114,%eax
movq   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dma_start>:
movq   $0x1,0x7db00114
ret

LLVM IR (-O0):
define void @dma_start() {
store volatile i64 1, i64* inttoptr (i64 2108686612 to i64*)
ret void
}

LLVM IR (-O2):
define void @dma_start() {
store volatile i64 1, i64* inttoptr (i64 2108686612 to i64*)
ret void
}
/* Variables and functions */
int sqrt(int);
float pierwX1(int a, int b, int delta) { return (-b + sqrt(delta)) / (2 * a); }


x86 assembly (clang, -O0):
<pierwX1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <sqrt@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pierwX1>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %edx,%edi
call   1030 <sqrt@plt>
sub    %ebx,%eax
add    %ebp,%ebp
cltd
idiv   %ebp
cvtsi2ss %eax,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define float @pierwX1(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = sub nsw i32 0, %7
%9 = load i32, i32* %6
%10 = call i32 @sqrt(i32 %9)
%11 = add nsw i32 %8, %10
%12 = load i32, i32* %4
%13 = mul nsw i32 2, %12
%14 = sdiv i32 %11, %13
%15 = sitofp i32 %14 to float
ret float %15
}

LLVM IR (-O2):
define float @pierwX1(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @sqrt(i32 %2)
%5 = sub i32 %4, %1
%6 = shl nsw i32 %0, 1
%7 = sdiv i32 %5, %6
%8 = sitofp i32 %7 to float
ret float %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_memimport_free() {
  printf("NOT IMPLEMENTED:"
         "pa_memimport_free"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [35 x i8] c"NOT IMPLEMENTED:pa_memimport_free\0A\00"
define i32 @pa_memimport_free() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [34 x i8] c"NOT IMPLEMENTED:pa_memimport_free\00"
define i32 @pa_memimport_free() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("----------------PROCESS START----------------\n");
  printf("Prob 2: abort\n");
  abort();
  printf("----------------PROCESS   END----------------\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
lea    0xefa(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"----------------PROCESS START----------------\0A\00"
@.str.1 = [15 x i8] c"Prob 2: abort\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@str = [46 x i8] c"----------------PROCESS START----------------\00"
@str.2 = [14 x i8] c"Prob 2: abort\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.2, i64 0, i64 0))
%5 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int fchownat(int /*<<< orphan*/, char const *, int /*<<< orphan*/,
             int /*<<< orphan*/, int /*<<< orphan*/);
int chown(const char *path, uid_t uid, gid_t gid) {
  return fchownat(AT_FDCWD, path, uid, gid, 0);
}


x86 assembly (clang, -O0):
<chown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
xor    %r8d,%r8d
call   1030 <fchownat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chown>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
xor    %r8d,%r8d
jmp    1030 <fchownat@plt>

LLVM IR (-O0):
@AT_FDCWD = global i32 0
define i32 @chown(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* @AT_FDCWD
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @fchownat(i32 %7, i8* %8, i32 %9, i32 %10, i32 0)
ret i32 %11
}

LLVM IR (-O2):
@AT_FDCWD = global i32 0
define i32 @chown(i8* %0, i32 %1, i32 %2) {
%4 = load i32, i32* @AT_FDCWD
%5 = tail call i32 @fchownat(i32 %4, i8* %0, i32 %1, i32 %2, i32 0)
ret i32 %5
}
int sd_dif_prepare(struct scsi_cmnd *scmd) { return 0; }


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

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

LLVM IR (-O0):
%struct.scsi_cmnd = type opaque
define i32 @sd_dif_prepare(%struct.scsi_cmnd* %0) {
%2 = alloca %struct.scsi_cmnd*
store %struct.scsi_cmnd* %0, %struct.scsi_cmnd** %2
ret i32 0
}

LLVM IR (-O2):
%struct.scsi_cmnd = type opaque
define i32 @sd_dif_prepare(%struct.scsi_cmnd* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
char *basename(char *);
char *os_program_name(char *path) {
  return path == NULL ? NULL : basename(path);
}


x86 assembly (clang, -O0):
<os_program_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1132 <os_program_name+0x22>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    113f <os_program_name+0x2f>
mov    -0x8(%rbp),%rdi
call   1030 <basename@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @os_program_name(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i8* @basename(i8* %7)
br label %9
9: ; preds = %6, %5
%10 = phi i8* [ null, %5 ], [ %8, %6 ]
ret i8* %10
}

LLVM IR (-O2):
define i8* @os_program_name(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i8* @basename(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ %4, %3 ], [ null, %1 ]
ret i8* %6
}