xunge/DecIR huggingface dataset:
int vdprintf_help(char c) {
  int d0, d1, d2;
  if (c == '\n') {
    c = '\r';
    c = '\n';
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<vdprintf_help>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    112b <vdprintf_help+0x2b>
movb   $0xd,-0x5(%rbp)
movb   $0xa,-0x5(%rbp)
movl   $0x0,-0x4(%rbp)
jmp    1132 <vdprintf_help+0x32>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @vdprintf_help(i8 signext %0) {
ret i32 0
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t byte_fill(uint64_t u) {
  u &= 0xff;
  u |= u << 8;
  u |= u << 16;
  u |= u << 32;
  return u;
}


x86 assembly (clang, -O0):
<byte_fill>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @byte_fill(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = shl i32 %5, 8
%7 = load i32, i32* %2
%8 = or i32 %7, %6
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = shl i32 %9, 16
%11 = load i32, i32* %2
%12 = or i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = shl i32 %13, 32
%15 = load i32, i32* %2
%16 = or i32 %15, %14
store i32 %16, i32* %2
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @byte_fill(i32 %0) {
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ pop();
int /*<<< orphan*/ push(int /*<<< orphan*/);
int /*<<< orphan*/ sqrt(int /*<<< orphan*/);
void sqrt_handler(void) { push(sqrt(pop())); }


x86 assembly (clang, -O0):
<sqrt_handler>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <pop@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
mov    %eax,%edi
call   1040 <push@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqrt_handler>:
push   %rax
xor    %eax,%eax
call   1030 <pop@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <push@plt>

LLVM IR (-O0):
define void @sqrt_handler() {
%1 = call i32 (...) @pop()
%2 = call i32 @sqrt(i32 %1)
%3 = call i32 @push(i32 %2)
ret void
}

LLVM IR (-O2):
define void @sqrt_handler() {
%1 = tail call i32 (...) @pop()
%2 = tail call i32 @sqrt(i32 %1)
%3 = tail call i32 @push(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0x52() {
  Assert_real((isbdigit(82) == 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_isbdigit.c",
              415, ("isbdigit should be 0 for R"));
}


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

x86 assembly (clang, -O2):
<t_isbdigit_0x52>:
push   %rax
mov    $0x52,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x19f,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isbdigit.c\00"
@.str.1 = [27 x i8] c"isbdigit should be 0 for R\00"
define void @t_isbdigit_0x52() {
%1 = call i64 @isbdigit(i32 82)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 415, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isbdigit.c\00"
@.str.1 = [27 x i8] c"isbdigit should be 0 for R\00"
define void @t_isbdigit_0x52() {
%1 = tail call i64 @isbdigit(i32 82)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 415, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Fork();
int /*<<< orphan*/ printf(char *);
void doit() {
  Fork();
  Fork();
  printf("hello\n");
  return;
}


x86 assembly (clang, -O0):
<doit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <Fork@plt>
mov    $0x0,%al
call   1030 <Fork@plt>
lea    0xec7(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<doit>:
push   %rax
xor    %eax,%eax
call   1030 <Fork@plt>
xor    %eax,%eax
call   1030 <Fork@plt>
lea    0xeca(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"hello\0A\00"
define void @doit() {
%1 = call i32 (...) @Fork()
%2 = call i32 (...) @Fork()
%3 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define void @doit() {
%1 = tail call i32 (...) @Fork()
%2 = tail call i32 (...) @Fork()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ radio_get_dtc();
int /*<<< orphan*/ rom_write(int, int /*<<< orphan*/);
void radio_write_rom_dtc(void) { rom_write(58, radio_get_dtc()); }


x86 assembly (clang, -O0):
<radio_write_rom_dtc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <radio_get_dtc@plt>
mov    %eax,%esi
mov    $0x3a,%edi
call   1040 <rom_write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<radio_write_rom_dtc>:
push   %rax
xor    %eax,%eax
call   1030 <radio_get_dtc@plt>
mov    $0x3a,%edi
mov    %eax,%esi
pop    %rax
jmp    1040 <rom_write@plt>

LLVM IR (-O0):
define void @radio_write_rom_dtc() {
%1 = call i32 (...) @radio_get_dtc()
%2 = call i32 @rom_write(i32 58, i32 %1)
ret void
}

LLVM IR (-O2):
define void @radio_write_rom_dtc() {
%1 = tail call i32 (...) @radio_get_dtc()
%2 = tail call i32 @rom_write(i32 58, i32 %1)
ret void
}
/* Variables and functions */
double Ten90CprN(double, int);
double Ten90CprDlon(double lat, int fflag, int surface) {
  return (surface ? 90.0 : 360.0) / Ten90CprN(lat, fflag);
}


x86 assembly (clang, -O0):
<Ten90CprDlon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movsd  0xed2(%rip),%xmm0
movsd  0xed2(%rip),%xmm1
movsd  %xmm1,-0x20(%rbp)
cmp    $0x0,%eax
movsd  %xmm0,-0x18(%rbp)
jne    1153 <Ten90CprDlon+0x43>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1030 <Ten90CprN@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ten90CprDlon>:
push   %rax
xor    %eax,%eax
test   %esi,%esi
sete   %al
lea    0xee1(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm1
movsd  %xmm1,(%rsp)
call   1030 <Ten90CprN@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @Ten90CprDlon(double %0, i32 %1, i32 %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
store double %0, double* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, double 9.000000e+01, double 3.600000e+02
%11 = load double, double* %4
%12 = load i32, i32* %5
%13 = call double @Ten90CprN(double %11, i32 %12)
%14 = fdiv double %10, %13
ret double %14
}

LLVM IR (-O2):
define double @Ten90CprDlon(double %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = select i1 %4, double 3.600000e+02, double 9.000000e+01
%6 = tail call double @Ten90CprN(double %0, i32 %1)
%7 = fdiv double %5, %6
ret double %7
}
void REMR3NotifyPendingInterrupt(void) {}


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

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

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

LLVM IR (-O2):
define void @REMR3NotifyPendingInterrupt() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ empty_log(char *);
void pa_context_unref(int *c) {
  empty_log("pa_context_unref: nothing to do here\n");
}


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

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

LLVM IR (-O0):
@.str = [38 x i8] c"pa_context_unref: nothing to do here\0A\00"
define void @pa_context_unref(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 @empty_log(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"pa_context_unref: nothing to do here\0A\00"
define void @pa_context_unref(i32* nocapture readnone %0) {
%2 = tail call i32 @empty_log(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ accept_exclusive_OR_expression();
int /*<<< orphan*/ parse_inclusive_OR_expression();
void accept_inclusive_OR_expression() {
  accept_exclusive_OR_expression();
  parse_inclusive_OR_expression();
}


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

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

LLVM IR (-O0):
define void @accept_inclusive_OR_expression() {
%1 = call i32 (...) @accept_exclusive_OR_expression()
%2 = call i32 (...) @parse_inclusive_OR_expression()
ret void
}

LLVM IR (-O2):
define void @accept_inclusive_OR_expression() {
%1 = tail call i32 (...) @accept_exclusive_OR_expression()
%2 = tail call i32 (...) @parse_inclusive_OR_expression()
ret void
}
/* Type definitions */
struct ofpbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ofpbuf_use(struct ofpbuf *, int /*<<< orphan*/ *, size_t);
int /*<<< orphan*/ *xmalloc(size_t);
void ofpbuf_init(struct ofpbuf *b, size_t size) {
  ofpbuf_use(b, size ? xmalloc(size) : NULL, size);
}


x86 assembly (clang, -O0):
<ofpbuf_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1155 <ofpbuf_init+0x35>
mov    -0x10(%rbp),%rdi
call   1030 <xmalloc@plt>
mov    %rax,-0x20(%rbp)
jmp    1160 <ofpbuf_init+0x40>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    1160 <ofpbuf_init+0x40>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <ofpbuf_use@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ofpbuf_init>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
test   %rsi,%rsi
je     113c <ofpbuf_init+0x1c>
mov    %rbx,%rdi
call   1030 <xmalloc@plt>
mov    %rax,%rsi
jmp    113e <ofpbuf_init+0x1e>
xor    %esi,%esi
mov    %r14,%rdi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <ofpbuf_use@plt>

LLVM IR (-O0):
%struct.ofpbuf = type { i32 }
define void @ofpbuf_init(%struct.ofpbuf* %0, i64 %1) {
%3 = alloca %struct.ofpbuf*
%4 = alloca i64
store %struct.ofpbuf* %0, %struct.ofpbuf** %3
store i64 %1, i64* %4
%5 = load %struct.ofpbuf*, %struct.ofpbuf** %3
%6 = load i64, i64* %4
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i64, i64* %4
%10 = call i32* @xmalloc(i64 %9)
br label %12
11: ; preds = %2
br label %12
12: ; preds = %11, %8
%13 = phi i32* [ %10, %8 ], [ null, %11 ]
%14 = load i64, i64* %4
%15 = call i32 @ofpbuf_use(%struct.ofpbuf* %5, i32* %13, i64 %14)
ret void
}

LLVM IR (-O2):
%struct.ofpbuf = type { i32 }
define void @ofpbuf_init(%struct.ofpbuf* %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32* @xmalloc(i64 %1)
br label %6
6: ; preds = %2, %4
%7 = phi i32* [ %5, %4 ], [ null, %2 ]
%8 = tail call i32 @ofpbuf_use(%struct.ofpbuf* %0, i32* %7, i64 %1)
ret void
}
void sme_authenticate(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
                      struct wpa_ssid *ssid) {}


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

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

LLVM IR (-O0):
%struct.wpa_supplicant = type opaque
%struct.wpa_bss = type opaque
%struct.wpa_ssid = type opaque
define void @sme_authenticate(%struct.wpa_supplicant* %0, %struct.wpa_bss* %1, %struct.wpa_ssid* %2) {
%4 = alloca %struct.wpa_supplicant*
%5 = alloca %struct.wpa_bss*
%6 = alloca %struct.wpa_ssid*
store %struct.wpa_supplicant* %0, %struct.wpa_supplicant** %4
store %struct.wpa_bss* %1, %struct.wpa_bss** %5
store %struct.wpa_ssid* %2, %struct.wpa_ssid** %6
ret void
}

LLVM IR (-O2):
%struct.wpa_supplicant = type opaque
%struct.wpa_bss = type opaque
%struct.wpa_ssid = type opaque
define void @sme_authenticate(%struct.wpa_supplicant* nocapture %0, %struct.wpa_bss* nocapture %1, %struct.wpa_ssid* nocapture %2) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ pthread_mutex_init(int /*<<< orphan*/ *,
                                      int /*<<< orphan*/ *);
void SyncObjInit(pthread_mutex_t **mut) {
  *mut = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
  pthread_mutex_init(*mut, NULL);
}


x86 assembly (clang, -O0):
<SyncObjInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <pthread_mutex_init@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SyncObjInit>:
push   %rbx
mov    %rdi,%rbx
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
xor    %esi,%esi
pop    %rbx
jmp    1040 <pthread_mutex_init@plt>

LLVM IR (-O0):
define void @SyncObjInit(i32** %0) {
%2 = alloca i32**
store i32** %0, i32*** %2
%3 = call i64 @malloc(i32 4)
%4 = inttoptr i64 %3 to i32*
%5 = load i32**, i32*** %2
store i32* %4, i32** %5
%6 = load i32**, i32*** %2
%7 = load i32*, i32** %6
%8 = call i32 @pthread_mutex_init(i32* %7, i32* null)
ret void
}

LLVM IR (-O2):
define void @SyncObjInit(i32** nocapture writeonly %0) {
%2 = tail call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %0
%4 = tail call i32 @pthread_mutex_init(i32* %3, i32* null)
ret void
}
void handle_ABRT(sig) int sig;
{}


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

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

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

LLVM IR (-O2):
define void @handle_ABRT(i32 %0) {
ret void
}
int sorter(const void *a, const void *b) { return *((int *)a) - *((int *)b); }


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

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

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

LLVM IR (-O2):
define i32 @sorter(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
char getch();
int /*<<< orphan*/ printf(char *, char);
int main(int argc, char *argv[]) {
  char c;
  do {
    c = getch();
    printf("%d", c);
  } while (1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getch@plt>
mov    %al,-0x11(%rbp)
lea    0xeb9(%rip),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <printf@plt>
mov    $0x1,%al
test   $0x1,%al
jne    1136 <main+0x16>
jmp    115f <main+0x3f>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getch@plt>
movsbl %al,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1130 <main+0x10>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call signext i8 (...) @getch()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %4)
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void Sleep(int msecs) { usleep(msecs * 1000); }


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

x86 assembly (clang, -O2):
<Sleep>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @Sleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @Sleep(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
int jac_chain_nm8_alloc(void **mem, const int *idata, const double *rdata) {
  if (mem)
    *mem = 0;
  (void)idata;
  (void)rdata;
  return 0;
}


x86 assembly (clang, -O0):
<jac_chain_nm8_alloc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1126 <jac_chain_nm8_alloc+0x26>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<jac_chain_nm8_alloc>:
test   %rdi,%rdi
je     110c <jac_chain_nm8_alloc+0xc>
movq   $0x0,(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @jac_chain_nm8_alloc(i8** writeonly %0, i32* nocapture readnone %1, double* nocapture readnone %2) {
%4 = icmp eq i8** %0, null
br i1 %4, label %6, label %5
5: ; preds = %3
store i8* null, i8** %0
br label %6
6: ; preds = %5, %3
ret i32 0
}
int __attribute((cdecl)) cdecl(int x, int y, int z) { return x + y + z; }


x86 assembly (clang, -O0):
<cdecl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdecl>:
lea    (%rdi,%rsi,1),%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @cdecl(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 = add nsw i32 %7, %8
%10 = load i32, i32* %6
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @cdecl(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = add nsw i32 %4, %2
ret i32 %5
}
unsigned xrop3_208_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~D;
  stk2 = S | stk3;
  stk1 = T & stk2;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_208_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @xrop3_208_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %5
%24 = xor i32 %23, -1
store i32 %24, i32* %10
%25 = load i32, i32* %6
%26 = load i32, i32* %10
%27 = or i32 %25, %26
store i32 %27, i32* %9
%28 = load i32, i32* %7
%29 = load i32, i32* %9
%30 = and i32 %28, %29
store i32 %30, i32* %8
%31 = load i32, i32* %8
%32 = load i32, i32* %6
%33 = xor i32 %32, -1
%34 = and i32 %31, %33
%35 = load i32, i32* %7
%36 = xor i32 %35, -1
%37 = and i32 %34, %36
%38 = load i32, i32* %5
%39 = load i32, i32* %6
%40 = and i32 %38, %39
%41 = or i32 %37, %40
%42 = load i32, i32* %5
%43 = load i32, i32* %7
%44 = and i32 %42, %43
%45 = or i32 %41, %44
ret i32 %45
}

LLVM IR (-O2):
define i32 @xrop3_208_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = or i8 %1, %0
%4 = zext i8 %3 to i32
ret i32 %4
}
void pshell_loop(void) {
  char *line;
  char **args;
  int status;
  do {
    printf(":");
    line = pshell_read_line();
    args = pshell_split_line(line);
    status = pshell_execute(args);
    free(line);
    free(args);
  } while (status);
}


x86 assembly (clang, -O0):
<pshell_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <pshell_read_line@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1070 <pshell_split_line@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1060 <pshell_execute@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1158 <pshell_loop+0x8>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pshell_loop>:
push   %rbp
push   %r14
push   %rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x3a,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
call   1050 <pshell_read_line@plt>
movslq %eax,%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <pshell_split_line@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <pshell_execute@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
test   %ebp,%ebp
jne    1160 <pshell_loop+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c":\00"
define void @pshell_loop() {
%1 = alloca i8*
%2 = alloca i8**
%3 = alloca i32
br label %4
4: ; preds = %18, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @pshell_read_line()
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %1
%9 = load i8*, i8** %1
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @pshell_split_line to i32 (i8*, ...)*)(i8* %9)
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i8**
store i8** %12, i8*** %2
%13 = load i8**, i8*** %2
%14 = call i32 (i8**, ...) bitcast (i32 (...)* @pshell_execute to i32 (i8**, ...)*)(i8** %13)
store i32 %14, i32* %3
%15 = load i8*, i8** %1
%16 = load i8**, i8*** %2
%17 = bitcast i8** %16 to i8*
br label %18
18: ; preds = %4
%19 = load i32, i32* %3
%20 = icmp ne i32 %19, 0
br i1 %20, label %4, label %21
21: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @pshell_loop() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @putchar(i32 58)
%3 = tail call i32 (...) @pshell_read_line()
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @pshell_split_line to i32 (i8*, ...)*)(i8* %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8**
%9 = tail call i32 (i8**, ...) bitcast (i32 (...)* @pshell_execute to i32 (i8**, ...)*)(i8** %8)
tail call void @free(i8* %5)
%10 = inttoptr i64 %7 to i8*
tail call void @free(i8* %10)
%11 = icmp eq i32 %9, 0
br i1 %11, label %12, label %1
12: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ linefeed();
int /*<<< orphan*/ print_hex(char);
void println_hex(char value) {
  print_hex(value);
  linefeed();
}


x86 assembly (clang, -O0):
<println_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <print_hex@plt>
mov    $0x0,%al
call   1030 <linefeed@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @println_hex(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @print_hex(i8 signext %3)
%5 = call i32 (...) @linefeed()
ret void
}

LLVM IR (-O2):
define void @println_hex(i8 signext %0) {
%2 = tail call i32 @print_hex(i8 signext %0)
%3 = tail call i32 (...) @linefeed()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
struct zbuf {
  int dummy;
};

/* Variables and functions */
scalar_t__ __zbuf_pull(struct zbuf *, int, int);
int /*<<< orphan*/ be16toh(int /*<<< orphan*/);
uint16_t zbuf_get_be16(struct zbuf *zb) {
  struct unaligned16 {
    uint16_t value;
  } __attribute__((packed));
  struct unaligned16 *v =
      ((struct unaligned16 *)__zbuf_pull(zb, sizeof(struct unaligned16), 1));
  if (v)
    return be16toh(v->value);
  return 0;
}


x86 assembly (clang, -O0):
<zbuf_get_be16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <__zbuf_pull@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1161 <zbuf_get_be16+0x41>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1040 <be16toh@plt>
mov    %eax,-0x4(%rbp)
jmp    1168 <zbuf_get_be16+0x48>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zbuf_get_be16>:
push   %rax
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <__zbuf_pull@plt>
test   %rax,%rax
je     113d <zbuf_get_be16+0x1d>
mov    (%rax),%edi
pop    %rax
jmp    1040 <be16toh@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.zbuf = type { i32 }
%struct.unaligned16 = type { i32 }
define i32 @zbuf_get_be16(%struct.zbuf* %0) {
%2 = alloca i32
%3 = alloca %struct.zbuf*
%4 = alloca %struct.unaligned16*
store %struct.zbuf* %0, %struct.zbuf** %3
%5 = load %struct.zbuf*, %struct.zbuf** %3
%6 = call i64 @__zbuf_pull(%struct.zbuf* %5, i32 4, i32 1)
%7 = inttoptr i64 %6 to %struct.unaligned16*
store %struct.unaligned16* %7, %struct.unaligned16** %4
%8 = load %struct.unaligned16*, %struct.unaligned16** %4
%9 = icmp ne %struct.unaligned16* %8, null
br i1 %9, label %10, label %15
10: ; preds = %1
%11 = load %struct.unaligned16*, %struct.unaligned16** %4
%12 = getelementptr inbounds %struct.unaligned16, %struct.unaligned16* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i32 @be16toh(i32 %13)
store i32 %14, i32* %2
br label %16
15: ; preds = %1
store i32 0, i32* %2
br label %16
16: ; preds = %15, %10
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
%struct.zbuf = type { i32 }
%struct.unaligned16 = type { i32 }
define i32 @zbuf_get_be16(%struct.zbuf* %0) {
%2 = tail call i64 @__zbuf_pull(%struct.zbuf* %0, i32 4, i32 1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = inttoptr i64 %2 to %struct.unaligned16*
%6 = getelementptr inbounds %struct.unaligned16, %struct.unaligned16* %5, i64 0, i32 0
%7 = load i32, i32* %6
%8 = tail call i32 @be16toh(i32 %7)
br label %9
9: ; preds = %1, %4
%10 = phi i32 [ %8, %4 ], [ 0, %1 ]
ret i32 %10
}
void gtk_tree_iter_copy() {}


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

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

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

LLVM IR (-O2):
define void @gtk_tree_iter_copy() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
void do_work() {
  char msg[7];
  memcpy(msg, "Hiya", 4);
  msg[4] = ' ';
  memcpy(msg + 4, ":D", 2);
  printf("%s\n", msg);
}


x86 assembly (clang, -O0):
<do_work>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x7(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
movb   $0x20,-0x3(%rbp)
lea    -0x7(%rbp),%rdi
add    $0x4,%rdi
lea    0xeb5(%rip),%rsi
mov    $0x2,%edx
call   1040 <memcpy@plt>
lea    -0x7(%rbp),%rsi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_work>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rsi
lea    0x9(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <memcpy@plt>
lea    0xd(%rsp),%rdi
movb   $0x20,0xd(%rsp)
lea    0xeb6(%rip),%rsi
mov    $0x2,%edx
call   1040 <memcpy@plt>
lea    0xea8(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"Hiya\00"
@.str.1 = [3 x i8] c":D\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define void @do_work() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = call i32 @memcpy(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 4
store i8 32, i8* %4
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds i8, i8* %5, i64 4
%7 = call i32 @memcpy(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %8)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"Hiya\00"
@.str.1 = [3 x i8] c":D\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define void @do_work() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = call i32 @memcpy(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 4
store i8 32, i8* %4
%5 = call i32 @memcpy(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret void
}
int getch(void) {
  unsigned char ch;
  asm volatile("int $0x21" : "=Ral"(ch) : "a"(0x700));
  return ch;
}


x86 assembly (clang, -O0):
<getch>:
push   %rbp
mov    %rsp,%rbp
mov    $0x700,%eax
int    $0x21
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getch>:
mov    $0x700,%eax
int    $0x21
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @getch() {
%1 = alloca i8
%2 = call i8 asm sideeffect "int $$0x21", "=R{ax}l,{ax},~{dirflag},~{fpsr},~{flags}"(i32 1792)
store i8 %2, i8* %1
%3 = load i8, i8* %1
%4 = zext i8 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @getch() {
%1 = tail call i8 asm sideeffect "int $$0x21", "=R{ax}l,{ax},~{dirflag},~{fpsr},~{flags}"(i32 1792)
%2 = zext i8 %1 to i32
ret i32 %2
}
/* Variables and functions */
size_t strlcpy(char *, char const *, size_t);
size_t strlen(char *);
size_t strlcat(char *dest, const char *src, size_t len) {
  size_t dlen = strlen(dest);
  return dlen + strlcpy(dest + dlen, src, (len > dlen ? len - dlen : 0));
}


x86 assembly (clang, -O0):
<strlcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jbe    117c <strlcat+0x5c>
mov    -0x18(%rbp),%rax
sub    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    1187 <strlcat+0x67>
xor    %eax,%eax
mov    %rax,-0x40(%rbp)
jmp    1187 <strlcat+0x67>
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rdx
call   1040 <strlcpy@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
add    %rcx,%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlcat>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%r12
add    %rax,%rbx
xor    %edx,%edx
sub    %rax,%r15
cmovae %r15,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strlcpy@plt>
add    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @strlcat(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
store i64 %9, i64* %7
%10 = load i64, i64* %7
%11 = load i8*, i8** %4
%12 = load i64, i64* %7
%13 = getelementptr inbounds i8, i8* %11, i64 %12
%14 = load i8*, i8** %5
%15 = load i64, i64* %6
%16 = load i64, i64* %7
%17 = icmp ugt i64 %15, %16
br i1 %17, label %18, label %22
18: ; preds = %3
%19 = load i64, i64* %6
%20 = load i64, i64* %7
%21 = sub i64 %19, %20
br label %23
22: ; preds = %3
br label %23
23: ; preds = %22, %18
%24 = phi i64 [ %21, %18 ], [ 0, %22 ]
%25 = call i64 @strlcpy(i8* %13, i8* %14, i64 %24)
%26 = add i64 %10, %25
ret i64 %26
}

LLVM IR (-O2):
define i64 @strlcat(i8* %0, i8* %1, i64 %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i64 @llvm.usub.sat.i64(i64 %2, i64 %4)
%7 = tail call i64 @strlcpy(i8* %5, i8* %1, i64 %6)
%8 = add i64 %7, %4
ret i64 %8
}
void glSamplerParameterf(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glSamplerParameterf() {
ret void
}
/* Type definitions */
typedef int mode_t;

/* Variables and functions */
int open(char const *, int, int);
int /*<<< orphan*/ printf(char *, int, char const *, int, int);
int my_open(const char *path, int flags, mode_t mode) {
  int ret = open(path, flags, mode);
  printf("--> %d = open(%s, %x, %x)\n", ret, path, flags, mode);
  return ret;
}


x86 assembly (clang, -O0):
<my_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_open>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%rbx
call   1040 <open@plt>
mov    %eax,%ebp
lea    0xec2(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"--> %d = open(%s, %x, %x)\0A\00"
define i32 @my_open(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @open(i8* %8, i32 %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = load i8*, i8** %4
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %12, i8* %13, i32 %14, i32 %15)
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
@.str = [27 x i8] c"--> %d = open(%s, %x, %x)\0A\00"
define i32 @my_open(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @open(i8* %0, i32 %1, i32 %2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %4, i8* %0, i32 %1, i32 %2)
ret i32 %4
}
int cmp_float_gt(const void *a, const void *b) {
  float a_ = *(float *)a;
  float b_ = *(float *)b;
  if (a_ > b_)
    return -1;
  if (a_ < b_)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<cmp_float_gt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
ucomiss -0x20(%rbp),%xmm0
jbe    1141 <cmp_float_gt+0x41>
movl   $0xffffffff,-0x4(%rbp)
jmp    1167 <cmp_float_gt+0x67>
movss  -0x1c(%rbp),%xmm1
movss  -0x20(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1160 <cmp_float_gt+0x60>
movl   $0x1,-0x4(%rbp)
jmp    1167 <cmp_float_gt+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_float_gt>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
xor    %ecx,%ecx
ucomiss %xmm0,%xmm1
seta   %cl
ucomiss %xmm1,%xmm0
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cmp_float_gt(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca float
%7 = alloca float
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to float*
%10 = load float, float* %9
store float %10, float* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to float*
%13 = load float, float* %12
store float %13, float* %7
%14 = load float, float* %6
%15 = load float, float* %7
%16 = fcmp ogt float %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %24
18: ; preds = %2
%19 = load float, float* %6
%20 = load float, float* %7
%21 = fcmp olt float %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 1, i32* %3
br label %24
23: ; preds = %18
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @cmp_float_gt(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to float*
%4 = load float, float* %3
%5 = bitcast i8* %1 to float*
%6 = load float, float* %5
%7 = fcmp ogt float %4, %6
%8 = fcmp olt float %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
unsigned short gfx_inw(unsigned short port) { return (0); }


x86 assembly (clang, -O0):
<gfx_inw>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
xor    %eax,%eax
movzwl %ax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i16 @gfx_inw(i16 zeroext %0) {
ret i16 0
}
_Noreturn void a() { f(); }


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

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

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

LLVM IR (-O2):
define void @a() {
%1 = tail call i32 (...) @f()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
double bar(int);
int main(int argc, char **argv) {
  if (bar(116) != 117.0)
    abort();
  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    $0x74,%edi
call   1040 <bar@plt>
movsd  0xeb8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    115d <main+0x3d>
jp     115d <main+0x3d>
jmp    1164 <main+0x44>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x74,%edi
call   1040 <bar@plt>
ucomisd 0xecd(%rip),%xmm0
jne    113b <main+0x1b>
jp     113b <main+0x1b>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
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 double @bar(i32 116)
%7 = fcmp une double %6, 1.170000e+02
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call double @bar(i32 116)
%4 = fcmp une double %3, 1.170000e+02
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
ret i32 0
}
void FaultISR(void) {
  while (1) {
    (*((volatile unsigned long *)0x400253FC)) =
        ((*((volatile unsigned long *)0x400253FC)) & ~0xE) | 0x2;
  }
}


x86 assembly (clang, -O0):
<FaultISR>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <FaultISR+0x9>
mov    $0x400253fc,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffff1,%rcx
mov    %rcx,-0x10(%rbp)
or     $0x2,%rcx
mov    %rcx,-0x8(%rbp)
mov    $0x400253fc,%eax
mov    %rcx,(%rax)
jmp    1109 <FaultISR+0x9>

x86 assembly (clang, -O2):
<FaultISR>:
mov    0x400253fc,%rax
40
and    $0xfffffffffffffff1,%rax
or     $0x2,%rax
mov    %rax,0x400253fc
40
jmp    1100 <FaultISR>

LLVM IR (-O0):
define void @FaultISR() {
br label %1
1: ; preds = %0, %1
%2 = load volatile i64, i64* inttoptr (i64 1073894396 to i64*)
%3 = and i64 %2, -15
%4 = or i64 %3, 2
store volatile i64 %4, i64* inttoptr (i64 1073894396 to i64*)
br label %1
}

LLVM IR (-O2):
define void @FaultISR() {
br label %1
1: ; preds = %0, %1
%2 = load volatile i64, i64* inttoptr (i64 1073894396 to i64*)
%3 = and i64 %2, -15
%4 = or i64 %3, 2
store volatile i64 %4, i64* inttoptr (i64 1073894396 to i64*)
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ runEtherParseTests();
int /*<<< orphan*/ runSignatureTests();
extern void runBaseTests() {
  runEtherParseTests();
  runSignatureTests();
}


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

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

LLVM IR (-O0):
define void @runBaseTests() {
%1 = call i32 (...) @runEtherParseTests()
%2 = call i32 (...) @runSignatureTests()
ret void
}

LLVM IR (-O2):
define void @runBaseTests() {
%1 = tail call i32 (...) @runEtherParseTests()
%2 = tail call i32 (...) @runSignatureTests()
ret void
}
void funcGoto(int a) {
  char c = 'a';
  int i = 0;
loop:
  c++;
  i++;
  if (i < a) {
    goto loop;
  }
}


x86 assembly (clang, -O0):
<funcGoto>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movb   $0x61,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1134 <funcGoto+0x34>
jmp    1112 <funcGoto+0x12>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @funcGoto(i32 %0) {
ret void
}