xunge/DecIR huggingface dataset:
void INT_Excep_WDT_WOVI(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_WDT_WOVI() {
ret void
}
/* Variables and functions */
scalar_t__ isalpha(int);
int tolower(int ch) {
  if (isalpha(ch)) {
    return ch | 0x20;
  } else {
    return ch;
  }
}


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
je     113b <tolower+0x2b>
mov    -0x8(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <tolower+0x31>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalpha@plt>
mov    %ebx,%ecx
or     $0x20,%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = tail call i64 @isalpha(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = or i32 %0, 32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
/* Variables and functions */
int bar();
int _old_bar() { return bar(); }


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

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

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

LLVM IR (-O2):
define i32 @_old_bar() {
%1 = tail call i32 (...) @bar()
ret i32 %1
}
int test_imm_92int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x92 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_92int64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x20,%rdx
and    $0x92,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_92int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 627065225216
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ b();
void a() { b(); }


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

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

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

LLVM IR (-O2):
define void @a() {
%1 = tail call i32 (...) @b()
ret void
}
void tasklet_disable(struct tasklet_struct *t) {
  tasklet_disable_nosync(t);
  do {
  } while (0);
  __asm__ __volatile__("" ::: "memory");
}


x86 assembly (clang, -O0):
<tasklet_disable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <tasklet_disable_nosync@plt>
jmp    112c <tasklet_disable+0x1c>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.tasklet_struct = type opaque
define void @tasklet_disable(%struct.tasklet_struct* %0) {
%2 = alloca %struct.tasklet_struct*
store %struct.tasklet_struct* %0, %struct.tasklet_struct** %2
%3 = load %struct.tasklet_struct*, %struct.tasklet_struct** %2
%4 = call i32 (%struct.tasklet_struct*, ...) bitcast (i32 (...)* @tasklet_disable_nosync to i32 (%struct.tasklet_struct*, ...)*)(%struct.tasklet_struct* %3)
br label %5
5: ; preds = %1
br label %6
6: ; preds = %5
ret void
}

LLVM IR (-O2):
%struct.tasklet_struct = type opaque
define void @tasklet_disable(%struct.tasklet_struct* %0) {
%2 = tail call i32 (%struct.tasklet_struct*, ...) bitcast (i32 (...)* @tasklet_disable_nosync to i32 (%struct.tasklet_struct*, ...)*)(%struct.tasklet_struct* %0)
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int func(int);
int main() {
  int i;
  int s;
  for (i = 0; i < 10; i++) {
    s = func(i);
  }
  return s;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <func@plt>
mov    $0x1,%edi
call   1030 <func@plt>
mov    $0x2,%edi
call   1030 <func@plt>
mov    $0x3,%edi
call   1030 <func@plt>
mov    $0x4,%edi
call   1030 <func@plt>
mov    $0x5,%edi
call   1030 <func@plt>
mov    $0x6,%edi
call   1030 <func@plt>
mov    $0x7,%edi
call   1030 <func@plt>
mov    $0x8,%edi
call   1030 <func@plt>
mov    $0x9,%edi
pop    %rax
jmp    1030 <func@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @func(i32 0)
%2 = tail call i32 @func(i32 1)
%3 = tail call i32 @func(i32 2)
%4 = tail call i32 @func(i32 3)
%5 = tail call i32 @func(i32 4)
%6 = tail call i32 @func(i32 5)
%7 = tail call i32 @func(i32 6)
%8 = tail call i32 @func(i32 7)
%9 = tail call i32 @func(i32 8)
%10 = tail call i32 @func(i32 9)
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ AcctReportLegacyProxy(char *, char *);
int /*<<< orphan*/ ConnectDb();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void CurrentMonthReportLegacyProxy(char *cRealm, char *cPasswd) {
  ConnectDb();
  AcctReportLegacyProxy(cRealm, "tRadacct");
  exit(0);
}


x86 assembly (clang, -O0):
<CurrentMonthReportLegacyProxy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <ConnectDb@plt>
mov    -0x8(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1040 <AcctReportLegacyProxy@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<CurrentMonthReportLegacyProxy>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <ConnectDb@plt>
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
call   1040 <AcctReportLegacyProxy@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"tRadacct\00"
define void @CurrentMonthReportLegacyProxy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 (...) @ConnectDb()
%6 = load i8*, i8** %3
%7 = call i32 @AcctReportLegacyProxy(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [9 x i8] c"tRadacct\00"
define void @CurrentMonthReportLegacyProxy(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i32 (...) @ConnectDb()
%4 = tail call i32 @AcctReportLegacyProxy(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int ap_cmd_set_int(int, int, int);
int ap_set_block(int session, int block) {
  return (ap_cmd_set_int(session, 0xcc1a, block));
}


x86 assembly (clang, -O0):
<ap_set_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    $0xcc1a,%esi
call   1030 <ap_cmd_set_int@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ap_set_block>:
mov    %esi,%edx
mov    $0xcc1a,%esi
jmp    1030 <ap_cmd_set_int@plt>

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

LLVM IR (-O2):
define i32 @ap_set_block(i32 %0, i32 %1) {
%3 = tail call i32 @ap_cmd_set_int(i32 %0, i32 52250, i32 %1)
ret i32 %3
}
/* Variables and functions */
size_t R(size_t i) { return (i * 2 + 2); }


x86 assembly (clang, -O0):
<R>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x1,%rax
add    $0x2,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<R>:
lea    (%rdi,%rdi,1),%rax
add    $0x2,%rax
ret

LLVM IR (-O0):
define i64 @R(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = mul i64 %3, 2
%5 = add i64 %4, 2
ret i64 %5
}

LLVM IR (-O2):
define i64 @R(i64 %0) {
%2 = shl i64 %0, 1
%3 = add i64 %2, 2
ret i64 %3
}
int IsNumber(char c) { return c >= '0' && c <= '9'; }


x86 assembly (clang, -O0):
<IsNumber>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <IsNumber+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsNumber>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @IsNumber(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @IsNumber(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ halt();
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int);
void __attribute__((cdecl)) irq_gpf(unsigned cs, unsigned ip) {
  printf("irq_"
         "gpf"
         "!%x:%x",
         cs, ip);
  halt();
}


x86 assembly (clang, -O0):
<irq_gpf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <halt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irq_gpf>:
push   %rax
mov    %esi,%edx
mov    %edi,%esi
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <halt@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"irq_gpf!%x:%x\00"
define void @irq_gpf(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = call i32 (...) @halt()
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"irq_gpf!%x:%x\00"
define void @irq_gpf(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%4 = tail call i32 (...) @halt()
ret void
}
/* Variables and functions */
int drotmg_(double *, double *, double *, double *, double *);
int fff_blas_drotmg(double d1[], double d2[], double b1[], double b2,
                    double P[]) {
  return (drotmg_(d1, d2, b1, &b2, P));
}


x86 assembly (clang, -O0):
<fff_blas_drotmg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%r8
lea    -0x20(%rbp),%rcx
call   1030 <drotmg_@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fff_blas_drotmg>:
push   %rax
mov    %rcx,%r8
movsd  %xmm0,(%rsp)
mov    %rsp,%rcx
call   1030 <drotmg_@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @fff_blas_drotmg(double* %0, double* %1, double* %2, double %3, double* %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca double*
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store double %3, double* %9
store double* %4, double** %10
%11 = load double*, double** %6
%12 = load double*, double** %7
%13 = load double*, double** %8
%14 = load double*, double** %10
%15 = call i32 @drotmg_(double* %11, double* %12, double* %13, double* %9, double* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @fff_blas_drotmg(double* %0, double* %1, double* %2, double %3, double* %4) {
%6 = alloca double
store double %3, double* %6
%7 = call i32 @drotmg_(double* %0, double* %1, double* %2, double* %6, double* %4)
ret i32 %7
}
/* Type definitions */
struct feed_heap {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(void *);
void feed_heap_destroy(struct feed_heap *const p_heap) {
  free((void *)(p_heap));
}


x86 assembly (clang, -O0):
<feed_heap_destroy>:
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):
<feed_heap_destroy>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.feed_heap = type { i32 }
define void @feed_heap_destroy(%struct.feed_heap* %0) {
%2 = alloca %struct.feed_heap*
store %struct.feed_heap* %0, %struct.feed_heap** %2
%3 = load %struct.feed_heap*, %struct.feed_heap** %2
%4 = bitcast %struct.feed_heap* %3 to i8*
%5 = call i32 @free(i8* %4)
ret void
}

LLVM IR (-O2):
%struct.feed_heap = type { i32 }
define void @feed_heap_destroy(%struct.feed_heap* nocapture %0) {
%2 = bitcast %struct.feed_heap* %0 to i8*
%3 = tail call i32 @free(i8* %2)
ret void
}
double sep_cost(double size_sep) { return (size_sep); }


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @foo490() {
ret void
}
/* Variables and functions */
int strlen(char *);
int string_strlen(char *s) {
  if (!s)
    return 0;
  return strlen(s);
}


x86 assembly (clang, -O0):
<string_strlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <string_strlen+0x23>
movl   $0x0,-0x4(%rbp)
jmp    113f <string_strlen+0x2f>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @string_strlen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ chunk;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const, int const);
uint32_t cipherFunction(uint32_t chunk, const uint32_t key, const int i) {
  printf("Key %d-th: %d\n", i,
         ((key << i) | (key >> (((sizeof(chunk)) * 8) - i))));
  chunk = chunk ^ ((key << i) | (key >> (((sizeof(chunk)) * 8) - i)));
  return (uint32_t)chunk;
}


x86 assembly (clang, -O0):
<cipherFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
shl    %cl,%edx
mov    -0x8(%rbp),%eax
movslq -0xc(%rbp),%rdi
mov    $0x20,%ecx
sub    %rdi,%rcx
sar    %cl,%eax
or     %eax,%edx
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
shl    %cl,%edx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%edx
movslq -0xc(%rbp),%rsi
mov    $0x20,%ecx
sub    %rsi,%rcx
sar    %cl,%edx
mov    -0x10(%rbp),%ecx
or     %edx,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cipherFunction>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %esi,%ebp
mov    %edx,%ecx
shl    %cl,%ebp
neg    %cl
sar    %cl,%esi
or     %esi,%ebp
lea    0xed8(%rip),%rdi
mov    %edx,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
xor    %ebx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Key %d-th: %d\0A\00"
define i32 @cipherFunction(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* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = shl i32 %8, %9
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = sub i64 32, %13
%15 = trunc i64 %14 to i32
%16 = ashr i32 %11, %15
%17 = or i32 %10, %16
%18 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %17)
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = shl i32 %20, %21
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = sub i64 32, %25
%27 = trunc i64 %26 to i32
%28 = ashr i32 %23, %27
%29 = or i32 %22, %28
%30 = xor i32 %19, %29
store i32 %30, i32* %4
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
@.str = [15 x i8] c"Key %d-th: %d\0A\00"
define i32 @cipherFunction(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %1, %2
%5 = sub i32 32, %2
%6 = ashr i32 %1, %5
%7 = or i32 %6, %4
%8 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %7)
%9 = xor i32 %7, %0
ret i32 %9
}
long long find_len(long long n, long long r) {
  long long len = 1;
  long long m = n;
  while (r > n) {
    r = r - n;
    n = n * m;
    len++;
  }
  return len;
}


x86 assembly (clang, -O0):
<find_len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jle    1154 <find_len+0x54>
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111c <find_len+0x1c>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_len>:
mov    $0x1,%eax
cmp    %rdi,%rsi
jle    1130 <find_len+0x30>
mov    $0x1,%eax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
sub    %rcx,%rsi
imul   %rdi,%rcx
add    $0x1,%rax
cmp    %rcx,%rsi
jg     1120 <find_len+0x20>
ret

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

LLVM IR (-O2):
define i64 @find_len(i64 %0, i64 %1) {
%3 = icmp sgt i64 %1, %0
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i64 [ %9, %4 ], [ %0, %2 ]
%6 = phi i64 [ %10, %4 ], [ 1, %2 ]
%7 = phi i64 [ %8, %4 ], [ %1, %2 ]
%8 = sub nsw i64 %7, %5
%9 = mul nsw i64 %5, %0
%10 = add nuw nsw i64 %6, 1
%11 = icmp sgt i64 %8, %9
br i1 %11, label %4, label %12
12: ; preds = %4, %2
%13 = phi i64 [ 1, %2 ], [ %10, %4 ]
ret i64 %13
}
int sndq_len(int fd) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @sndq_len(i32 %0) {
ret i32 0
}
/* Variables and functions */
int isdebugged();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%d\n", isdebugged());
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @isdebugged()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef int /*<<< orphan*/ gid_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fchown(int, int /*<<< orphan*/, int /*<<< orphan*/);
int fileno(int /*<<< orphan*/ *);
int fu_Fchown(FILE *stream, int uid, int gid) {
  int fd = fileno(stream);
  return fchown(fd, (uid_t)uid, (gid_t)gid);
}


x86 assembly (clang, -O0):
<fu_Fchown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fileno@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <fchown@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fu_Fchown>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
call   1030 <fileno@plt>
mov    %eax,%edi
mov    %ebp,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fchown@plt>

LLVM IR (-O0):
define i32 @fu_Fchown(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = call i32 @fileno(i32* %8)
store i32 %9, i32* %7
%10 = load i32, i32* %7
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = call i32 @fchown(i32 %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @fu_Fchown(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @fileno(i32* %0)
%5 = tail call i32 @fchown(i32 %4, i32 %1, i32 %2)
ret i32 %5
}
void weakdef(void) {}


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

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

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

LLVM IR (-O2):
define void @weakdef() {
ret void
}
char *ReverseString(char *sequence, const int length) {
  char *s = sequence;
  char *p = s + length - 1;
  while (s <= p) {
    char c;
    c = *s;
    *s = *p;
    *p = c;
    ++s;
    --p;
  }
  return sequence;
}


x86 assembly (clang, -O0):
<ReverseString>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
ja     116f <ReverseString+0x6f>
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x21(%rbp),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    1126 <ReverseString+0x26>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReverseString>:
mov    %rdi,%rax
movslq %esi,%rcx
add    %rdi,%rcx
add    $0xffffffffffffffff,%rcx
cmp    %rdi,%rcx
jb     113d <ReverseString+0x3d>
lea    0x1(%rax),%rdi
cs nopw 0x0(%rax,%rax,1)
movzbl -0x1(%rdi),%esi
movzbl (%rcx),%edx
mov    %dl,-0x1(%rdi)
mov    %sil,(%rcx)
add    $0xffffffffffffffff,%rcx
lea    0x1(%rdi),%rdx
cmp    %rcx,%rdi
mov    %rdx,%rdi
jbe    1120 <ReverseString+0x20>
ret

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

LLVM IR (-O2):
define i8* @ReverseString(i8* returned %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = getelementptr inbounds i8, i8* %4, i64 -1
%6 = icmp ult i8* %5, %0
br i1 %6, label %15, label %7
7: ; preds = %2, %7
%8 = phi i8* [ %13, %7 ], [ %5, %2 ]
%9 = phi i8* [ %12, %7 ], [ %0, %2 ]
%10 = load i8, i8* %9
%11 = load i8, i8* %8
store i8 %11, i8* %9
store i8 %10, i8* %8
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = getelementptr inbounds i8, i8* %8, i64 -1
%14 = icmp ugt i8* %12, %13
br i1 %14, label %15, label %7
15: ; preds = %7, %2
ret i8* %0
}
unsigned __attribute__((weak)) alarm(unsigned seconds) {
  (void)seconds;
  return 0;
}


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

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

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

LLVM IR (-O2):
define weak i32 @alarm(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("mahal v0.1 "
         "Copyright (C) 2010 Jean-François Mousinho\n"
         "\n"
         "Usage: mahal [options] [-t file] [-i file] [-o file] [-k kParam]\n"
         "     -t            Train set matrix file, def: set_train.txt\n"
         "     -i            Test set matrix file, def: set_test.txt\n"
         "     -o            Output results file, def: stdout\n"
         "Options:\n"
         "     -m            Matlab output (useful for results checks)\n"
         "     -e            Apply Euclidean distance\n"
         "     -k <k-Param>  Apply K-NN with K-Param and Mahalanobis distance\n"
         "     -c <col-idx>  Column index where the class is (one-based)\n"
         "     -v            Verbose mode.\n\n");
  exit(EXIT_SUCCESS);
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [572 x i8] c"mahal v0.1 Copyright (C) 2010 Jean-Fran\C3\A7ois Mousinho\0A\0AUsage: mahal [options] [-t file] [-i file] [-o file] [-k kParam]\0A -t Train set matrix file, def: set_train.txt\0A -i Test set matrix file, def: set_test.txt\0A -o Output results file, def: stdout\0AOptions:\0A -m Matlab output (useful for results checks)\0A -e Apply Euclidean distance\0A -k <k-Param> Apply K-NN with K-Param and Mahalanobis distance\0A -c <col-idx> Column index where the class is (one-based)\0A -v Verbose mode.\0A\0A\00"
@EXIT_SUCCESS = global i32 0
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([572 x i8], [572 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [571 x i8] c"mahal v0.1 Copyright (C) 2010 Jean-Fran\C3\A7ois Mousinho\0A\0AUsage: mahal [options] [-t file] [-i file] [-o file] [-k kParam]\0A -t Train set matrix file, def: set_train.txt\0A -i Test set matrix file, def: set_test.txt\0A -o Output results file, def: stdout\0AOptions:\0A -m Matlab output (useful for results checks)\0A -e Apply Euclidean distance\0A -k <k-Param> Apply K-NN with K-Param and Mahalanobis distance\0A -c <col-idx> Column index where the class is (one-based)\0A -v Verbose mode.\0A\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([571 x i8], [571 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = tail call i32 @exit(i32 %2)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ _strlen(char const *);
int /*<<< orphan*/ sys_write(int, char const *, int /*<<< orphan*/);
void write_string(const char *str) { sys_write(1, str, _strlen(str)); }


x86 assembly (clang, -O0):
<write_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1040 <sys_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_string>:
push   %rbx
mov    %rdi,%rbx
call   1030 <_strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1040 <sys_write@plt>

LLVM IR (-O0):
define void @write_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @_strlen(i8* %4)
%6 = call i32 @sys_write(i32 1, i8* %3, i32 %5)
ret void
}

LLVM IR (-O2):
define void @write_string(i8* %0) {
%2 = tail call i32 @_strlen(i8* %0)
%3 = tail call i32 @sys_write(i32 1, i8* %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ davinci_watchdog_reset();
void arch_reset(char mode, const char *cmd) { davinci_watchdog_reset(); }


x86 assembly (clang, -O0):
<arch_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <davinci_watchdog_reset@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @arch_reset(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
store i8 %0, i8* %3
store i8* %1, i8** %4
%5 = call i32 (...) @davinci_watchdog_reset()
ret void
}

LLVM IR (-O2):
define void @arch_reset(i8 signext %0, i8* nocapture readnone %1) {
%3 = tail call i32 (...) @davinci_watchdog_reset()
ret void
}
int extn_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @extn_init() {
ret i32 0
}
/* Variables and functions */
int rand();
void fillRand3(int arr[], size_t sz) {
  for (size_t i = 0; i < sz; i++)
    arr[i] = rand() % 2;
}


x86 assembly (clang, -O0):
<fillRand3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1161 <fillRand3+0x51>
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <fillRand3+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillRand3>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
je     1150 <fillRand3+0x40>
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <fillRand3+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @fillRand3(i32* nocapture writeonly %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i64 [ %10, %5 ], [ 0, %2 ]
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 2
%9 = getelementptr inbounds i32, i32* %0, i64 %6
store i32 %8, i32* %9
%10 = add nuw i64 %6, 1
%11 = icmp eq i64 %10, %1
br i1 %11, label %4, label %5
}
/* Variables and functions */
int /*<<< orphan*/ write(int, unsigned char *, int);
void uputch(int fd, unsigned char a) { write(fd, &a, 1); }


x86 assembly (clang, -O0):
<uputch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x5(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uputch>:
push   %rax
mov    %sil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @uputch(i32 %0, i8 zeroext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = call i32 @write(i32 %0, i8* %3, i32 1)
ret void
}
__attribute__((no)) double this_is_very_code(double tt) {
  volatile double dead = 3434343434, beaf = 56565656;
  return dead / beaf + beaf / dead + tt / 183;
}


x86 assembly (clang, -O0):
<this_is_very_code>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeff(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeea(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xeb0(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<this_is_very_code>:
movabs $0x41e9967d81400000,%rax
96 e9 41
mov    %rax,-0x8(%rsp)
movabs $0x418af8fcc0000000,%rax
f8 8a 41
mov    %rax,-0x10(%rsp)
movhpd -0x8(%rsp),%xmm0
movapd 0xed4(%rip),%xmm1
movhpd -0x10(%rsp),%xmm1
movsd  -0x10(%rsp),%xmm2
divsd  -0x8(%rsp),%xmm2
divpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @this_is_very_code(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
store volatile double 0x41E9967D81400000, double* %3
store volatile double 0x418AF8FCC0000000, double* %4
%5 = load volatile double, double* %3
%6 = load volatile double, double* %4
%7 = fdiv double %5, %6
%8 = load volatile double, double* %4
%9 = load volatile double, double* %3
%10 = fdiv double %8, %9
%11 = fadd double %7, %10
%12 = load double, double* %2
%13 = fdiv double %12, 1.830000e+02
%14 = fadd double %11, %13
ret double %14
}

LLVM IR (-O2):
define double @this_is_very_code(double %0) {
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %2 to i8*
store volatile double 0x41E9967D81400000, double* %2
%5 = bitcast double* %3 to i8*
store volatile double 0x418AF8FCC0000000, double* %3
%6 = load volatile double, double* %2
%7 = load volatile double, double* %3
%8 = load volatile double, double* %3
%9 = load volatile double, double* %2
%10 = fdiv double %8, %9
%11 = insertelement <2 x double> poison, double %0, i64 0
%12 = insertelement <2 x double> %11, double %6, i64 1
%13 = insertelement <2 x double> <double 1.830000e+02, double poison>, double %7, i64 1
%14 = fdiv <2 x double> %12, %13
%15 = extractelement <2 x double> %14, i64 1
%16 = fadd double %15, %10
%17 = extractelement <2 x double> %14, i64 0
%18 = fadd double %17, %16
ret double %18
}
/* Variables and functions */
int read_int(int *, char const *);
int option_read_int(void *out, const char *in) {
  int *out_int = out;
  return read_int(out_int, in);
}


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

x86 assembly (clang, -O2):
<option_read_int>:
jmp    1030 <read_int@plt>

LLVM IR (-O0):
define i32 @option_read_int(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = load i8*, i8** %4
%10 = call i32 @read_int(i32* %8, i8* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @option_read_int(i8* %0, i8* %1) {
%3 = bitcast i8* %0 to i32*
%4 = tail call i32 @read_int(i32* %3, i8* %1)
ret i32 %4
}
int kume_kesisimi_bul(int A[], int A_size, int B[], int B_size, int sonuc[]) {
  return -1;
}


x86 assembly (clang, -O0):
<kume_kesisimi_bul>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @kume_kesisimi_bul(i32* %0, i32 %1, i32* %2, i32 %3, i32* %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32*
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i32* %4, i32** %10
ret i32 -1
}

LLVM IR (-O2):
define i32 @kume_kesisimi_bul(i32* nocapture readnone %0, i32 %1, i32* nocapture readnone %2, i32 %3, i32* nocapture readnone %4) {
ret i32 -1
}
void ff_hevc_put_hevc_bi_epel_h12_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_epel_h12_10_sse4() {
ret void
}
/* Variables and functions */
scalar_t__ RAND_MAX;
int /*<<< orphan*/ assert(int);
float random();
float unirandom_f(float beg, float end) {
  assert(beg < end);
  return beg + (end - beg) * (random() / (float)RAND_MAX);
}


x86 assembly (clang, -O0):
<unirandom_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <random@plt>
movss  -0x10(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0xc(%rbp),%xmm0
mov    0x2e68(%rip),%rax
cvtsi2ssq (%rax),%xmm3
divss  %xmm3,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unirandom_f>:
push   %rax
movss  %xmm1,(%rsp)
movss  %xmm0,0x4(%rsp)
xor    %edi,%edi
ucomiss %xmm0,%xmm1
seta   %dil
call   1030 <assert@plt>
movss  (%rsp),%xmm0
subss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <random@plt>
mov    0x2e90(%rip),%rax
xorps  %xmm1,%xmm1
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
mulss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define float @unirandom_f(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp olt float %5, %6
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load float, float* %3
%11 = load float, float* %4
%12 = load float, float* %3
%13 = fsub float %11, %12
%14 = call float (...) @random()
%15 = load i64, i64* @RAND_MAX
%16 = sitofp i64 %15 to float
%17 = fdiv float %14, %16
%18 = call float @llvm.fmuladd.f32(float %13, float %17, float %10)
ret float %18
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define float @unirandom_f(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = fsub float %1, %0
%7 = tail call float (...) @random()
%8 = load i64, i64* @RAND_MAX
%9 = sitofp i64 %8 to float
%10 = fdiv float %7, %9
%11 = tail call float @llvm.fmuladd.f32(float %6, float %10, float %0)
ret float %11
}
/* Variables and functions */
scalar_t__ ntohl(unsigned int);
int convertInt(char *s) {
  unsigned int *p = (unsigned int *)s;
  return (int)ntohl(*p);
}


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

x86 assembly (clang, -O2):
<convertInt>:
mov    (%rdi),%edi
jmp    1030 <ntohl@plt>

LLVM IR (-O0):
define i32 @convertInt(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = call i64 @ntohl(i32 %7)
%9 = trunc i64 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @convertInt(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i64 @ntohl(i32 %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
unsigned int ya_random();
unsigned int random1(unsigned int i) { return (ya_random() % i); }


x86 assembly (clang, -O0):
<random1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <ya_random@plt>
xor    %edx,%edx
divl   -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random1>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <ya_random@plt>
xor    %edx,%edx
div    %ebx
mov    %edx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @random1(i32 %0) {
%2 = tail call i32 (...) @ya_random()
%3 = urem i32 %2, %0
ret i32 %3
}
char to_upper_case(char letter) {
  if (letter >= 97 && letter <= 122)
    letter -= 32;
  return letter;
}


x86 assembly (clang, -O0):
<to_upper_case>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     112e <to_upper_case+0x2e>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
jg     112e <to_upper_case+0x2e>
movsbl -0x1(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_upper_case>:
lea    -0x61(%rdi),%eax
lea    -0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @to_upper_case(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 122
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = sub nsw i32 %12, 32
%14 = trunc i32 %13 to i8
store i8 %14, i8* %2
br label %15
15: ; preds = %10, %6, %1
%16 = load i8, i8* %2
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @to_upper_case(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, -32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
yyErr(n, l) { yyAbort(n, "encode", l); }


x86 assembly (clang, -O0):
<yyErr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%edx
lea    0xed5(%rip),%rsi
mov    $0x0,%al
call   1030 <yyAbort@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yyErr>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
xor    %eax,%eax
jmp    1030 <yyAbort@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"encode\00"
define i32 @yyErr(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @yyAbort to i32 (i32, i8*, i32, ...)*)(i32 %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
@.str = [7 x i8] c"encode\00"
define i32 @yyErr(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @yyAbort to i32 (i32, i8*, i32, ...)*)(i32 %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 undef
}
/* Variables and functions */
int start_color();
int wrap_start_color(void) { return start_color(); }


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

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

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

LLVM IR (-O2):
define i32 @wrap_start_color() {
%1 = tail call i32 (...) @start_color()
ret i32 %1
}