xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool errata_98(void) {
  if (*(uint32_t *)0x10000130ul == 0x8ul) {
    if (*(uint32_t *)0x10000134ul == 0x0ul) {
      return true;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<errata_98>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10000130,%eax
movslq (%rax),%rax
cmp    $0x8,%rax
jne    1139 <errata_98+0x39>
mov    $0x10000134,%eax
movslq (%rax),%rax
cmp    $0x0,%rax
jne    1134 <errata_98+0x34>
movl   $0x1,-0x4(%rbp)
jmp    1140 <errata_98+0x40>
jmp    1139 <errata_98+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<errata_98>:
cmpl   $0x8,0x10000130
08
jne    1114 <errata_98+0x14>
cmpl   $0x0,0x10000134
je     1117 <errata_98+0x17>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @errata_98() {
%1 = alloca i32
%2 = load i32, i32* inttoptr (i64 268435760 to i32*)
%3 = sext i32 %2 to i64
%4 = icmp eq i64 %3, 8
br i1 %4, label %5, label %11
5: ; preds = %0
%6 = load i32, i32* inttoptr (i64 268435764 to i32*)
%7 = sext i32 %6 to i64
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
store i32 1, i32* %1
br label %12
10: ; preds = %5
br label %11
11: ; preds = %10, %0
store i32 0, i32* %1
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
define i32 @errata_98() {
%1 = load i32, i32* inttoptr (i64 268435760 to i32*)
%2 = icmp eq i32 %1, 8
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = load i32, i32* inttoptr (i64 268435764 to i32*)
%5 = icmp eq i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %3, %0
br label %7
7: ; preds = %3, %6
%8 = phi i32 [ 0, %6 ], [ 1, %3 ]
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(void const *, unsigned int, unsigned int,
                          int /*<<< orphan*/ *);
void write_entry(const void *data, unsigned int size, unsigned int count,
                 FILE *ofs, unsigned long long *pos) {
  fwrite(data, size, count, ofs);
  *pos += count * size;
}


x86 assembly (clang, -O0):
<write_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <fwrite@plt>
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_entry>:
push   %rbp
push   %r14
push   %rbx
mov    %r8,%r14
mov    %edx,%ebx
mov    %esi,%ebp
call   1030 <fwrite@plt>
imul   %ebp,%ebx
add    %rbx,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @write_entry(i8* %0, i32 %1, i32 %2, i32* %3, i64* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i64*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i64* %4, i64** %10
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32*, i32** %9
%15 = call i32 @fwrite(i8* %11, i32 %12, i32 %13, i32* %14)
%16 = load i32, i32* %8
%17 = load i32, i32* %7
%18 = mul i32 %16, %17
%19 = zext i32 %18 to i64
%20 = load i64*, i64** %10
%21 = load i64, i64* %20
%22 = add i64 %21, %19
store i64 %22, i64* %20
ret void
}

LLVM IR (-O2):
define void @write_entry(i8* nocapture %0, i32 %1, i32 %2, i32* nocapture %3, i64* nocapture %4) {
%6 = tail call i32 @fwrite(i8* %0, i32 %1, i32 %2, i32* %3)
%7 = mul i32 %2, %1
%8 = zext i32 %7 to i64
%9 = load i64, i64* %4
%10 = add i64 %9, %8
store i64 %10, i64* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void help_create_service() {
  puts("create-service [<service name>]\n"
       "Appends to "
       "services.srv"
       " binary file the name and cost of\n"
       "services available. Prompts for name if not provided as parameter,\n"
       "and for cost.");
}


x86 assembly (clang, -O0):
<help_create_service>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [170 x i8] c"create-service [<service name>]\0AAppends to services.srv binary file the name and cost of\0Aservices available. Prompts for name if not provided as parameter,\0Aand for cost.\00"
define void @help_create_service() {
%1 = call i32 @puts(i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [170 x i8] c"create-service [<service name>]\0AAppends to services.srv binary file the name and cost of\0Aservices available. Prompts for name if not provided as parameter,\0Aand for cost.\00"
define void @help_create_service() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([170 x i8], [170 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
scalar_t__ lock();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ unlock();
int main(int argc, char **argv) {
  if (lock() != 0) {
    return 1;
  }
  printf("Waiting for keypress\n");
  getchar();
  unlock();
  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 <lock@plt>
cmp    $0x0,%rax
je     1173 <main+0x33>
movl   $0x1,-0x4(%rbp)
jmp    1194 <main+0x54>
lea    0xe86(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    $0x0,%al
call   1030 <unlock@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <lock@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1157 <main+0x17>
pop    %rcx
ret
lea    0xea2(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %eax,%eax
call   1030 <unlock@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Waiting for keypress\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 i64 (...) @lock()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 1, i32* %3
br label %13
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @getchar()
%12 = call i32 (...) @unlock()
store i32 0, i32* %3
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@str = [21 x i8] c"Waiting for keypress\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @lock()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 (...) @getchar()
%8 = tail call i32 (...) @unlock()
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ 0, %5 ], [ 1, %2 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void errExit(char *msg) {
  printf("%s\n", msg);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<errExit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @errExit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define void @errExit(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
int f(int x) { return x * 7 == 17; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0x7,-0x4(%rbp),%eax
cmp    $0x11,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 7
%5 = icmp eq i32 %4, 17
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ __u_char;

/* Variables and functions */
int cbmarch_parallel_burst_write_track(int, int /*<<< orphan*/ *, unsigned int);
int cbm_parallel_burst_write_track(int HandleDevice, __u_char *Buffer,
                                   unsigned int Length) {
  ;
  return cbmarch_parallel_burst_write_track(HandleDevice, Buffer, Length);
}


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

x86 assembly (clang, -O2):
<cbm_parallel_burst_write_track>:
jmp    1030 <cbmarch_parallel_burst_write_track@plt>

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

LLVM IR (-O2):
define i32 @cbm_parallel_burst_write_track(i32 %0, i32* %1, i32 %2) {
%4 = tail call i32 @cbmarch_parallel_burst_write_track(i32 %0, i32* %1, i32 %2)
ret i32 %4
}
void MSP430TimerM$CompareB6$fired(void) {
  MSP430TimerM$CompareB6$default$fired();
}


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

x86 assembly (clang, -O2):
<MSP430TimerM$CompareB6$fired>:
xor    %eax,%eax
jmp    1030 <MSP430TimerM$CompareB6$default$fired@plt>

LLVM IR (-O0):
define void @"MSP430TimerM$CompareB6$fired"() {
%1 = call i32 (...) @"MSP430TimerM$CompareB6$default$fired"()
ret void
}

LLVM IR (-O2):
define void @"MSP430TimerM$CompareB6$fired"() {
%1 = tail call i32 (...) @"MSP430TimerM$CompareB6$default$fired"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write_command_packet_buf(unsigned char, unsigned char, int,
                                            int, int /*<<< orphan*/ *,
                                            int /*<<< orphan*/);
void write_command_packet(unsigned char one, unsigned char two, int uwait,
                          int nread) {
  write_command_packet_buf(one, two, uwait, nread, NULL, 0);
}


x86 assembly (clang, -O0):
<write_command_packet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %edx,-0x8(%rbp)
mov    %ecx,-0xc(%rbp)
mov    -0x1(%rbp),%sil
mov    -0x2(%rbp),%al
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
xor    %edi,%edi
mov    %edi,%r8d
xor    %r9d,%r9d
movzbl %sil,%edi
movzbl %al,%esi
call   1030 <write_command_packet_buf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_command_packet>:
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <write_command_packet_buf@plt>

LLVM IR (-O0):
define void @write_command_packet(i8 zeroext %0, i8 zeroext %1, i32 %2, i32 %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
store i8 %0, i8* %5
store i8 %1, i8* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8, i8* %5
%10 = load i8, i8* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @write_command_packet_buf(i8 zeroext %9, i8 zeroext %10, i32 %11, i32 %12, i32* null, i32 0)
ret void
}

LLVM IR (-O2):
define void @write_command_packet(i8 zeroext %0, i8 zeroext %1, i32 %2, i32 %3) {
%5 = tail call i32 @write_command_packet_buf(i8 zeroext %0, i8 zeroext %1, i32 %2, i32 %3, i32* null, i32 0)
ret void
}
void av_packet_add_side_data() {}


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

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

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

LLVM IR (-O2):
define void @av_packet_add_side_data() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GL_LINE_LOOP;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex2f(double, double);
void draw_triangle(void) {
  glBegin(GL_LINE_LOOP);
  glVertex2f(0.0, 25.0);
  glVertex2f(25.0, -25.0);
  glVertex2f(-25.0, -25.0);
  glEnd();
}


x86 assembly (clang, -O0):
<draw_triangle>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
call   1050 <glBegin@plt>
xorps  %xmm0,%xmm0
movsd  0xebb(%rip),%xmm1
call   1040 <glVertex2f@plt>
movsd  0xeae(%rip),%xmm0
movsd  0xe9e(%rip),%xmm1
call   1040 <glVertex2f@plt>
movsd  0xe91(%rip),%xmm1
movaps %xmm1,%xmm0
call   1040 <glVertex2f@plt>
mov    $0x0,%al
call   1030 <glEnd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_triangle>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
call   1050 <glBegin@plt>
movsd  0xeb9(%rip),%xmm1
xorps  %xmm0,%xmm0
call   1040 <glVertex2f@plt>
movsd  0xeb1(%rip),%xmm1
movsd  0xea1(%rip),%xmm0
call   1040 <glVertex2f@plt>
movsd  0xe9c(%rip),%xmm0
movaps %xmm0,%xmm1
call   1040 <glVertex2f@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <glEnd@plt>

LLVM IR (-O0):
@GL_LINE_LOOP = global i32 0
define void @draw_triangle() {
%1 = load i32, i32* @GL_LINE_LOOP
%2 = call i32 @glBegin(i32 %1)
%3 = call i32 @glVertex2f(double 0.000000e+00, double 2.500000e+01)
%4 = call i32 @glVertex2f(double 2.500000e+01, double -2.500000e+01)
%5 = call i32 @glVertex2f(double -2.500000e+01, double -2.500000e+01)
%6 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_LINE_LOOP = global i32 0
define void @draw_triangle() {
%1 = load i32, i32* @GL_LINE_LOOP
%2 = tail call i32 @glBegin(i32 %1)
%3 = tail call i32 @glVertex2f(double 0.000000e+00, double 2.500000e+01)
%4 = tail call i32 @glVertex2f(double 2.500000e+01, double -2.500000e+01)
%5 = tail call i32 @glVertex2f(double -2.500000e+01, double -2.500000e+01)
%6 = tail call i32 (...) @glEnd()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void check(int a) {
  if (a != 1)
    abort();
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
je     112c <check+0x1c>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
cmp    $0x1,%edi
jne    1116 <check+0x6>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @check(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @check(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write_word(int, int, int);
void lights_out(int fd) {
  write_word(fd, 0x2c, 0x3fff);
  write_word(fd, 0x2e, 0x0001);
  write_word(fd, 0x30, 0x3fff);
  write_word(fd, 0x32, 0x0001);
  write_word(fd, 0x34, 0x3fff);
  write_word(fd, 0x36, 0x0001);
}


x86 assembly (clang, -O0):
<lights_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2c,%esi
mov    $0x3fff,%edx
call   1030 <write_word@plt>
mov    -0x4(%rbp),%edi
mov    $0x2e,%esi
mov    $0x1,%edx
call   1030 <write_word@plt>
mov    -0x4(%rbp),%edi
mov    $0x30,%esi
mov    $0x3fff,%edx
call   1030 <write_word@plt>
mov    -0x4(%rbp),%edi
mov    $0x32,%esi
mov    $0x1,%edx
call   1030 <write_word@plt>
mov    -0x4(%rbp),%edi
mov    $0x34,%esi
mov    $0x3fff,%edx
call   1030 <write_word@plt>
mov    -0x4(%rbp),%edi
mov    $0x36,%esi
mov    $0x1,%edx
call   1030 <write_word@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lights_out>:
push   %rbx
mov    %edi,%ebx
mov    $0x2c,%esi
mov    $0x3fff,%edx
call   1030 <write_word@plt>
mov    %ebx,%edi
mov    $0x2e,%esi
mov    $0x1,%edx
call   1030 <write_word@plt>
mov    %ebx,%edi
mov    $0x30,%esi
mov    $0x3fff,%edx
call   1030 <write_word@plt>
mov    %ebx,%edi
mov    $0x32,%esi
mov    $0x1,%edx
call   1030 <write_word@plt>
mov    %ebx,%edi
mov    $0x34,%esi
mov    $0x3fff,%edx
call   1030 <write_word@plt>
mov    %ebx,%edi
mov    $0x36,%esi
mov    $0x1,%edx
pop    %rbx
jmp    1030 <write_word@plt>

LLVM IR (-O0):
define void @lights_out(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @write_word(i32 %3, i32 44, i32 16383)
%5 = load i32, i32* %2
%6 = call i32 @write_word(i32 %5, i32 46, i32 1)
%7 = load i32, i32* %2
%8 = call i32 @write_word(i32 %7, i32 48, i32 16383)
%9 = load i32, i32* %2
%10 = call i32 @write_word(i32 %9, i32 50, i32 1)
%11 = load i32, i32* %2
%12 = call i32 @write_word(i32 %11, i32 52, i32 16383)
%13 = load i32, i32* %2
%14 = call i32 @write_word(i32 %13, i32 54, i32 1)
ret void
}

LLVM IR (-O2):
define void @lights_out(i32 %0) {
%2 = tail call i32 @write_word(i32 %0, i32 44, i32 16383)
%3 = tail call i32 @write_word(i32 %0, i32 46, i32 1)
%4 = tail call i32 @write_word(i32 %0, i32 48, i32 16383)
%5 = tail call i32 @write_word(i32 %0, i32 50, i32 1)
%6 = tail call i32 @write_word(i32 %0, i32 52, i32 16383)
%7 = tail call i32 @write_word(i32 %0, i32 54, i32 1)
ret void
}
const char *ls_cost_nm7_name_in(int i) {
  switch (i) {
  case 0:
    return "i0";
  case 1:
    return "i1";
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<ls_cost_nm7_name_in>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     112b <ls_cost_nm7_name_in+0x2b>
jmp    111a <ls_cost_nm7_name_in+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     113b <ls_cost_nm7_name_in+0x3b>
jmp    114b <ls_cost_nm7_name_in+0x4b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <ls_cost_nm7_name_in+0x53>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <ls_cost_nm7_name_in+0x53>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_cost_nm7_name_in>:
xor    %ecx,%ecx
cmp    $0x1,%edi
lea    0xef7(%rip),%rax
cmove  %rax,%rcx
test   %edi,%edi
lea    0xee7(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"i0\00"
@.str.1 = [3 x i8] c"i1\00"
define i8* @ls_cost_nm7_name_in(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 0, label %5
i32 1, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* null, i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"i0\00"
@.str.1 = [3 x i8] c"i1\00"
define i8* @ls_cost_nm7_name_in(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* null
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
int a(int x) { return x < 10; }


x86 assembly (clang, -O0):
<a>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<a>:
xor    %eax,%eax
cmp    $0xa,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @a(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 10
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @a(i32 %0) {
%2 = icmp slt i32 %0, 10
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int f50(int *);
int f51(int *p) { return f50(p); }


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

x86 assembly (clang, -O2):
<f51>:
jmp    1030 <f50@plt>

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

LLVM IR (-O2):
define i32 @f51(i32* %0) {
%2 = tail call i32 @f50(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int strlen2(char *);
int main(void) {
  printf("%d\n", strlen2("Daniel"));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [7 x i8] c"Daniel\00"
define i32 @main() {
%1 = tail call i32 @strlen2(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
int tgc_send(int sd, char cmd) {
  if (write(sd, &cmd, 1) < 1) {
    print_log_msg((3), __FUNCTION__, "Failed sending connection request");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<tgc_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <write@plt>
cmp    $0x1,%eax
jge    1173 <tgc_send+0x53>
mov    $0x3,%edi
lea    0xea7(%rip),%rsi
lea    0xea9(%rip),%rdx
mov    $0x0,%al
call   1040 <print_log_msg@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    117a <tgc_send+0x5a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tgc_send>:
push   %rbx
sub    $0x10,%rsp
mov    %sil,0xf(%rsp)
xor    %ebx,%ebx
lea    0xf(%rsp),%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <write@plt>
test   %eax,%eax
jg     1160 <tgc_send+0x40>
lea    0xeb8(%rip),%rsi
lea    0xeba(%rip),%rdx
mov    $0x3,%edi
xor    %eax,%eax
call   1040 <print_log_msg@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__FUNCTION__.tgc_send = [9 x i8] c"tgc_send\00"
@.str = [34 x i8] c"Failed sending connection request\00"
define i32 @tgc_send(i32 %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 %0, i32* %4
store i8 %1, i8* %5
%6 = load i32, i32* %4
%7 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %6, i8* %5, i32 1)
%8 = icmp slt i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @print_log_msg to i32 (i32, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__FUNCTION__.tgc_send, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %12
11: ; preds = %2
store i32 0, i32* %3
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@__FUNCTION__.tgc_send = [9 x i8] c"tgc_send\00"
@.str = [34 x i8] c"Failed sending connection request\00"
define i32 @tgc_send(i32 %0, i8 signext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %0, i8* %3, i32 1)
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @print_log_msg to i32 (i32, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__FUNCTION__.tgc_send, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ -1, %6 ], [ 0, %2 ]
ret i32 %9
}
int numeric(char *s) {
  char *n = s;
  while (((unsigned)((*n) - ('0')) <= (('9') - ('0'))))
    n++;
  return n != s && *n == 0;
}


x86 assembly (clang, -O0):
<numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
cmp    $0x9,%eax
ja     1134 <numeric+0x34>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <numeric+0x10>
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmp    -0x8(%rbp),%rcx
mov    %al,-0x11(%rbp)
je     1157 <numeric+0x57>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<numeric>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rdi,%rax,1),%ecx
lea    -0x30(%rcx),%edx
add    $0x1,%rax
cmp    $0xa,%edx
jb     1110 <numeric+0x10>
cmp    $0x1,%rax
setne  %al
test   %cl,%cl
sete   %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @numeric(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %8, %2 ]
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = add nsw i32 %5, -48
%7 = icmp ult i32 %6, 10
%8 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %7, label %2, label %9
9: ; preds = %2
%10 = icmp ne i8* %3, %0
%11 = icmp eq i8 %4, 0
%12 = select i1 %10, i1 %11, i1 false
%13 = zext i1 %12 to i32
ret i32 %13
}
int xdigit_to_int(int c) {
  return '0' <= c && c <= '9'   ? c - '0'
         : 'a' <= c && c <= 'f' ? c - 'a'
                                : c - 'A';
}


x86 assembly (clang, -O0):
<xdigit_to_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x30,%eax
cmp    -0x4(%rbp),%eax
jg     112d <xdigit_to_int+0x2d>
cmpl   $0x39,-0x4(%rbp)
jg     112d <xdigit_to_int+0x2d>
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
jmp    1162 <xdigit_to_int+0x62>
mov    $0x61,%eax
cmp    -0x4(%rbp),%eax
jg     1153 <xdigit_to_int+0x53>
cmpl   $0x66,-0x4(%rbp)
jg     1153 <xdigit_to_int+0x53>
mov    -0x4(%rbp),%eax
sub    $0x61,%eax
mov    %eax,-0xc(%rbp)
jmp    115c <xdigit_to_int+0x5c>
mov    -0x4(%rbp),%eax
sub    $0x41,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdigit_to_int>:
lea    -0x30(%rdi),%ecx
lea    -0x61(%rdi),%eax
xor    %edx,%edx
cmp    $0x6,%eax
setae  %dl
shl    $0x5,%edx
cmp    $0xa,%ecx
lea    -0x61(%rdx,%rdi,1),%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @xdigit_to_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 48, %3
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 57
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 48
br label %25
11: ; preds = %5, %1
%12 = load i32, i32* %2
%13 = icmp sle i32 97, %12
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i32, i32* %2
%16 = icmp sle i32 %15, 102
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %2
%19 = sub nsw i32 %18, 97
br label %23
20: ; preds = %14, %11
%21 = load i32, i32* %2
%22 = sub nsw i32 %21, 65
br label %23
23: ; preds = %20, %17
%24 = phi i32 [ %19, %17 ], [ %22, %20 ]
br label %25
25: ; preds = %23, %8
%26 = phi i32 [ %10, %8 ], [ %24, %23 ]
ret i32 %26
}

LLVM IR (-O2):
define i32 @xdigit_to_int(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = add i32 %0, -97
%5 = icmp ult i32 %4, 6
%6 = select i1 %5, i32 -97, i32 -65
%7 = add nsw i32 %6, %0
%8 = select i1 %3, i32 %2, i32 %7
ret i32 %8
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ memcpy(void *, void *, int);
int strlen(char *);
void *__unfo_str_clone(void *str) {
  void *ret;
  ret = malloc(sizeof(char) * (strlen((char *)str) + 1));
  memcpy(ret, str, sizeof(char) * (strlen((char *)str) + 1));
  return ret;
}


x86 assembly (clang, -O0):
<__unfo_str_clone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__unfo_str_clone>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <memcpy@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @__unfo_str_clone(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = mul i64 1, %7
%9 = trunc i64 %8 to i32
%10 = call i8* @malloc(i32 %9)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = load i8*, i8** %2
%13 = load i8*, i8** %2
%14 = call i32 @strlen(i8* %13)
%15 = add nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = mul i64 1, %16
%18 = trunc i64 %17 to i32
%19 = call i32 @memcpy(i8* %11, i8* %12, i32 %18)
%20 = load i8*, i8** %3
ret i8* %20
}

LLVM IR (-O2):
define i8* @__unfo_str_clone(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @strlen(i8* %0)
%6 = add nsw i32 %5, 1
%7 = tail call i32 @memcpy(i8* %4, i8* %0, i32 %6)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ XOpenDisplay(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int i;
  i = argc;
  i = argv[0][0];
  XOpenDisplay(NULL);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <XOpenDisplay@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %3
store i32 %6, i32* %5
%7 = load i8**, i8*** %4
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
store i32 %12, i32* %5
%13 = call i32 @XOpenDisplay(i32* null)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @XOpenDisplay(i32* null)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
int twopass_comp(const void *va, const void *vb) {
  const uint64_t *a = (const uint64_t *)va;
  const uint64_t *b = (const uint64_t *)vb;
  return ((a[0] > b[0]) - (a[0] < b[0]));
}


x86 assembly (clang, -O0):
<twopass_comp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%rcx
mov    -0x20(%rbp),%rdx
cmp    (%rdx),%rcx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<twopass_comp>:
mov    (%rdi),%rcx
xor    %eax,%eax
xor    %edx,%edx
cmp    (%rsi),%rcx
setg   %al
setl   %dl
sub    %edx,%eax
ret

LLVM IR (-O0):
define i32 @twopass_comp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64*
%6 = alloca i64*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i64*
store i64* %8, i64** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i64*
store i64* %10, i64** %6
%11 = load i64*, i64** %5
%12 = getelementptr inbounds i64, i64* %11, i64 0
%13 = load i64, i64* %12
%14 = load i64*, i64** %6
%15 = getelementptr inbounds i64, i64* %14, i64 0
%16 = load i64, i64* %15
%17 = icmp sgt i64 %13, %16
%18 = zext i1 %17 to i32
%19 = load i64*, i64** %5
%20 = getelementptr inbounds i64, i64* %19, i64 0
%21 = load i64, i64* %20
%22 = load i64*, i64** %6
%23 = getelementptr inbounds i64, i64* %22, i64 0
%24 = load i64, i64* %23
%25 = icmp slt i64 %21, %24
%26 = zext i1 %25 to i32
%27 = sub nsw i32 %18, %26
ret i32 %27
}

LLVM IR (-O2):
define i32 @twopass_comp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = bitcast i8* %1 to i64*
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp sgt i64 %5, %6
%8 = zext i1 %7 to i32
%9 = icmp slt i64 %5, %6
%10 = sext i1 %9 to i32
%11 = add nsw i32 %10, %8
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
int main() {
  int e = 1;
  foo(e);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <foo@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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


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

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

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

LLVM IR (-O2):
define void @gdk_notify_startup_complete() {
ret void
}
/* Variables and functions */
float max(float, float);
float opi(float a, float b) { return max(a, b); }


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

x86 assembly (clang, -O2):
<opi>:
jmp    1030 <max@plt>

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

LLVM IR (-O2):
define float @opi(float %0, float %1) {
%3 = tail call float @max(float %0, float %1)
ret float %3
}
/* Variables and functions */
scalar_t__ floor(double);
int xToI() { return (int)floor(2.90) + 1; }


x86 assembly (clang, -O0):
<xToI>:
push   %rbp
mov    %rsp,%rbp
movsd  0xee4(%rip),%xmm0
call   1030 <floor@plt>
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xToI>:
push   %rax
movsd  0xee7(%rip),%xmm0
call   1030 <floor@plt>
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @xToI() {
%1 = call i64 @floor(double 2.900000e+00)
%2 = trunc i64 %1 to i32
%3 = add nsw i32 %2, 1
ret i32 %3
}

LLVM IR (-O2):
define i32 @xToI() {
%1 = tail call i64 @floor(double 2.900000e+00)
%2 = trunc i64 %1 to i32
%3 = add nsw i32 %2, 1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char const *, char *, int *);
int repeaterOffsetStr(const char *rptrOffset) {
  int hz;
  sscanf(rptrOffset, "%2X", &hz);
  return 20 * hz;
}


x86 assembly (clang, -O0):
<repeaterOffsetStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <sscanf@plt>
imul   $0x14,-0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<repeaterOffsetStr>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%eax
shl    $0x2,%eax
lea    (%rax,%rax,4),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%2X\00"
define i32 @repeaterOffsetStr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = mul nsw i32 20, %6
ret i32 %7
}

LLVM IR (-O2):
@.str = [4 x i8] c"%2X\00"
define i32 @repeaterOffsetStr(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = mul nsw i32 %5, 20
ret i32 %6
}
int test_communications(bn, padc, pser)
int bn;
int *padc, *pser;
{
  int retval;
  if (-14 == (retval = reset_controller(bn)))
    return (retval);
  return (read_serial_number(bn, pser));
}


x86 assembly (clang, -O0):
<test_communications>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <reset_controller@plt>
mov    %eax,%ecx
mov    %ecx,-0x1c(%rbp)
mov    $0xfffffff2,%eax
cmp    %ecx,%eax
jne    115a <test_communications+0x3a>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116b <test_communications+0x4b>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <read_serial_number@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_communications>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <reset_controller@plt>
cmp    $0xfffffff2,%eax
jne    1140 <test_communications+0x20>
mov    $0xfffffff2,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %ebp,%edi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <read_serial_number@plt>

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

LLVM IR (-O2):
define i32 @test_communications(i32 %0, i32* nocapture readnone %1, i32* %2) {
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @reset_controller to i32 (i32, ...)*)(i32 %0)
%5 = icmp eq i32 %4, -14
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 (i32, i32*, ...) bitcast (i32 (...)* @read_serial_number to i32 (i32, i32*, ...)*)(i32 %0, i32* %2)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ %7, %6 ], [ -14, %3 ]
ret i32 %9
}
/* Variables and functions */
int exact_square(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int number;
  scanf("%d", &number);
  printf("%d\n", exact_square(number));
  return 1;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <exact_square@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x1,%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 = call i32 @exact_square(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 1
}

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 = call i32 @exact_square(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ lgen2(char *, int, int);
void cgdecps(int a, int v) { lgen2("subl\t$%d,%c%d", v, a); }


x86 assembly (clang, -O0):
<cgdecps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xed5(%rip),%rdi
call   1030 <lgen2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgdecps>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
jmp    1030 <lgen2@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"subl\09$%d,%c%d\00"
define void @cgdecps(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 = call i32 @lgen2(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"subl\09$%d,%c%d\00"
define void @cgdecps(i32 %0, i32 %1) {
%3 = tail call i32 @lgen2(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ a();
int /*<<< orphan*/ r();
void good_goto2(void) {
  a();
  goto label;
  a();
  r();
label:
  r();
}


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

x86 assembly (clang, -O2):
<good_goto2>:
push   %rax
xor    %eax,%eax
call   1040 <a@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <r@plt>

LLVM IR (-O0):
define void @good_goto2() {
%1 = call i32 (...) @a()
br label %2
2: ; preds = %0
%3 = call i32 (...) @r()
ret void
}

LLVM IR (-O2):
define void @good_goto2() {
%1 = tail call i32 (...) @a()
%2 = tail call i32 (...) @r()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void stop88x(void) { exit(1); }


x86 assembly (clang, -O0):
<stop88x>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<stop88x>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @stop88x() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @stop88x() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ perror(char const *);
void err_sys(const char *x) { perror(x); }


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

x86 assembly (clang, -O2):
<err_sys>:
jmp    1030 <perror@plt>

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

LLVM IR (-O2):
define void @err_sys(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errx(int, char *);
void usage(void) {
  errx(1, "\nusage:\n\tjfpg -c [-S] [-r rounds] [-m memory] [-t threads] -f "
          "file	    \n\tjfpg -e [-S] -p recip-pubkey -k sender-seckey -f file "
          "	    \n\tjfpg -d [-S] [-p sender-pubkey -k recip-seckey] -f "
          "file 	    \n\tjfpg -s [-S] -k signer-signing-seckey -f "
          "file	    \n\tjfpg -v -p signer-signing-pubkey -f file	    "
          "\n\tjfpg -n key-id [-S] [-r rounds] [-m memory] [-t threads]");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xee0(%rip),%rsi
call   1030 <errx@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edi
jmp    1030 <errx@plt>

LLVM IR (-O0):
@.str = [353 x i8] c"\0Ausage:\0A\09jfpg -c [-S] [-r rounds] [-m memory] [-t threads] -f file\09 \0A\09jfpg -e [-S] -p recip-pubkey -k sender-seckey -f file \09 \0A\09jfpg -d [-S] [-p sender-pubkey -k recip-seckey] -f file \09 \0A\09jfpg -s [-S] -k signer-signing-seckey -f file\09 \0A\09jfpg -v -p signer-signing-pubkey -f file\09 \0A\09jfpg -n key-id [-S] [-r rounds] [-m memory] [-t threads]\00"
define void @usage() {
%1 = call i32 @errx(i32 1, i8* getelementptr inbounds ([353 x i8], [353 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [353 x i8] c"\0Ausage:\0A\09jfpg -c [-S] [-r rounds] [-m memory] [-t threads] -f file\09 \0A\09jfpg -e [-S] -p recip-pubkey -k sender-seckey -f file \09 \0A\09jfpg -d [-S] [-p sender-pubkey -k recip-seckey] -f file \09 \0A\09jfpg -s [-S] -k signer-signing-seckey -f file\09 \0A\09jfpg -v -p signer-signing-pubkey -f file\09 \0A\09jfpg -n key-id [-S] [-r rounds] [-m memory] [-t threads]\00"
define void @usage() {
%1 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([353 x i8], [353 x i8]* @.str, i64 0, i64 0))
ret void
}