xunge/DecIR huggingface dataset:
/* Type definitions */
struct usb_interface {
  int dummy;
};
struct snd_usb_audio_quirk {
  int dummy;
};
struct snd_card {
  int dummy;
};
struct list_head {
  int dummy;
};

/* Variables and functions */
int __snd_usbmidi_create(struct snd_card *, struct usb_interface *,
                         struct list_head *, struct snd_usb_audio_quirk const *,
                         int /*<<< orphan*/);
int snd_usbmidi_create(struct snd_card *card, struct usb_interface *iface,
                       struct list_head *midi_list,
                       const struct snd_usb_audio_quirk *quirk) {
  return __snd_usbmidi_create(card, iface, midi_list, quirk, 0);
}


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

x86 assembly (clang, -O2):
<snd_usbmidi_create>:
xor    %r8d,%r8d
jmp    1030 <__snd_usbmidi_create@plt>

LLVM IR (-O0):
%struct.snd_card = type { i32 }
%struct.usb_interface = type { i32 }
%struct.list_head = type { i32 }
%struct.snd_usb_audio_quirk = type { i32 }
define i32 @snd_usbmidi_create(%struct.snd_card* %0, %struct.usb_interface* %1, %struct.list_head* %2, %struct.snd_usb_audio_quirk* %3) {
%5 = alloca %struct.snd_card*
%6 = alloca %struct.usb_interface*
%7 = alloca %struct.list_head*
%8 = alloca %struct.snd_usb_audio_quirk*
store %struct.snd_card* %0, %struct.snd_card** %5
store %struct.usb_interface* %1, %struct.usb_interface** %6
store %struct.list_head* %2, %struct.list_head** %7
store %struct.snd_usb_audio_quirk* %3, %struct.snd_usb_audio_quirk** %8
%9 = load %struct.snd_card*, %struct.snd_card** %5
%10 = load %struct.usb_interface*, %struct.usb_interface** %6
%11 = load %struct.list_head*, %struct.list_head** %7
%12 = load %struct.snd_usb_audio_quirk*, %struct.snd_usb_audio_quirk** %8
%13 = call i32 @__snd_usbmidi_create(%struct.snd_card* %9, %struct.usb_interface* %10, %struct.list_head* %11, %struct.snd_usb_audio_quirk* %12, i32 0)
ret i32 %13
}

LLVM IR (-O2):
%struct.snd_card = type { i32 }
%struct.usb_interface = type { i32 }
%struct.list_head = type { i32 }
%struct.snd_usb_audio_quirk = type { i32 }
define i32 @snd_usbmidi_create(%struct.snd_card* %0, %struct.usb_interface* %1, %struct.list_head* %2, %struct.snd_usb_audio_quirk* %3) {
%5 = tail call i32 @__snd_usbmidi_create(%struct.snd_card* %0, %struct.usb_interface* %1, %struct.list_head* %2, %struct.snd_usb_audio_quirk* %3, i32 0)
ret i32 %5
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void DAC_Out(uint32_t data) {
  (*((volatile uint32_t *)0x400053FC)) &= ~0x3F;
  (*((volatile uint32_t *)0x400053FC)) |= data;
}


x86 assembly (clang, -O0):
<DAC_Out>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x400053fc,%eax
mov    (%rax),%ecx
and    $0xffffffc0,%ecx
mov    $0x400053fc,%eax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
mov    $0x400053fc,%ecx
mov    (%rcx),%ecx
or     %eax,%ecx
mov    $0x400053fc,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<DAC_Out>:
andl   $0xffffffc0,0x400053fc
c0
or     %edi,0x400053fc
ret

LLVM IR (-O0):
define void @DAC_Out(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load volatile i32, i32* inttoptr (i64 1073763324 to i32*)
%4 = and i32 %3, -64
store volatile i32 %4, i32* inttoptr (i64 1073763324 to i32*)
%5 = load i32, i32* %2
%6 = load volatile i32, i32* inttoptr (i64 1073763324 to i32*)
%7 = or i32 %6, %5
store volatile i32 %7, i32* inttoptr (i64 1073763324 to i32*)
ret void
}

LLVM IR (-O2):
define void @DAC_Out(i32 %0) {
%2 = load volatile i32, i32* inttoptr (i64 1073763324 to i32*)
%3 = and i32 %2, -64
store volatile i32 %3, i32* inttoptr (i64 1073763324 to i32*)
%4 = load volatile i32, i32* inttoptr (i64 1073763324 to i32*)
%5 = or i32 %4, %0
store volatile i32 %5, i32* inttoptr (i64 1073763324 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ lseek(int, unsigned int, int /*<<< orphan*/);
int /*<<< orphan*/ read(int, void *, int);
int BootIdeReadSector(int nDriveIndex, void *pbBuffer, unsigned int block,
                      int byte_offset, int n_bytes) {
  lseek(nDriveIndex, block * 2048, SEEK_SET);
  read(nDriveIndex, pbBuffer, 2048);
  return 0;
}


x86 assembly (clang, -O0):
<BootIdeReadSector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
shl    $0xb,%esi
mov    0x2e97(%rip),%rax
mov    (%rax),%edx
call   1030 <lseek@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x800,%edx
call   1040 <read@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BootIdeReadSector>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
shl    $0xb,%edx
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
mov    %edx,%esi
mov    %eax,%edx
call   1030 <lseek@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x800,%edx
call   1040 <read@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
define i32 @BootIdeReadSector(i32 %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
%12 = load i32, i32* %8
%13 = mul i32 %12, 2048
%14 = load i32, i32* @SEEK_SET
%15 = call i32 @lseek(i32 %11, i32 %13, i32 %14)
%16 = load i32, i32* %6
%17 = load i8*, i8** %7
%18 = call i32 @read(i32 %16, i8* %17, i32 2048)
ret i32 0
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define i32 @BootIdeReadSector(i32 %0, i8* nocapture %1, i32 %2, i32 %3, i32 %4) {
%6 = shl i32 %2, 11
%7 = load i32, i32* @SEEK_SET
%8 = tail call i32 @lseek(i32 %0, i32 %6, i32 %7)
%9 = tail call i32 @read(i32 %0, i8* %1, i32 2048)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ listDir(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *opendir(char *);
int main(int argc, char **argv) {
  DIR *d;
  d = opendir(argv[1]);
  if (d != NULL) {
    listDir(argv[1], d, 0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1165 <main+0x45>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1040 <listDir@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1030 <opendir@plt>
test   %rax,%rax
je     1140 <main+0x20>
mov    0x8(%rbx),%rdi
mov    %rax,%rsi
xor    %edx,%edx
call   1040 <listDir@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32* @opendir(i8* %4)
%6 = icmp eq i32* %5, null
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = tail call i32 @listDir(i8* %8, i32* %5, i32 0)
br label %10
10: ; preds = %7, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ example01(char *);
void example02(char *led1, char *led2) {
  while (1) {
    example01(led1);
    example01(led2);
  }
}


x86 assembly (clang, -O0):
<example02>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <example01@plt>
mov    -0x10(%rbp),%rdi
call   1030 <example01@plt>
jmp    1120 <example02+0x10>

x86 assembly (clang, -O2):
<example02>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <example01@plt>
mov    %r14,%rdi
call   1030 <example01@plt>
jmp    1120 <example02+0x10>

LLVM IR (-O0):
define void @example02(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %2, %5
%6 = load i8*, i8** %3
%7 = call i32 @example01(i8* %6)
%8 = load i8*, i8** %4
%9 = call i32 @example01(i8* %8)
br label %5
}

LLVM IR (-O2):
define void @example02(i8* %0, i8* %1) {
br label %3
3: ; preds = %2, %3
%4 = tail call i32 @example01(i8* %0)
%5 = tail call i32 @example01(i8* %1)
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ accept_relational_expression();
int /*<<< orphan*/ parse_equality_expression();
void accept_equality_expression() {
  accept_relational_expression();
  parse_equality_expression();
}


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

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

LLVM IR (-O0):
define void @accept_equality_expression() {
%1 = call i32 (...) @accept_relational_expression()
%2 = call i32 (...) @parse_equality_expression()
ret void
}

LLVM IR (-O2):
define void @accept_equality_expression() {
%1 = tail call i32 (...) @accept_relational_expression()
%2 = tail call i32 (...) @parse_equality_expression()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void i_am_rly_leet() {
  printf("You found me!\nGood job!\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"You found me!\0AGood job!\0A\00"
define void @i_am_rly_leet() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"You found me!\0AGood job!\00"
define void @i_am_rly_leet() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int op_mul(int, int);
int test_mul() {
  if (op_mul(3, 4) != (3 * 4))
    return (-1);
  return (0);
}


x86 assembly (clang, -O0):
<test_mul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <op_mul@plt>
cmp    $0xc,%eax
je     113c <test_mul+0x2c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1143 <test_mul+0x33>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mul>:
push   %rax
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <op_mul@plt>
xor    %ecx,%ecx
cmp    $0xc,%eax
setne  %cl
neg    %ecx
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @test_mul() {
%1 = tail call i32 @op_mul(i32 3, i32 4)
%2 = icmp ne i32 %1, 12
%3 = sext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void be32enc(void *pp, uint32_t x) {
  uint8_t *p = (uint8_t *)pp;
  p[3] = x & 0xff;
  p[2] = (x >> 8) & 0xff;
  p[1] = (x >> 16) & 0xff;
  p[0] = (x >> 24) & 0xff;
}


x86 assembly (clang, -O0):
<be32enc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<be32enc>:
mov    %esi,%eax
movzbl %al,%ecx
mov    %ecx,0xc(%rdi)
movzbl %ah,%ecx
mov    %ecx,0x8(%rdi)
mov    %esi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %ecx,0x4(%rdi)
shr    $0x18,%eax
mov    %eax,(%rdi)
ret

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

LLVM IR (-O2):
define void @be32enc(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = and i32 %1, 255
%5 = getelementptr inbounds i8, i8* %0, i64 12
%6 = bitcast i8* %5 to i32*
store i32 %4, i32* %6
%7 = lshr i32 %1, 8
%8 = and i32 %7, 255
%9 = getelementptr inbounds i8, i8* %0, i64 8
%10 = bitcast i8* %9 to i32*
store i32 %8, i32* %10
%11 = lshr i32 %1, 16
%12 = and i32 %11, 255
%13 = getelementptr inbounds i8, i8* %0, i64 4
%14 = bitcast i8* %13 to i32*
store i32 %12, i32* %14
%15 = lshr i32 %1, 24
store i32 %15, i32* %3
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t ckBCD8toBinary(uint8_t b) { return ((b >> 4) * 10) + (b & 0x0f); }


x86 assembly (clang, -O0):
<ckBCD8toBinary>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
imul   $0xa,%eax,%eax
mov    -0x4(%rbp),%ecx
and    $0xf,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ckBCD8toBinary>:
mov    %edi,%eax
sar    $0x4,%eax
lea    (%rax,%rax,4),%eax
and    $0xf,%edi
lea    (%rdi,%rax,2),%eax
ret

LLVM IR (-O0):
define i32 @ckBCD8toBinary(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 4
%5 = mul nsw i32 %4, 10
%6 = load i32, i32* %2
%7 = and i32 %6, 15
%8 = add nsw i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @ckBCD8toBinary(i32 %0) {
%2 = ashr i32 %0, 4
%3 = mul nsw i32 %2, 10
%4 = and i32 %0, 15
%5 = add nsw i32 %3, %4
ret i32 %5
}
int fn4(int a, int b) {
  int tem1 = b | a;
  int tem2 = b ^ a;
  return tem1 ^ tem2;
}


x86 assembly (clang, -O0):
<fn4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
or     -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x10(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fn4(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = or i32 %7, %8
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = xor i32 %10, %11
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = xor i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @fn4(i32 %0, i32 %1) {
%3 = and i32 %1, %0
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int main() {
  FILE *pFile = NULL;
  pFile = fopen("fopen.txt", "w+t");
  if (pFile != NULL) {
    fputs("fopen test", pFile);
    fclose(pFile);
  } else {
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xeb2(%rip),%rdi
lea    0xeb5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1187 <main+0x57>
mov    -0x10(%rbp),%rsi
lea    0xe9a(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
jmp    118c <main+0x5c>
jmp    118c <main+0x5c>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     116d <main+0x3d>
mov    %rax,%rbx
lea    0xebb(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"fopen.txt\00"
@.str.1 = [4 x i8] c"w+t\00"
@.str.2 = [11 x i8] c"fopen test\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
store i32* null, i32** %2
%3 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %11
6: ; preds = %0
%7 = load i32*, i32** %2
%8 = call i32 @fputs(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%9 = load i32*, i32** %2
%10 = call i32 @fclose(i32* %9)
br label %12
11: ; preds = %0
br label %12
12: ; preds = %11, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"fopen.txt\00"
@.str.1 = [4 x i8] c"w+t\00"
@.str.2 = [11 x i8] c"fopen test\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i64 10, i64 1, i32* %1)
%5 = tail call i32 @fclose(i32* %1)
br label %6
6: ; preds = %0, %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ol(char *);
m_neg() { ol("NEG  AX"); }


x86 assembly (clang, -O0):
<m_neg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <ol@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"NEG AX\00"
define i32 @m_neg() {
%1 = alloca i32
%2 = call i32 @ol(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [8 x i8] c"NEG AX\00"
define i32 @m_neg() {
%1 = tail call i32 @ol(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ read(int /*<<< orphan*/, unsigned char *, int);
getKey() {
  unsigned char c;
  read(0, &c, 1);
  return c;
}


x86 assembly (clang, -O0):
<getKey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getKey>:
push   %rax
lea    0x7(%rsp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <read@plt>
movzbl 0x7(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @getKey() {
%1 = alloca i8
%2 = call i32 @read(i32 0, i8* %1, i32 1)
%3 = load i8, i8* %1
%4 = zext i8 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @getKey() {
%1 = alloca i8
%2 = call i32 @read(i32 0, i8* %1, i32 1)
%3 = load i8, i8* %1
%4 = zext i8 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ gint2_nai_S_cF(double *, double, double *, double, double *,
                                  double *);
void gint2_nai_cF_S(double *a, double a_a, double *b, double b_a, double *c,
                    double *out) {
  gint2_nai_S_cF(b, b_a, a, a_a, c, out);
}


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

x86 assembly (clang, -O2):
<gint2_nai_cF_S>:
movaps %xmm0,%xmm2
mov    %rdi,%rax
mov    %rsi,%rdi
movaps %xmm1,%xmm0
mov    %rax,%rsi
movaps %xmm2,%xmm1
jmp    1030 <gint2_nai_S_cF@plt>

LLVM IR (-O0):
define void @gint2_nai_cF_S(double* %0, double %1, double* %2, double %3, double* %4, double* %5) {
%7 = alloca double*
%8 = alloca double
%9 = alloca double*
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
store double* %0, double** %7
store double %1, double* %8
store double* %2, double** %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%13 = load double*, double** %9
%14 = load double, double* %10
%15 = load double*, double** %7
%16 = load double, double* %8
%17 = load double*, double** %11
%18 = load double*, double** %12
%19 = call i32 @gint2_nai_S_cF(double* %13, double %14, double* %15, double %16, double* %17, double* %18)
ret void
}

LLVM IR (-O2):
define void @gint2_nai_cF_S(double* %0, double %1, double* %2, double %3, double* %4, double* %5) {
%7 = tail call i32 @gint2_nai_S_cF(double* %2, double %3, double* %0, double %1, double* %4, double* %5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ xcb_connection_t;

/* Variables and functions */
void run(xcb_connection_t *c) { return; }


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

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

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

LLVM IR (-O2):
define void @run(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int CANRegRead(unsigned long);
int /*<<< orphan*/ CANRegWrite(unsigned long, int);
void CANDisable(unsigned long ulBase) {
  ;
  CANRegWrite(ulBase + 0x00000000,
              CANRegRead(ulBase + 0x00000000) | 0x00000001);
}


x86 assembly (clang, -O0):
<CANDisable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x0,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x0,%rdi
call   1040 <CANRegRead@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
or     $0x1,%esi
call   1030 <CANRegWrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CANDisable>:
push   %rbx
mov    %rdi,%rbx
call   1040 <CANRegRead@plt>
or     $0x1,%eax
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <CANRegWrite@plt>

LLVM IR (-O0):
define void @CANDisable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 0
%5 = load i64, i64* %2
%6 = add i64 %5, 0
%7 = call i32 @CANRegRead(i64 %6)
%8 = or i32 %7, 1
%9 = call i32 @CANRegWrite(i64 %4, i32 %8)
ret void
}

LLVM IR (-O2):
define void @CANDisable(i64 %0) {
%2 = tail call i32 @CANRegRead(i64 %0)
%3 = or i32 %2, 1
%4 = tail call i32 @CANRegWrite(i64 %0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void sig_io(int signo) {
  printf("wait_io:  got sigio\n");
  exit(0);
}


x86 assembly (clang, -O0):
<sig_io>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [21 x i8] c"wait_io: got sigio\0A\00"
define void @sig_io(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [20 x i8] c"wait_io: got sigio\00"
define void @sig_io(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int fc8300_init(void *, unsigned short);
int bbm_com_init(void *handle, unsigned short devid) {
  int res;
  res = fc8300_init(handle, devid);
  return res;
}


x86 assembly (clang, -O0):
<bbm_com_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rdi
movzwl -0xa(%rbp),%esi
call   1030 <fc8300_init@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbm_com_init>:
jmp    1030 <fc8300_init@plt>

LLVM IR (-O0):
define i32 @bbm_com_init(i8* %0, i16 zeroext %1) {
%3 = alloca i8*
%4 = alloca i16
%5 = alloca i32
store i8* %0, i8** %3
store i16 %1, i16* %4
%6 = load i8*, i8** %3
%7 = load i16, i16* %4
%8 = call i32 @fc8300_init(i8* %6, i16 zeroext %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @bbm_com_init(i8* %0, i16 zeroext %1) {
%3 = tail call i32 @fc8300_init(i8* %0, i16 zeroext %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("ToDo: Exercise 8-8\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [19 x i8] c"ToDo: Exercise 8-8\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 0
}
unsigned long long int f8(long long int x) {
  return ((unsigned long long int)x >> 59) | (x << 5);
}


x86 assembly (clang, -O0):
<f8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x3b,%rax
mov    -0x8(%rbp),%rcx
shl    $0x5,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f8>:
mov    %rdi,%rax
rol    $0x5,%rax
ret

LLVM IR (-O0):
define i64 @f8(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 59
%5 = load i64, i64* %2
%6 = shl i64 %5, 5
%7 = or i64 %4, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @f8(i64 %0) {
%2 = tail call i64 @llvm.fshl.i64(i64 %0, i64 %0, i64 5)
ret i64 %2
}
void body() {}


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

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

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

LLVM IR (-O2):
define void @body() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ function1();
int /*<<< orphan*/ function2();
int main() {
  int i, j;
  for (i = 0; i < 100; i++)
    function1();
  for (i = 0; i < 50000; i++)
    function2();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1155 <main+0x35>
mov    $0x0,%al
call   1030 <function1@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x8(%rbp)
cmpl   $0xc350,-0x8(%rbp)
jge    117e <main+0x5e>
mov    $0x0,%al
call   1040 <function2@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115c <main+0x3c>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x64,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <function1@plt>
add    $0xffffffff,%ebx
jne    1130 <main+0x10>
mov    $0xc350,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <function2@plt>
add    $0xffffffff,%ebx
jne    1150 <main+0x30>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %9, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 100
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = call i32 (...) @function1()
br label %9
9: ; preds = %7
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %4
12: ; preds = %4
store i32 0, i32* %2
br label %13
13: ; preds = %18, %12
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 50000
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = call i32 (...) @function2()
br label %18
18: ; preds = %16
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %13
21: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 (...) @function1()
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 100
br i1 %5, label %6, label %1
6: ; preds = %1, %6
%7 = phi i32 [ %9, %6 ], [ 0, %1 ]
%8 = tail call i32 (...) @function2()
%9 = add nuw nsw i32 %7, 1
%10 = icmp eq i32 %9, 50000
br i1 %10, label %11, label %6
11: ; preds = %6
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
void wr_scrn_center(int16_t r, const char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
define void @wr_scrn_center(i32 %0, i8* nocapture %1, ...) {
ret void
}
/* Type definitions */
struct Cyc_List_List {
  int dummy;
};
struct Cyc_Hashtable_Table {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Cyc_Toc_toc(struct Cyc_Hashtable_Table *,
                               struct Cyc_List_List *);
struct Cyc_List_List *Cyc_do_translate(struct Cyc_Hashtable_Table *pops,
                                       struct Cyc_List_List *tds) {
  return ({ Cyc_Toc_toc(pops, tds); });
}


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

x86 assembly (clang, -O2):
<Cyc_do_translate>:
push   %rax
call   1030 <Cyc_Toc_toc@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
%struct.Cyc_Hashtable_Table = type { i32 }
%struct.Cyc_List_List = type { i32 }
define %struct.Cyc_List_List* @Cyc_do_translate(%struct.Cyc_Hashtable_Table* %0, %struct.Cyc_List_List* %1) {
%3 = alloca %struct.Cyc_Hashtable_Table*
%4 = alloca %struct.Cyc_List_List*
%5 = alloca i32
store %struct.Cyc_Hashtable_Table* %0, %struct.Cyc_Hashtable_Table** %3
store %struct.Cyc_List_List* %1, %struct.Cyc_List_List** %4
%6 = load %struct.Cyc_Hashtable_Table*, %struct.Cyc_Hashtable_Table** %3
%7 = load %struct.Cyc_List_List*, %struct.Cyc_List_List** %4
%8 = call i32 @Cyc_Toc_toc(%struct.Cyc_Hashtable_Table* %6, %struct.Cyc_List_List* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to %struct.Cyc_List_List*
ret %struct.Cyc_List_List* %11
}

LLVM IR (-O2):
%struct.Cyc_Hashtable_Table = type { i32 }
%struct.Cyc_List_List = type { i32 }
define %struct.Cyc_List_List* @Cyc_do_translate(%struct.Cyc_Hashtable_Table* %0, %struct.Cyc_List_List* %1) {
%3 = tail call i32 @Cyc_Toc_toc(%struct.Cyc_Hashtable_Table* %0, %struct.Cyc_List_List* %1)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to %struct.Cyc_List_List*
ret %struct.Cyc_List_List* %5
}
/* Type definitions */
struct nn_epbase {
  int dummy;
};

/* Variables and functions */
int nn_binproc_create(void *, struct nn_epbase **);
int nn_inproc_bind(void *hint, struct nn_epbase **epbase) {
  return nn_binproc_create(hint, epbase);
}


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

x86 assembly (clang, -O2):
<nn_inproc_bind>:
jmp    1030 <nn_binproc_create@plt>

LLVM IR (-O0):
%struct.nn_epbase = type { i32 }
define i32 @nn_inproc_bind(i8* %0, %struct.nn_epbase** %1) {
%3 = alloca i8*
%4 = alloca %struct.nn_epbase**
store i8* %0, i8** %3
store %struct.nn_epbase** %1, %struct.nn_epbase*** %4
%5 = load i8*, i8** %3
%6 = load %struct.nn_epbase**, %struct.nn_epbase*** %4
%7 = call i32 @nn_binproc_create(i8* %5, %struct.nn_epbase** %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.nn_epbase = type { i32 }
define i32 @nn_inproc_bind(i8* %0, %struct.nn_epbase** %1) {
%3 = tail call i32 @nn_binproc_create(i8* %0, %struct.nn_epbase** %1)
ret i32 %3
}
/* Variables and functions */
int htonl(unsigned int);
unsigned sl_ntohl(unsigned netlong) { return htonl(netlong); }


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

x86 assembly (clang, -O2):
<sl_ntohl>:
jmp    1030 <htonl@plt>

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

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

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_Screen(void) {
  Screen *_p = (Screen *)malloc(sizeof(Screen));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_Screen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_Screen+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_Screen>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_Screen+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_Screen() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_Screen() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Type definitions */
struct syntree {
  int dummy;
};
struct nfa {
  int dummy;
};

/* Variables and functions */
struct nfa *alter_nfas(struct nfa *, struct nfa *);
struct nfa *build_nfa_impl(struct syntree *);
struct nfa *alter_trees(struct syntree *t1, struct syntree *t2) {
  struct nfa *n1 = build_nfa_impl(t1);
  struct nfa *n2 = build_nfa_impl(t2);
  return alter_nfas(n1, n2);
}


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

x86 assembly (clang, -O2):
<alter_trees>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1030 <build_nfa_impl@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <build_nfa_impl@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <alter_nfas@plt>

LLVM IR (-O0):
%struct.nfa = type { i32 }
%struct.syntree = type { i32 }
define %struct.nfa* @alter_trees(%struct.syntree* %0, %struct.syntree* %1) {
%3 = alloca %struct.syntree*
%4 = alloca %struct.syntree*
%5 = alloca %struct.nfa*
%6 = alloca %struct.nfa*
store %struct.syntree* %0, %struct.syntree** %3
store %struct.syntree* %1, %struct.syntree** %4
%7 = load %struct.syntree*, %struct.syntree** %3
%8 = call %struct.nfa* @build_nfa_impl(%struct.syntree* %7)
store %struct.nfa* %8, %struct.nfa** %5
%9 = load %struct.syntree*, %struct.syntree** %4
%10 = call %struct.nfa* @build_nfa_impl(%struct.syntree* %9)
store %struct.nfa* %10, %struct.nfa** %6
%11 = load %struct.nfa*, %struct.nfa** %5
%12 = load %struct.nfa*, %struct.nfa** %6
%13 = call %struct.nfa* @alter_nfas(%struct.nfa* %11, %struct.nfa* %12)
ret %struct.nfa* %13
}

LLVM IR (-O2):
%struct.nfa = type { i32 }
%struct.syntree = type { i32 }
define %struct.nfa* @alter_trees(%struct.syntree* %0, %struct.syntree* %1) {
%3 = tail call %struct.nfa* @build_nfa_impl(%struct.syntree* %0)
%4 = tail call %struct.nfa* @build_nfa_impl(%struct.syntree* %1)
%5 = tail call %struct.nfa* @alter_nfas(%struct.nfa* %3, %struct.nfa* %4)
ret %struct.nfa* %5
}
/* Type definitions */
struct timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
double gettime(void) {
  struct timespec ts;
  clock_gettime(CLOCK_MONOTONIC, &ts);
  return (double)ts.tv_sec + ts.tv_nsec / 1e9;
}


x86 assembly (clang, -O0):
<gettime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdq -0x8(%rbp),%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xec3(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettime>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdl 0x8(%rsp),%xmm0
divsd  0xec4(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
@CLOCK_MONOTONIC = global i32 0
define double @gettime() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%8 = load i32, i32* %7
%9 = sitofp i32 %8 to double
%10 = fdiv double %9, 1.000000e+09
%11 = fadd double %6, %10
ret double %11
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
@CLOCK_MONOTONIC = global i32 0
define double @gettime() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%6 = load i64, i64* %5
%7 = sitofp i64 %6 to double
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%9 = load i32, i32* %8
%10 = sitofp i32 %9 to double
%11 = fdiv double %10, 1.000000e+09
%12 = fadd double %11, %7
ret double %12
}
/* Variables and functions */
char *ft_strchr(char *, char);
char *ft_find(char *buffer, size_t bufsize) {
  static size_t offset = 0;
  char *find;
  if (buffer && (find = ft_strchr(buffer + offset, '\n'))) {
    offset = 0;
    return (find);
  }
  offset += bufsize - offset;
  return (NULL);
}


x86 assembly (clang, -O0):
<ft_find>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1166 <ft_find+0x56>
mov    -0x10(%rbp),%rdi
add    0x2efa(%rip),%rdi
mov    $0xa,%esi
call   1030 <ft_strchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1166 <ft_find+0x56>
movq   $0x0,0x2ed7(%rip)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1187 <ft_find+0x77>
mov    -0x18(%rbp),%rax
sub    0x2ebf(%rip),%rax
add    0x2eb8(%rip),%rax
mov    %rax,0x2eb1(%rip)
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_find>:
push   %rbx
mov    %rsi,%rbx
test   %rdi,%rdi
je     1133 <ft_find+0x23>
add    0x2f10(%rip),%rdi
mov    $0xa,%esi
call   1030 <ft_strchr@plt>
test   %rax,%rax
je     1133 <ft_find+0x23>
xor    %ebx,%ebx
jmp    1135 <ft_find+0x25>
xor    %eax,%eax
mov    %rbx,0x2ef4(%rip)
pop    %rbx
ret

LLVM IR (-O0):
@ft_find.offset = internal global i64 0
define i8* @ft_find(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = load i64, i64* @ft_find.offset
%12 = getelementptr inbounds i8, i8* %10, i64 %11
%13 = call i8* @ft_strchr(i8* %12, i8 signext 10)
store i8* %13, i8** %6
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %17
15: ; preds = %9
store i64 0, i64* @ft_find.offset
%16 = load i8*, i8** %6
store i8* %16, i8** %3
br label %23
17: ; preds = %9, %2
%18 = load i64, i64* %5
%19 = load i64, i64* @ft_find.offset
%20 = sub i64 %18, %19
%21 = load i64, i64* @ft_find.offset
%22 = add i64 %21, %20
store i64 %22, i64* @ft_find.offset
store i8* null, i8** %3
br label %23
23: ; preds = %17, %15
%24 = load i8*, i8** %3
ret i8* %24
}

LLVM IR (-O2):
@ft_find.offset = internal unnamed_addr global i64 0
define i8* @ft_find(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i64, i64* @ft_find.offset
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = tail call i8* @ft_strchr(i8* %6, i8 signext 10)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %4, %2
br label %10
10: ; preds = %4, %9
%11 = phi i64 [ %1, %9 ], [ 0, %4 ]
%12 = phi i8* [ null, %9 ], [ %7, %4 ]
store i64 %11, i64* @ft_find.offset
ret i8* %12
}
unsigned char revertchar(unsigned char s) {
  char tmp = (s & 0xf) << 4;
  s = ((s >> 4) & 0xf) | tmp;
  return s;
}


x86 assembly (clang, -O0):
<revertchar>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
shl    $0x4,%eax
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
and    $0xf,%eax
movsbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<revertchar>:
mov    %edi,%eax
rol    $0x4,%al
ret

LLVM IR (-O0):
define zeroext i8 @revertchar(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = and i32 %5, 15
%7 = shl i32 %6, 4
%8 = trunc i32 %7 to i8
store i8 %8, i8* %3
%9 = load i8, i8* %2
%10 = zext i8 %9 to i32
%11 = ashr i32 %10, 4
%12 = and i32 %11, 15
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = or i32 %12, %14
%16 = trunc i32 %15 to i8
store i8 %16, i8* %2
%17 = load i8, i8* %2
ret i8 %17
}

LLVM IR (-O2):
define zeroext i8 @revertchar(i8 zeroext %0) {
%2 = tail call i8 @llvm.fshl.i8(i8 %0, i8 %0, i8 4)
ret i8 %2
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  char num[123];
  gets(num);
  i = atoi(num);
  printf("%d", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
call   1040 <gets@plt>
lea    -0x90(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <gets@plt>
mov    %rbx,%rdi
call   1050 <atoi@plt>
lea    0xeae(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

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

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