xunge/DecIR huggingface dataset:
unsigned long get32bit(unsigned char *b) {
  return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3];
}


x86 assembly (clang, -O0):
<get32bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
or     %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<get32bit>:
movzbl (%rdi),%eax
shl    $0x18,%eax
movzbl 0x1(%rdi),%ecx
shl    $0x10,%rcx
cltq
or     %rcx,%rax
movzbl 0x2(%rdi),%ecx
shl    $0x8,%rcx
or     %rax,%rcx
movzbl 0x3(%rdi),%eax
or     %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @get32bit(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw i32 %3, 24
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 16
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 8
%14 = or i32 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = or i32 %14, %17
%19 = sext i32 %18 to i64
ret i64 %19
}
void gtk_target_list_add_table() {}


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

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

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

LLVM IR (-O2):
define void @gtk_target_list_add_table() {
ret void
}
void InterpolateRow_Any_SSSE3() {}


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

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

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

LLVM IR (-O2):
define void @InterpolateRow_Any_SSSE3() {
ret void
}
void message_handler_req_lib_amf_pmstart(void *conn, void *msg) {}


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

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

LLVM IR (-O0):
define void @message_handler_req_lib_amf_pmstart(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @message_handler_req_lib_amf_pmstart(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
void foo6(intptr_t i1, intptr_t i2, intptr_t i3, intptr_t i4, intptr_t i5,
          intptr_t i6) {}


x86 assembly (clang, -O0):
<foo6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @foo6(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
store i64 %0, i64* %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i64 %4, i64* %11
store i64 %5, i64* %12
ret void
}

LLVM IR (-O2):
define void @foo6(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
int printll(char *s) {
  while (*s != '\n' && *s != ',' && *s != '\t') {
    putchar(*s++);
  }
  return 0;
}


x86 assembly (clang, -O0):
<printll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x9(%rbp)
je     1156 <printll+0x46>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2c,%ecx
mov    %al,-0x9(%rbp)
je     1156 <printll+0x46>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1166 <printll+0x56>
jmp    1182 <printll+0x72>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    111c <printll+0xc>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printll>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movabs $0x100000000600,%r14
jmp    113c <printll+0x2c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
add    $0x1,%rbx
call   1030 <putchar@plt>
movzbl (%rbx),%eax
cmp    $0x2c,%rax
ja     1130 <printll+0x20>
bt     %rax,%r14
jae    1130 <printll+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @printll(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %7, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 10, label %9
i8 44, label %9
i8 9, label %9
]
5: ; preds = %2
%6 = sext i8 %4 to i32
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = tail call i32 @putchar(i32 %6)
br label %2
9: ; preds = %2, %2, %2
ret i32 0
}
/* Variables and functions */
scalar_t__ EOF;
scalar_t__ getchar();
int /*<<< orphan*/ printf(char *, long);
int main() {
  long nc;
  nc = 0;
  while (getchar() != EOF)
    ++nc;
  printf("%ld\n", nc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%rax
je     115f <main+0x3f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1137 <main+0x17>
mov    -0x10(%rbp),%rsi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xffffffffffffffff,%rbx
mov    0x2eb6(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%rbx
cmp    (%r14),%rax
jne    1140 <main+0x20>
lea    0xea9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i64 0
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %2
br label %3
3: ; preds = %7, %0
%4 = call i64 (...) @getchar()
%5 = load i64, i64* @EOF
%6 = icmp ne i64 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i64, i64* %2
%9 = add nsw i64 %8, 1
store i64 %9, i64* %2
br label %3
10: ; preds = %3
%11 = load i64, i64* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %11)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i64 0
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %6, %1 ]
%3 = tail call i64 (...) @getchar()
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
%6 = add nuw nsw i64 %2, 1
br i1 %5, label %7, label %1
7: ; preds = %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %2)
ret i32 0
}
void func3(int var1, int var2) { var1 = var2 > 0 ? var1 : var2; }


x86 assembly (clang, -O0):
<func3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    111f <func3+0x1f>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <func3+0x25>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @func3(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 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i32, i32* %3
br label %11
9: ; preds = %2
%10 = load i32, i32* %4
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ %8, %7 ], [ %10, %9 ]
store i32 %12, i32* %3
ret void
}

LLVM IR (-O2):
define void @func3(i32 %0, i32 %1) {
ret void
}
void outofmemory(where) char *where;
{
  show_who("out of memory in ");
  fatal(where);
}


x86 assembly (clang, -O0):
<outofmemory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <show_who@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <fatal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outofmemory>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <show_who@plt>
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <fatal@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"out of memory in \00"
define void @outofmemory(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @show_who to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"out of memory in \00"
define void @outofmemory(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @show_who to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* %0)
ret void
}
/* Variables and functions */
int aux();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("var %d \n", aux());
  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)
mov    $0x0,%al
call   1040 <aux@plt>
mov    %eax,%esi
lea    0xeba(%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 <aux@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"var %d \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 (...) @aux()
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"var %d \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @aux()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
double __fabs(double x) { return __builtin_fabs(x); }


x86 assembly (clang, -O0):
<__fabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xeeb(%rip),%xmm1
pand   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fabs>:
andps  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define double @__fabs(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.fabs.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @__fabs(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
ret double %2
}
/* Type definitions */
typedef int uint8_t;
struct scsi_cmd {
  int dummy;
};

/* Variables and functions */
uint8_t spc_send_diagnostics(struct scsi_cmd *cmd) {
  ;
  return 0x00;
}


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

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

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

LLVM IR (-O2):
%struct.scsi_cmd = type { i32 }
define i32 @spc_send_diagnostics(%struct.scsi_cmd* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int k;
  scanf("%d", &k);
  printf("%d\n", k * 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
shl    $0x1,%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
add    %esi,%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = shl nsw i32 %4, 1
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcmp(char *, char *, int);
int exarg_check_help_argument(char *argument) {
  if (!memcmp(argument, "help", 4) || !memcmp(argument, "?", 1))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<exarg_check_help_argument>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
je     1158 <exarg_check_help_argument+0x48>
mov    -0x10(%rbp),%rdi
lea    0xec0(%rip),%rsi
mov    $0x1,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
jne    1164 <exarg_check_help_argument+0x54>
movl   $0x1,-0x4(%rbp)
jmp    116b <exarg_check_help_argument+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exarg_check_help_argument>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
test   %eax,%eax
je     1148 <exarg_check_help_argument+0x38>
lea    0xed5(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <memcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"help\00"
@.str.1 = [2 x i8] c"?\00"
define i32 @exarg_check_help_argument(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @memcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @memcmp(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7, %1
store i32 1, i32* %2
br label %13
12: ; preds = %7
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [5 x i8] c"help\00"
@.str.1 = [2 x i8] c"?\00"
define i32 @exarg_check_help_argument(i8* %0) {
%2 = tail call i32 @memcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @memcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
void __gnat_disable_sigpipe(int fd) {}


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

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

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

LLVM IR (-O2):
define void @__gnat_disable_sigpipe(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void freebytes(void *fatso, size_t nbytes) {
  if (nbytes == 0)
    nbytes = 1;
  free(fatso);
}


x86 assembly (clang, -O0):
<freebytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <freebytes+0x23>
movq   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @freebytes(i8* nocapture %0, i64 %1) {
%3 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int c, n1;
  n1 = 0;
  while ((c = getchar()) != EOF)
    if (c == '\n')
      ++n1;
  printf("%d\n", n1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     1167 <main+0x47>
cmpl   $0xa,-0x8(%rbp)
jne    1162 <main+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
mov    -0xc(%rbp),%esi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb4(%rip),%r14
cmp    (%r14),%eax
je     1156 <main+0x36>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
jne    1140 <main+0x20>
lea    0xea3(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %13, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %10, %4 ], [ %1, %0 ]
%6 = phi i32 [ %9, %4 ], [ 0, %0 ]
%7 = icmp eq i32 %5, 10
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %6, %8
%10 = tail call i32 (...) @getchar()
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %4
13: ; preds = %4, %0
%14 = phi i32 [ 0, %0 ], [ %9, %4 ]
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}
/* Variables and functions */
int midbcol(int, int);
int midbar(int i, int c) {
  int k;
  k = midbcol(i, c);
  if (k == 0 && c > 0)
    k = midbcol(i, c - 1);
  return (k);
}


x86 assembly (clang, -O0):
<midbar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <midbcol@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1151 <midbar+0x41>
cmpl   $0x0,-0x8(%rbp)
jle    1151 <midbar+0x41>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1030 <midbcol@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<midbar>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <midbcol@plt>
test   %ebx,%ebx
jle    1136 <midbar+0x26>
test   %eax,%eax
jne    1136 <midbar+0x26>
add    $0xffffffff,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <midbcol@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @midbar(i32 %0, i32 %1) {
%3 = tail call i32 @midbcol(i32 %0, i32 %1)
%4 = icmp eq i32 %3, 0
%5 = icmp sgt i32 %1, 0
%6 = and i1 %5, %4
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = add nsw i32 %1, -1
%9 = tail call i32 @midbcol(i32 %0, i32 %8)
br label %10
10: ; preds = %7, %2
%11 = phi i32 [ %9, %7 ], [ %3, %2 ]
ret i32 %11
}
/* Variables and functions */
char *calloc(size_t, int);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *strncpyx(const char *src, size_t n) {
  if (src == NULL) {
    return NULL;
  }
  char *dest = calloc(n, sizeof(char));
  if (dest != NULL) {
    strncpy(dest, src, n);
  }
  return dest;
}


x86 assembly (clang, -O0):
<strncpyx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1148 <strncpyx+0x28>
movq   $0x0,-0x8(%rbp)
jmp    117e <strncpyx+0x5e>
mov    -0x18(%rbp),%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1176 <strncpyx+0x56>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpyx>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1155 <strncpyx+0x35>
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
test   %rax,%rax
je     1155 <strncpyx+0x35>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <strncpy@plt>
jmp    1157 <strncpyx+0x37>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @strncpyx(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = tail call i8* @calloc(i64 %1, i32 1)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @strncpy(i8* %5, i8* %0, i64 %1)
br label %9
9: ; preds = %4, %7, %2
%10 = phi i8* [ null, %2 ], [ %5, %7 ], [ null, %4 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ __you_should_not_call_printf_from_debugger_sw();
int printf(const char *fmt, ...) {
  __you_should_not_call_printf_from_debugger_sw();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @printf(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @__you_should_not_call_printf_from_debugger_sw()
ret i32 0
}

LLVM IR (-O2):
define i32 @printf(i8* nocapture readnone %0, ...) {
%2 = tail call i32 (...) @__you_should_not_call_printf_from_debugger_sw()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EX_SOFTWARE;
int /*<<< orphan*/ pfpanic(char *, unsigned short, unsigned short, char const *,
                           char const *, int, int, int /*<<< orphan*/);
void __pfpanic_zmq_send(unsigned short _syslog, unsigned short _verbose,
                        const char *_function_name, const char *_file_name,
                        int _line_number, int _errno) {
  pfpanic("Unable to send to ZeroMQ socket", _syslog, _verbose, _function_name,
          _file_name, _line_number, _errno, EX_SOFTWARE);
}


x86 assembly (clang, -O0):
<__pfpanic_zmq_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %si,%ax
mov    %di,%si
mov    %si,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x2(%rbp),%si
mov    -0x4(%rbp),%dx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
mov    -0x20(%rbp),%r10d
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
lea    0xea2(%rip),%rdi
movzwl %si,%esi
movzwl %dx,%edx
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <pfpanic@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__pfpanic_zmq_send>:
push   %rax
mov    %r9d,%r10d
mov    %r8d,%r9d
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %esi,%edx
mov    %edi,%esi
mov    0x2eb8(%rip),%rdi
mov    (%rdi),%eax
lea    0xecf(%rip),%rdi
push   %rax
push   %r10
call   1030 <pfpanic@plt>
add    $0x10,%rsp
pop    %rax
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Unable to send to ZeroMQ socket\00"
@EX_SOFTWARE = global i32 0
define void @__pfpanic_zmq_send(i16 zeroext %0, i16 zeroext %1, i8* %2, i8* %3, i32 %4, i32 %5) {
%7 = alloca i16
%8 = alloca i16
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
store i16 %0, i16* %7
store i16 %1, i16* %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i16, i16* %7
%14 = load i16, i16* %8
%15 = load i8*, i8** %9
%16 = load i8*, i8** %10
%17 = load i32, i32* %11
%18 = load i32, i32* %12
%19 = load i32, i32* @EX_SOFTWARE
%20 = call i32 @pfpanic(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i16 zeroext %13, i16 zeroext %14, i8* %15, i8* %16, i32 %17, i32 %18, i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Unable to send to ZeroMQ socket\00"
@EX_SOFTWARE = global i32 0
define void @__pfpanic_zmq_send(i16 zeroext %0, i16 zeroext %1, i8* %2, i8* %3, i32 %4, i32 %5) {
%7 = load i32, i32* @EX_SOFTWARE
%8 = tail call i32 @pfpanic(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i16 zeroext %0, i16 zeroext %1, i8* %2, i8* %3, i32 %4, i32 %5, i32 %7)
ret void
}
eq(a, b) {
  static int i = 0;
  if (a != i)
    abort();
  i++;
}


x86 assembly (clang, -O0):
<eq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    0x2f05(%rip),%eax
je     1132 <eq+0x22>
call   1030 <abort@plt>
mov    0x2ef4(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eeb(%rip)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eq>:
push   %rax
cmp    %edi,0x2f15(%rip)
jne    1124 <eq+0x14>
add    $0x1,%edi
mov    %edi,0x2f0a(%rip)
pop    %rcx
ret
call   1030 <abort@plt>

LLVM IR (-O0):
@eq.i = internal global i32 0
define i32 @eq(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* @eq.i
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %10
9: ; preds = %2
unreachable
10: ; preds = %2
%11 = load i32, i32* @eq.i
%12 = add nsw i32 %11, 1
store i32 %12, i32* @eq.i
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@eq.i = internal unnamed_addr global i32 0
define i32 @eq(i32 %0, i32 %1) {
%3 = load i32, i32* @eq.i
%4 = icmp eq i32 %3, %0
br i1 %4, label %6, label %5
5: ; preds = %2
tail call void @abort()
unreachable
6: ; preds = %2
%7 = add nsw i32 %0, 1
store i32 %7, i32* @eq.i
ret i32 undef
}
int test_imm_8Euint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x8E << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_8Euint64_lowword_reg>:
test   $0x8e,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_8Euint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 142
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void _M2_elc_finish(__attribute__((unused)) int argc,
                    __attribute__((unused)) char *argv[]) {}


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

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

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

LLVM IR (-O2):
define void @_M2_elc_finish(i32 %0, i8** nocapture %1) {
ret void
}
int close_storage(struct storage_backend *store) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.storage_backend = type opaque
define i32 @close_storage(%struct.storage_backend* nocapture readnone %0) {
ret i32 0
}
int goo(void) { return 10; }


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

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

LLVM IR (-O0):
define i32 @goo() {
ret i32 10
}

LLVM IR (-O2):
define i32 @goo() {
ret i32 10
}
signed int get_sign(const char **buf) {
  signed int sign = 1;
  if ((**buf) == '-') {
    (*buf)++;
    sign = -1;
  }
  return sign;
}


x86 assembly (clang, -O0):
<get_sign>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1137 <get_sign+0x37>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
movl   $0xffffffff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_sign>:
mov    (%rdi),%rcx
mov    $0x1,%eax
cmpb   $0x2d,(%rcx)
jne    1119 <get_sign+0x19>
add    $0x1,%rcx
mov    %rcx,(%rdi)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @get_sign(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
store i32 1, i32* %3
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 45
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i8**, i8*** %2
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %10
store i32 -1, i32* %3
br label %13
13: ; preds = %9, %1
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @get_sign(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 45
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %2, i64 1
store i8* %6, i8** %0
br label %7
7: ; preds = %5, %1
%8 = phi i32 [ -1, %5 ], [ 1, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ closeMainSocket();
void httpShutdown(void) { closeMainSocket(); }


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

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

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

LLVM IR (-O2):
define void @httpShutdown() {
%1 = tail call i32 (...) @closeMainSocket()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
int strlen(char const *);
int copypath(char *to, char const *from) {
  int n;
  n = strlen(from);
  if (n > 1023)
    return 0;
  memcpy(to, from, n + 1);
  return 1;
}


x86 assembly (clang, -O0):
<copypath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x3ff,-0x1c(%rbp)
jle    1155 <copypath+0x35>
movl   $0x0,-0x4(%rbp)
jmp    116f <copypath+0x4f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
call   1040 <memcpy@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copypath>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
xor    %ecx,%ecx
cmp    $0x3ff,%eax
jg     1150 <copypath+0x30>
add    $0x1,%eax
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <memcpy@plt>
mov    $0x1,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @copypath(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = icmp sgt i32 %3, 1023
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = add nsw i32 %3, 1
%7 = tail call i32 @memcpy(i8* %0, i8* %1, i32 %6)
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ 1, %5 ], [ 0, %2 ]
ret i32 %9
}
/* Variables and functions */
int O_CREAT;
int O_EXCL;
int O_RDWR;
int /*<<< orphan*/ *_mktemp(char *, int, int *, int);
int mkstemps(char *template, int suffixlen) {
  int fd = -1;
  if (_mktemp(template, suffixlen, &fd, O_RDWR | O_EXCL | O_CREAT) == NULL)
    return -1;
  return fd;
}


x86 assembly (clang, -O0):
<mkstemps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0xffffffff,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    0x2eac(%rip),%rax
mov    (%rax),%ecx
mov    0x2e93(%rip),%rax
or     (%rax),%ecx
mov    0x2eb2(%rip),%rax
or     (%rax),%ecx
lea    -0x18(%rbp),%rdx
call   1030 <_mktemp@plt>
cmp    $0x0,%rax
jne    1167 <mkstemps+0x57>
movl   $0xffffffff,-0x4(%rbp)
jmp    116d <mkstemps+0x5d>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkstemps>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    0x2eb1(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
movl   $0xffffffff,0x4(%rsp)
ff
mov    0x2ec6(%rip),%rax
or     (%rax),%ecx
lea    0x4(%rsp),%rdx
call   1030 <_mktemp@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
or     0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@O_RDWR = global i32 0
@O_EXCL = global i32 0
@O_CREAT = global i32 0
define i32 @mkstemps(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 -1, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* @O_RDWR
%10 = load i32, i32* @O_EXCL
%11 = or i32 %9, %10
%12 = load i32, i32* @O_CREAT
%13 = or i32 %11, %12
%14 = call i32* @_mktemp(i8* %7, i32 %8, i32* %6, i32 %13)
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 -1, i32* %3
br label %19
17: ; preds = %2
%18 = load i32, i32* %6
store i32 %18, i32* %3
br label %19
19: ; preds = %17, %16
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@O_RDWR = global i32 0
@O_EXCL = global i32 0
@O_CREAT = global i32 0
define i32 @mkstemps(i8* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 -1, i32* %3
%5 = load i32, i32* @O_RDWR
%6 = load i32, i32* @O_EXCL
%7 = or i32 %6, %5
%8 = load i32, i32* @O_CREAT
%9 = or i32 %7, %8
%10 = call i32* @_mktemp(i8* %0, i32 %1, i32* %3, i32 %9)
%11 = icmp eq i32* %10, null
%12 = load i32, i32* %3
%13 = select i1 %11, i32 -1, i32 %12
ret i32 %13
}
__attribute((always_)) void f() {}


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

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

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

LLVM IR (-O2):
define void @f() {
ret void
}
int main() {
  int a, b;
  switch (1) {
  case 0:
    return 3;
  case 2:
    a = 2;
    return 4;
  case 1:
    a = 4;
    b = 9;
    return 5;
  default:
    a = 3;
    b = 5;
    return 6;
  }
  return 7;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
movl   $0x9,-0xc(%rbp)
mov    $0x5,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 5
}
/* Variables and functions */
int /*<<< orphan*/ log_printf(int /*<<< orphan*/, char *);
char *tag_end(int argc, char *argv[]) {
  log_printf(0, "you use <!end> outside a <!function>\n");
  return 0;
}


x86 assembly (clang, -O0):
<tag_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
lea    0xed8(%rip),%rsi
call   1030 <log_printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tag_end>:
push   %rax
lea    0xee8(%rip),%rsi
xor    %edi,%edi
call   1030 <log_printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"you use <!end> outside a <!function>\0A\00"
define i8* @tag_end(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @log_printf(i32 0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@.str = [38 x i8] c"you use <!end> outside a <!function>\0A\00"
define noalias i8* @tag_end(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @log_printf(i32 0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0xca() {
  Assert_real((isdigit(202) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              1015, ("isdigit should be 0 for 0xca"));
}


x86 assembly (clang, -O0):
<t_isdigit_0xca>:
push   %rbp
mov    %rsp,%rbp
mov    $0xca,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x3f7,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0xca>:
push   %rax
mov    $0xca,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x3f7,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0xca\00"
define void @t_isdigit_0xca() {
%1 = call i64 @isdigit(i32 202)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1015, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0xca\00"
define void @t_isdigit_0xca() {
%1 = tail call i64 @isdigit(i32 202)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1015, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
sunday(at, ad) int *at;
{
  register int *t, d;
  t = at;
  d = ad;
  if (d >= 58)
    d = +dysize(t[5]) - 365;
  return (d - (d - t[7] + t[6] + 700) % 7);
}


x86 assembly (clang, -O0):
<sunday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x3a,-0x1c(%rbp)
jl     114d <sunday+0x3d>
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%edi
mov    $0x0,%al
call   1030 <dysize@plt>
sub    $0x16d,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
sub    0x1c(%rcx),%eax
mov    -0x18(%rbp),%rcx
add    0x18(%rcx),%eax
add    $0x2bc,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%eax
sub    %edx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sunday>:
push   %rbx
mov    %rdi,%rbx
cmp    $0x3a,%esi
jl     112b <sunday+0x1b>
mov    0x14(%rbx),%edi
xor    %eax,%eax
call   1030 <dysize@plt>
mov    %eax,%esi
add    $0xfffffe93,%esi
mov    0x18(%rbx),%eax
mov    %esi,%ecx
sub    0x1c(%rbx),%ecx
lea    (%rax,%rcx,1),%edx
add    $0x2bc,%edx
add    %eax,%ecx
movslq %edx,%rdx
imul   $0xffffffff92492493,%rdx,%rax
shr    $0x20,%rax
add    %eax,%ecx
add    $0x2bc,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0x2,%ecx
add    %eax,%ecx
lea    0x0(,%rcx,8),%eax
sub    %ecx,%eax
sub    %edx,%eax
add    %esi,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sunday(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32*, i32** %3
store i32* %7, i32** %5
%8 = load i32, i32* %4
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp sge i32 %9, 58
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32*, i32** %5
%13 = getelementptr inbounds i32, i32* %12, i64 5
%14 = load i32, i32* %13
%15 = call i32 (i32, ...) bitcast (i32 (...)* @dysize to i32 (i32, ...)*)(i32 %14)
%16 = sub nsw i32 %15, 365
store i32 %16, i32* %6
br label %17
17: ; preds = %11, %2
%18 = load i32, i32* %6
%19 = load i32, i32* %6
%20 = load i32*, i32** %5
%21 = getelementptr inbounds i32, i32* %20, i64 7
%22 = load i32, i32* %21
%23 = sub nsw i32 %19, %22
%24 = load i32*, i32** %5
%25 = getelementptr inbounds i32, i32* %24, i64 6
%26 = load i32, i32* %25
%27 = add nsw i32 %23, %26
%28 = add nsw i32 %27, 700
%29 = srem i32 %28, 7
%30 = sub nsw i32 %18, %29
ret i32 %30
}

LLVM IR (-O2):
define i32 @sunday(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 57
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i32, i32* %0, i64 5
%6 = load i32, i32* %5
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @dysize to i32 (i32, ...)*)(i32 %6)
%8 = add nsw i32 %7, -365
br label %9
9: ; preds = %4, %2
%10 = phi i32 [ %8, %4 ], [ %1, %2 ]
%11 = getelementptr inbounds i32, i32* %0, i64 7
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %0, i64 6
%14 = load i32, i32* %13
%15 = add i32 %10, 700
%16 = sub i32 %15, %12
%17 = add i32 %16, %14
%18 = srem i32 %17, 7
%19 = sub nsw i32 %10, %18
ret i32 %19
}
/* Type definitions */
struct _stor_fopen_req {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ osapi_free(struct _stor_fopen_req *);
void stor_fopen_req_free(struct _stor_fopen_req *ptr) { osapi_free(ptr); }


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

x86 assembly (clang, -O2):
<stor_fopen_req_free>:
jmp    1030 <osapi_free@plt>

LLVM IR (-O0):
%struct._stor_fopen_req = type { i32 }
define void @stor_fopen_req_free(%struct._stor_fopen_req* %0) {
%2 = alloca %struct._stor_fopen_req*
store %struct._stor_fopen_req* %0, %struct._stor_fopen_req** %2
%3 = load %struct._stor_fopen_req*, %struct._stor_fopen_req** %2
%4 = call i32 @osapi_free(%struct._stor_fopen_req* %3)
ret void
}

LLVM IR (-O2):
%struct._stor_fopen_req = type { i32 }
define void @stor_fopen_req_free(%struct._stor_fopen_req* %0) {
%2 = tail call i32 @osapi_free(%struct._stor_fopen_req* %0)
ret void
}