xunge/DecIR huggingface dataset:
/* Variables and functions */
bool audio_valid_channel_count(unsigned channels) {
  return channels >= 1 && channels <= 8;
}


x86 assembly (clang, -O0):
<audio_valid_channel_count>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jb     1120 <audio_valid_channel_count+0x20>
cmpl   $0x8,-0x4(%rbp)
setbe  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<audio_valid_channel_count>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0x8,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @audio_valid_channel_count(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp uge i32 %3, 1
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp ule i32 %6, 8
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @audio_valid_channel_count(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 8
%4 = zext i1 %3 to i32
ret i32 %4
}
void g_main_context_wait() {}


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

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

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

LLVM IR (-O2):
define void @g_main_context_wait() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int smash_stack(int i __attribute__((__unused__))) {
  printf("crasher: deliberately corrupting stack...\n");
  char buf[8];
  *(int *)(&buf[7]) = (uintptr_t)&buf[0];
  return *(int *)(&buf[0]);
}


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

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

LLVM IR (-O0):
@.str = [43 x i8] c"crasher: deliberately corrupting stack...\0A\00"
define i32 @smash_stack(i32 %0) {
%2 = alloca i32
%3 = alloca [8 x i8]
store i32 %0, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%6 = ptrtoint i8* %5 to i64
%7 = trunc i64 %6 to i32
%8 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 7
%9 = bitcast i8* %8 to i32*
store i32 %7, i32* %9
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
ret i32 %12
}

LLVM IR (-O2):
@str = [42 x i8] c"crasher: deliberately corrupting stack...\00"
define i32 @smash_stack(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ print_characters(char *);
int /*<<< orphan*/ printf(char *);
int main() {
  char string[] = "Billy Wilson Arante";
  printf("The string is:\n");
  print_characters(string);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <print_characters@plt>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xec5(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x65746e,0x10(%rsp)
lea    0xec6(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rdi
call   1050 <print_characters@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.string = [20 x i8] c"Billy Wilson Arante\00"
@.str = [16 x i8] c"The string is:\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
store i32 0, i32* %1
%3 = bitcast [20 x i8]* %2 to i8*
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = call i32 @print_characters(i8* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.string = [20 x i8] c"Billy Wilson Arante\00"
@str = [15 x i8] c"The string is:\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%4 = call i32 @print_characters(i8* %2)
%5 = call i32 @putchar(i32 10)
ret i32 0
}
/* Variables and functions */
double log10(double);
double AmpToDbD(double amplitude) { return 20.0 * log10(amplitude); }


x86 assembly (clang, -O0):
<AmpToDbD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log10@plt>
movaps %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define double @AmpToDbD(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @log10(double %3)
%5 = fmul double 2.000000e+01, %4
ret double %5
}

LLVM IR (-O2):
define double @AmpToDbD(double %0) {
%2 = tail call double @log10(double %0)
%3 = fmul double %2, 2.000000e+01
ret double %3
}
void initialize_Timer() {}


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

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

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

LLVM IR (-O2):
define void @initialize_Timer() {
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
int htx_strcmp(const char *s1, const char *s2) { return strcmp(s1, s2); }


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

x86 assembly (clang, -O2):
<htx_strcmp>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @htx_strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
bool nrf52_errata_86(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_86() {
ret i32 0
}
int execute_utimes() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_utimes() {
ret i32 0
}
void catcher(int sig) {
  printf("\n %s: \n", __func__);
  printf("Signal catcher called for signal %d\n", sig);
}


x86 assembly (clang, -O0):
<catcher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
lea    0xedf(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<catcher>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
lea    0xee7(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"\0A %s: \0A\00"
@__func__.catcher = [8 x i8] c"catcher\00"
@.str.1 = [37 x i8] c"Signal catcher called for signal %d\0A\00"
define void @catcher(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__func__.catcher, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\0A %s: \0A\00"
@__func__.catcher = [8 x i8] c"catcher\00"
@.str.1 = [37 x i8] c"Signal catcher called for signal %d\0A\00"
define void @catcher(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__func__.catcher, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ printenv();
void main() {
  pid_t childPid;
  switch (childPid = fork()) {
  case 0:
    printenv();
    exit(0);
  default:
    exit(0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <fork@plt>
mov    %eax,-0x4(%rbp)
test   %eax,%eax
jne    115d <main+0x2d>
jmp    114f <main+0x1f>
mov    $0x0,%al
call   1030 <printenv@plt>
xor    %edi,%edi
call   1040 <exit@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <fork@plt>
test   %eax,%eax
jne    1143 <main+0x13>
xor    %eax,%eax
call   1030 <printenv@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = call i32 (...) @fork()
store i32 %2, i32* %1
switch i32 %2, label %6 [
i32 0, label %3
]
3: ; preds = %0
%4 = call i32 (...) @printenv()
%5 = call i32 @exit(i32 0)
unreachable
6: ; preds = %0
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @fork()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 (...) @printenv()
%5 = tail call i32 @exit(i32 0)
unreachable
6: ; preds = %0
%7 = tail call i32 @exit(i32 0)
unreachable
}
int fun1092() { return 1092; }


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

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

LLVM IR (-O0):
define i32 @fun1092() {
ret i32 1092
}

LLVM IR (-O2):
define i32 @fun1092() {
ret i32 1092
}
double builtin_fms(double b, double c, double d) {
  return __builtin_fma(b, c, -d);
}


x86 assembly (clang, -O0):
<builtin_fms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
call   1030 <fma@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<builtin_fms>:
xorps  0xee9(%rip),%xmm2
jmp    1030 <fma@plt>

LLVM IR (-O0):
define double @builtin_fms(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = load double, double* %6
%10 = fneg double %9
%11 = call double @llvm.fma.f64(double %7, double %8, double %10)
ret double %11
}

LLVM IR (-O2):
define double @builtin_fms(double %0, double %1, double %2) {
%4 = fneg double %2
%5 = tail call double @llvm.fma.f64(double %0, double %1, double %4)
ret double %5
}
/* Variables and functions */
scalar_t__ lenglish(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int i, answer = 0;
  for (i = 1; i <= 1000; i++) {
    answer += lenglish(i);
  }
  printf("%i\n", answer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jg     1174 <main+0x54>
mov    -0x14(%rbp),%edi
call   1030 <lenglish@plt>
mov    %rax,%rcx
movslq -0x18(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <main+0x24>
mov    -0x18(%rbp),%esi
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <lenglish@plt>
add    %eax,%ebx
add    $0x1,%ebp
cmp    $0x3e9,%ebp
jne    1130 <main+0x10>
lea    0xeb5(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 1, i32* %6
br label %8
8: ; preds = %18, %2
%9 = load i32, i32* %6
%10 = icmp sle i32 %9, 1000
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i32, i32* %6
%13 = call i64 @lenglish(i32 %12)
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = add nsw i64 %15, %13
%17 = trunc i64 %16 to i32
store i32 %17, i32* %7
br label %18
18: ; preds = %11
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
br label %8
21: ; preds = %8
%22 = load i32, i32* %7
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 0, %2 ], [ %8, %3 ]
%5 = phi i32 [ 1, %2 ], [ %9, %3 ]
%6 = tail call i64 @lenglish(i32 %5)
%7 = trunc i64 %6 to i32
%8 = add i32 %4, %7
%9 = add nuw nsw i32 %5, 1
%10 = icmp eq i32 %9, 1001
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Type definitions */
struct Graph {
  int dummy;
};

/* Variables and functions */
double kruskal(struct Graph *, int, int);
double test_kruskal(struct Graph *graph, int v1, int v2) {
  return kruskal(graph, v1, v2);
}


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

x86 assembly (clang, -O2):
<test_kruskal>:
jmp    1030 <kruskal@plt>

LLVM IR (-O0):
%struct.Graph = type { i32 }
define double @test_kruskal(%struct.Graph* %0, i32 %1, i32 %2) {
%4 = alloca %struct.Graph*
%5 = alloca i32
%6 = alloca i32
store %struct.Graph* %0, %struct.Graph** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.Graph*, %struct.Graph** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call double @kruskal(%struct.Graph* %7, i32 %8, i32 %9)
ret double %10
}

LLVM IR (-O2):
%struct.Graph = type { i32 }
define double @test_kruskal(%struct.Graph* %0, i32 %1, i32 %2) {
%4 = tail call double @kruskal(%struct.Graph* %0, i32 %1, i32 %2)
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ r4030_delay();
void r4030_write_reg32(unsigned addr, unsigned val) {
  *((volatile unsigned int *)addr) = val;
  r4030_delay();
}


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

x86 assembly (clang, -O2):
<r4030_write_reg32>:
mov    %edi,%eax
mov    %esi,(%rax)
xor    %eax,%eax
jmp    1030 <r4030_delay@plt>

LLVM IR (-O0):
define void @r4030_write_reg32(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* %3
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
store volatile i32 %5, i32* %8
%9 = call i32 (...) @r4030_delay()
ret void
}

LLVM IR (-O2):
define void @r4030_write_reg32(i32 %0, i32 %1) {
%3 = zext i32 %0 to i64
%4 = inttoptr i64 %3 to i32*
store volatile i32 %1, i32* %4
%5 = tail call i32 (...) @r4030_delay()
ret void
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
mode_t posix_stat_st_mode(const struct stat *st) { return st->st_mode; }


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

x86 assembly (clang, -O2):
<posix_stat_st_mode>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @posix_stat_st_mode(%struct.stat* %0) {
%2 = alloca %struct.stat*
store %struct.stat* %0, %struct.stat** %2
%3 = load %struct.stat*, %struct.stat** %2
%4 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @posix_stat_st_mode(%struct.stat* nocapture %0) {
%2 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 0
%3 = load i32, i32* %2
ret i32 %3
}
int fun621() { return 621; }


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

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

LLVM IR (-O0):
define i32 @fun621() {
ret i32 621
}

LLVM IR (-O2):
define i32 @fun621() {
ret i32 621
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void closesoundin(FILE *file) { fclose(file); }


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

x86 assembly (clang, -O2):
<closesoundin>:
jmp    1030 <fclose@plt>

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

LLVM IR (-O2):
define void @closesoundin(i32* nocapture %0) {
%2 = tail call i32 @fclose(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ltr_int_log_message(char *);
int ltr_int_make_socket(char const *);
int ltr_int_create_server_socket(const char *name) {
  int fifo = -1;
  fifo = ltr_int_make_socket(name);
  if (fifo < 0) {
    ltr_int_log_message("Failed to create socket!\n");
    return -1;
  }
  return fifo;
}


x86 assembly (clang, -O0):
<ltr_int_create_server_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <ltr_int_make_socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1161 <ltr_int_create_server_socket+0x41>
lea    0xeb0(%rip),%rdi
call   1030 <ltr_int_log_message@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1167 <ltr_int_create_server_socket+0x47>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltr_int_create_server_socket>:
push   %rax
call   1040 <ltr_int_make_socket@plt>
test   %eax,%eax
js     112c <ltr_int_create_server_socket+0xc>
pop    %rcx
ret
lea    0xecd(%rip),%rdi
call   1030 <ltr_int_log_message@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Failed to create socket!\0A\00"
define i32 @ltr_int_create_server_socket(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 -1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @ltr_int_make_socket(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @ltr_int_log_message(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %13
11: ; preds = %1
%12 = load i32, i32* %4
store i32 %12, i32* %2
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [26 x i8] c"Failed to create socket!\0A\00"
define i32 @ltr_int_create_server_socket(i8* %0) {
%2 = tail call i32 @ltr_int_make_socket(i8* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @ltr_int_log_message(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ -1, %4 ], [ %2, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void ythtbbs_override_unlock(int lockfd) { close(lockfd); }


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

x86 assembly (clang, -O2):
<ythtbbs_override_unlock>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @ythtbbs_override_unlock(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ errorcheck(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fwrite(unsigned int *, int, int, int /*<<< orphan*/ *);
void writedata_header(FILE *fp) {
  unsigned int tmp32;
  errorcheck(fprintf(fp, "data"));
  tmp32 = 0;
  errorcheck(fwrite(&tmp32, 4, 1, fp));
}


x86 assembly (clang, -O0):
<writedata_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1030 <fprintf@plt>
mov    %eax,%edi
call   1040 <errorcheck@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0xc(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1050 <fwrite@plt>
mov    %eax,%edi
call   1040 <errorcheck@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writedata_header>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xec1(%rip),%rsi
call   1030 <fprintf@plt>
mov    %eax,%edi
call   1040 <errorcheck@plt>
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %eax,%edi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <errorcheck@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"data\00"
define void @writedata_header(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @errorcheck(i32 %5)
store i32 0, i32* %3
%7 = load i32*, i32** %2
%8 = call i32 @fwrite(i32* %3, i32 4, i32 1, i32* %7)
%9 = call i32 @errorcheck(i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"data\00"
define void @writedata_header(i32* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @errorcheck(i32 %4)
store i32 0, i32* %2
%6 = call i32 @fwrite(i32* %2, i32 4, i32 1, i32* %0)
%7 = tail call i32 @errorcheck(i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ func1();
int /*<<< orphan*/ printf(char *);
int main(int argv, char **argc) {
  printf("Hello world\n");
  func1();
  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>
mov    $0x0,%al
call   1030 <func1@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world\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 ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @func1()
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"Hello world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @func1()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int _find_error(char const *, int);
int /*<<< orphan*/ errno;
int _cmd_check_arg(int *i, int cmdc, char const *cmd) {
  if (++(*i) == cmdc) {
    errno = EINVAL;
    return _find_error(cmd, 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<_cmd_check_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rcx
mov    (%rcx),%eax
add    $0x1,%eax
mov    %eax,(%rcx)
cmp    -0x14(%rbp),%eax
jne    115f <_cmd_check_arg+0x4f>
mov    0x2e9a(%rip),%rax
mov    (%rax),%ecx
mov    0x2e99(%rip),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rdi
mov    $0x1,%esi
call   1030 <_find_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1166 <_cmd_check_arg+0x56>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cmd_check_arg>:
mov    (%rdi),%eax
add    $0x1,%eax
mov    %eax,(%rdi)
cmp    %esi,%eax
jne    113a <_cmd_check_arg+0x2a>
mov    0x2eb6(%rip),%rax
mov    (%rax),%eax
mov    0x2eb5(%rip),%rcx
mov    %eax,(%rcx)
mov    %rdx,%rdi
mov    $0x1,%esi
jmp    1030 <_find_error@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
@errno = global i32 0
define i32 @_cmd_check_arg(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
store i32 %10, i32* %8
%11 = load i32, i32* %6
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i32, i32* @EINVAL
store i32 %14, i32* @errno
%15 = load i8*, i8** %7
%16 = call i32 @_find_error(i8* %15, i32 1)
store i32 %16, i32* %4
br label %18
17: ; preds = %3
store i32 0, i32* %4
br label %18
18: ; preds = %17, %13
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
@EINVAL = global i32 0
@errno = global i32 0
define i32 @_cmd_check_arg(i32* nocapture %0, i32 %1, i8* %2) {
%4 = load i32, i32* %0
%5 = add nsw i32 %4, 1
store i32 %5, i32* %0
%6 = icmp eq i32 %5, %1
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i32, i32* @EINVAL
store i32 %8, i32* @errno
%9 = tail call i32 @_find_error(i8* %2, i32 1)
br label %10
10: ; preds = %3, %7
%11 = phi i32 [ %9, %7 ], [ 0, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("msgd -f <message file> -l <lifetime> -s <sleep time> -p <port>\n"
         "\n"
         "message file      full path to the file that is displayed on\n"
         "                  incoming connections\n"
         "lifetime          time after which this app exits\n"
         "sleeptime         time between the end of messagefile and the\n"
         "                  connection being closed\n"
         "port              port number to listen on\n"
         "\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [363 x i8] c"msgd -f <message file> -l <lifetime> -s <sleep time> -p <port>\0A\0Amessage file full path to the file that is displayed on\0A incoming connections\0Alifetime time after which this app exits\0Asleeptime time between the end of messagefile and the\0A connection being closed\0Aport port number to listen on\0A\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([363 x i8], [363 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [362 x i8] c"msgd -f <message file> -l <lifetime> -s <sleep time> -p <port>\0A\0Amessage file full path to the file that is displayed on\0A incoming connections\0Alifetime time after which this app exits\0Asleeptime time between the end of messagefile and the\0A connection being closed\0Aport port number to listen on\0A\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([362 x i8], [362 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdout;
void gtp_flush(void) {
  putchar('\n');
  fflush(stdout);
}


x86 assembly (clang, -O0):
<gtp_flush>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gtp_flush>:
push   %rax
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @gtp_flush() {
%1 = call i32 @putchar(i8 signext 10)
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @gtp_flush() {
%1 = tail call i32 @putchar(i8 signext 10)
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
ret void
}
/* Variables and functions */
long strtol(char *, char **, int);
long atoi_or_default(char *s, long def) {
  char *end = NULL;
  long result = strtol(s, &end, 10);
  if (end && *end == 0)
    return result;
  return def;
}


x86 assembly (clang, -O0):
<atoi_or_default>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1166 <atoi_or_default+0x56>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1166 <atoi_or_default+0x56>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116e <atoi_or_default+0x5e>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoi_or_default>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    0x8(%rsp),%rcx
test   %rcx,%rcx
je     1142 <atoi_or_default+0x32>
cmpb   $0x0,(%rcx)
jne    1142 <atoi_or_default+0x32>
mov    %rax,%rbx
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i64 @atoi_or_default(i8* %0, i64 %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* null, i8** %6
%8 = load i8*, i8** %4
%9 = call i64 @strtol(i8* %8, i8** %6, i32 10)
store i64 %9, i64* %7
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %19
12: ; preds = %2
%13 = load i8*, i8** %6
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = load i64, i64* %7
store i64 %18, i64* %3
br label %21
19: ; preds = %12, %2
%20 = load i64, i64* %5
store i64 %20, i64* %3
br label %21
21: ; preds = %19, %17
%22 = load i64, i64* %3
ret i64 %22
}

LLVM IR (-O2):
define i64 @atoi_or_default(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i64 @strtol(i8* %0, i8** %3, i32 10)
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8, i8* %6
%10 = icmp eq i8 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %8, %2
br label %12
12: ; preds = %8, %11
%13 = phi i64 [ %1, %11 ], [ %5, %8 ]
ret i64 %13
}
__attribute__((gnu_)) int carmen_round(double X) {
  if (X >= 0)
    return (int)(X + 0.5);
  else
    return (int)(X - 0.5);
}


x86 assembly (clang, -O0):
<carmen_round>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1134 <carmen_round+0x34>
movsd  0xedd(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    114c <carmen_round+0x4c>
movsd  -0x10(%rbp),%xmm0
movsd  0xebf(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<carmen_round>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setb   %al
lea    0xeec(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @carmen_round(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load double, double* %3
%8 = fadd double %7, 5.000000e-01
%9 = fptosi double %8 to i32
store i32 %9, i32* %2
br label %14
10: ; preds = %1
%11 = load double, double* %3
%12 = fsub double %11, 5.000000e-01
%13 = fptosi double %12 to i32
store i32 %13, i32* %2
br label %14
14: ; preds = %10, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @carmen_round(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
%3 = select i1 %2, double -5.000000e-01, double 5.000000e-01
%4 = fadd double %3, %0
%5 = fptosi double %4 to i32
ret i32 %5
}
/* Variables and functions */
size_t strleneq(const char *str) {
  size_t l = 0;
  while (*str && *str != '=') {
    str++;
    l++;
  }
  if (!*str)
    return 0;
  return l;
}


x86 assembly (clang, -O0):
<strleneq>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1135 <strleneq+0x35>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1145 <strleneq+0x45>
jmp    1162 <strleneq+0x62>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1110 <strleneq+0x10>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    117c <strleneq+0x7c>
movq   $0x0,-0x8(%rbp)
jmp    1184 <strleneq+0x84>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strleneq>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rax,1),%ecx
test   %cl,%cl
je     1123 <strleneq+0x23>
cmp    $0x3d,%cl
je     1123 <strleneq+0x23>
add    $0x1,%rax
jmp    1110 <strleneq+0x10>
xor    %edx,%edx
test   %cl,%cl
cmove  %rdx,%rax
ret

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

LLVM IR (-O2):
define i64 @strleneq(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = phi i64 [ 0, %1 ], [ %8, %6 ]
%5 = load i8, i8* %3
switch i8 %5, label %6 [
i8 0, label %9
i8 61, label %9
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = add i64 %4, 1
br label %2
9: ; preds = %2, %2
%10 = icmp eq i8 %5, 0
%11 = select i1 %10, i64 0, i64 %4
ret i64 %11
}
/* Type definitions */
struct flashrom_flashctx {
  int dummy;
};

/* Variables and functions */
int spi_write_cmd(struct flashrom_flashctx *, int, int, unsigned int,
                  int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int spi_block_erase_dc(struct flashrom_flashctx *flash, unsigned int addr,
                       unsigned int blocklen) {
  return spi_write_cmd(flash, 0xdc, true, addr, NULL, 0, 100 * 1000);
}


x86 assembly (clang, -O0):
<spi_block_erase_dc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    $0xdc,%esi
mov    $0x1,%edx
xor    %eax,%eax
mov    %eax,%r8d
xor    %r9d,%r9d
movl   $0x186a0,(%rsp)
call   1030 <spi_write_cmd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_block_erase_dc>:
push   %rax
mov    %esi,%ecx
movl   $0x186a0,(%rsp)
mov    $0xdc,%esi
mov    $0x1,%edx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <spi_write_cmd@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_block_erase_dc(%struct.flashrom_flashctx* %0, i32 %1, i32 %2) {
%4 = alloca %struct.flashrom_flashctx*
%5 = alloca i32
%6 = alloca i32
store %struct.flashrom_flashctx* %0, %struct.flashrom_flashctx** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.flashrom_flashctx*, %struct.flashrom_flashctx** %4
%8 = load i32, i32* %5
%9 = call i32 @spi_write_cmd(%struct.flashrom_flashctx* %7, i32 220, i32 1, i32 %8, i32* null, i32 0, i32 100000)
ret i32 %9
}

LLVM IR (-O2):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_block_erase_dc(%struct.flashrom_flashctx* %0, i32 %1, i32 %2) {
%4 = tail call i32 @spi_write_cmd(%struct.flashrom_flashctx* %0, i32 220, i32 1, i32 %1, i32* null, i32 0, i32 100000)
ret i32 %4
}
void g_key_file_set_string_list() {}


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

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

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

LLVM IR (-O2):
define void @g_key_file_set_string_list() {
ret void
}
int foo(short a) {
  switch (a) {
  case 1:
    return 11;
    break;
  case 33:
    return 333;
    break;
  case 55:
    return 55;
    break;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x6(%rbp)
movswl -0x6(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     1142 <foo+0x42>
jmp    1120 <foo+0x20>
mov    -0xc(%rbp),%eax
sub    $0x21,%eax
je     114e <foo+0x4e>
jmp    1131 <foo+0x31>
mov    -0xc(%rbp),%eax
sub    $0x37,%eax
je     115a <foo+0x5a>
jmp    1166 <foo+0x66>
movl   $0xb,-0x4(%rbp)
jmp    116d <foo+0x6d>
movl   $0x14d,-0x4(%rbp)
jmp    116d <foo+0x6d>
movl   $0x37,-0x4(%rbp)
jmp    116d <foo+0x6d>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    $0x1,%edi
je     1115 <foo+0x15>
cmp    $0x37,%edi
je     111b <foo+0x1b>
cmp    $0x21,%edi
jne    1121 <foo+0x21>
mov    $0x14d,%eax
ret
mov    $0xb,%eax
ret
mov    $0x37,%eax
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @foo(i16 signext %0) {
%2 = alloca i32
%3 = alloca i16
store i16 %0, i16* %3
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
switch i32 %5, label %9 [
i32 1, label %6
i32 33, label %7
i32 55, label %8
]
6: ; preds = %1
store i32 11, i32* %2
br label %10
7: ; preds = %1
store i32 333, i32* %2
br label %10
8: ; preds = %1
store i32 55, i32* %2
br label %10
9: ; preds = %1
store i32 -1, i32* %2
br label %10
10: ; preds = %9, %8, %7, %6
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @foo(i16 signext %0) {
%2 = sext i16 %0 to i32
switch i32 %2, label %5 [
i32 1, label %6
i32 33, label %3
i32 55, label %4
]
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3
%7 = phi i32 [ -1, %5 ], [ 55, %4 ], [ 333, %3 ], [ 11, %1 ]
ret i32 %7
}
/* Type definitions */
struct sk_buff {
  int dummy;
};

/* Variables and functions */
int cap_ip_decode_options(struct sk_buff *, char const *, unsigned char **);
int security_ip_decode_options(struct sk_buff *skb, const char *optptr,
                               unsigned char **pp_ptr) {
  return cap_ip_decode_options(skb, optptr, pp_ptr);
}


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

x86 assembly (clang, -O2):
<security_ip_decode_options>:
jmp    1030 <cap_ip_decode_options@plt>

LLVM IR (-O0):
%struct.sk_buff = type { i32 }
define i32 @security_ip_decode_options(%struct.sk_buff* %0, i8* %1, i8** %2) {
%4 = alloca %struct.sk_buff*
%5 = alloca i8*
%6 = alloca i8**
store %struct.sk_buff* %0, %struct.sk_buff** %4
store i8* %1, i8** %5
store i8** %2, i8*** %6
%7 = load %struct.sk_buff*, %struct.sk_buff** %4
%8 = load i8*, i8** %5
%9 = load i8**, i8*** %6
%10 = call i32 @cap_ip_decode_options(%struct.sk_buff* %7, i8* %8, i8** %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.sk_buff = type { i32 }
define i32 @security_ip_decode_options(%struct.sk_buff* %0, i8* %1, i8** %2) {
%4 = tail call i32 @cap_ip_decode_options(%struct.sk_buff* %0, i8* %1, i8** %2)
ret i32 %4
}
int on_alive(struct timer *timer, struct timeval *now) { return 0; }


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

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

LLVM IR (-O0):
%struct.timer = type opaque
%struct.timeval = type opaque
define i32 @on_alive(%struct.timer* %0, %struct.timeval* %1) {
%3 = alloca %struct.timer*
%4 = alloca %struct.timeval*
store %struct.timer* %0, %struct.timer** %3
store %struct.timeval* %1, %struct.timeval** %4
ret i32 0
}

LLVM IR (-O2):
%struct.timer = type opaque
%struct.timeval = type opaque
define i32 @on_alive(%struct.timer* nocapture readnone %0, %struct.timeval* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
long GetScrWidth59();
long getscrwidth() { return GetScrWidth59(); }


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

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

LLVM IR (-O0):
define i64 @getscrwidth() {
%1 = call i64 (...) @GetScrWidth59()
ret i64 %1
}

LLVM IR (-O2):
define i64 @getscrwidth() {
%1 = tail call i64 (...) @GetScrWidth59()
ret i64 %1
}
unsigned f1(unsigned abcd[]) {
  return (abcd[3] & abcd[1]) | (~abcd[3] & abcd[2]);
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
mov    -0x8(%rbp),%rcx
and    0x4(%rcx),%eax
mov    -0x8(%rbp),%rcx
mov    0xc(%rcx),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rdx
and    0x8(%rdx),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
mov    0x8(%rdi),%ecx
mov    0x4(%rdi),%eax
xor    %ecx,%eax
and    0xc(%rdi),%eax
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @f1(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 3
%5 = load i32, i32* %4
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = load i32, i32* %7
%9 = and i32 %5, %8
%10 = load i32*, i32** %2
%11 = getelementptr inbounds i32, i32* %10, i64 3
%12 = load i32, i32* %11
%13 = xor i32 %12, -1
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 2
%16 = load i32, i32* %15
%17 = and i32 %13, %16
%18 = or i32 %9, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @f1(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = load i32, i32* %2
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = and i32 %5, %3
%7 = xor i32 %3, -1
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %8
%10 = and i32 %9, %7
%11 = or i32 %10, %6
ret i32 %11
}
/* Variables and functions */
int atoi(char const *);
char *getenv(char const *);
unsigned get_env(const char *name, unsigned default_value) {
  const char *e = getenv(name);
  return e ? atoi(e) : default_value;
}


x86 assembly (clang, -O0):
<get_env>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1158 <get_env+0x38>
mov    -0x18(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    115e <get_env+0x3e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_env>:
push   %rbx
mov    %esi,%ebx
call   1030 <getenv@plt>
test   %rax,%rax
je     1136 <get_env+0x16>
mov    %rax,%rdi
pop    %rbx
jmp    1040 <atoi@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_env(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = call i8* @getenv(i8* %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = call i32 @atoi(i8* %11)
br label %15
13: ; preds = %2
%14 = load i32, i32* %4
br label %15
15: ; preds = %13, %10
%16 = phi i32 [ %12, %10 ], [ %14, %13 ]
ret i32 %16
}

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