xunge/DecIR huggingface dataset:
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ putchar(int);
void main() {
  int c;
  int past_c = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' && past_c == ' ')
      ;
    else
      putchar(c);
    past_c = c;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%eax
je     1174 <main+0x54>
cmpl   $0x20,-0x4(%rbp)
jne    1161 <main+0x41>
cmpl   $0x20,-0x8(%rbp)
jne    1161 <main+0x41>
jmp    1169 <main+0x49>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    112f <main+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%eax
jne    113f <main+0x1f>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %ebx,%ebx
jmp    1163 <main+0x43>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
je     1137 <main+0x17>
mov    %ebx,%ecx
mov    %eax,%ebx
cmp    $0x20,%ecx
jne    1150 <main+0x30>
cmp    $0x20,%ebx
je     1157 <main+0x37>
jmp    1150 <main+0x30>

LLVM IR (-O0):
@EOF = global i32 0
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %17, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %1
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %19
7: ; preds = %3
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 32
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 32
br i1 %12, label %13, label %14
13: ; preds = %10
br label %17
14: ; preds = %10, %7
%15 = load i32, i32* %1
%16 = call i32 @putchar(i32 %15)
br label %17
17: ; preds = %14, %13
%18 = load i32, i32* %1
store i32 %18, i32* %2
br label %3
19: ; preds = %3
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %16, label %4
4: ; preds = %0, %12
%5 = phi i32 [ %13, %12 ], [ %1, %0 ]
%6 = phi i32 [ %5, %12 ], [ 0, %0 ]
%7 = icmp eq i32 %5, 32
%8 = icmp eq i32 %6, 32
%9 = and i1 %8, %7
br i1 %9, label %12, label %10
10: ; preds = %4
%11 = tail call i32 @putchar(i32 %5)
br label %12
12: ; preds = %4, %10
%13 = tail call i32 (...) @getchar()
%14 = load i32, i32* @EOF
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %4
16: ; preds = %12, %0
ret void
}
/* Type definitions */
struct termios {
  int dummy;
};

/* Variables and functions */
int tcgetattr(int /*<<< orphan*/, struct termios *);
int termget(struct termios *tp) { return (tcgetattr(0, tp)); }


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

x86 assembly (clang, -O2):
<termget>:
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <tcgetattr@plt>

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

LLVM IR (-O2):
%struct.termios = type { i32 }
define i32 @termget(%struct.termios* %0) {
%2 = tail call i32 @tcgetattr(i32 0, %struct.termios* %0)
ret i32 %2
}
/* Variables and functions */
void *malloc(size_t const);
int /*<<< orphan*/ slick_fatal(char *, size_t const);
void *smalloc(const size_t bytes) {
  void *ptr = malloc(bytes);
  if (!ptr) {
    slick_fatal("out of memory (allocating %lu bytes)", bytes);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<smalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <smalloc+0x34>
mov    -0x8(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <slick_fatal@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <smalloc+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1030 <slick_fatal@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [37 x i8] c"out of memory (allocating %lu bytes)\00"
define i8* @smalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load i64, i64* %2
%10 = call i32 @slick_fatal(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %9)
br label %11
11: ; preds = %8, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [37 x i8] c"out of memory (allocating %lu bytes)\00"
define noalias i8* @smalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @slick_fatal(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %6
6: ; preds = %4, %1
ret i8* %2
}
void lir_excalibur_read(void) {}


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

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

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

LLVM IR (-O2):
define void @lir_excalibur_read() {
ret void
}
IR0AX1(r0, r1, x0, x1, p0, p1) char r0, r1;
char *p0, *p1;
{ (*p0) = (((char *)11111111)[x1]); }


x86 assembly (clang, -O0):
<IR0AX1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
movslq -0x10(%rbp),%rcx
mov    $0xa98ac7,%eax
mov    (%rax,%rcx,1),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IR0AX1>:
movslq %ecx,%rax
mov    0xa98ac7(%rax),%al
mov    %al,(%r8)
ret

LLVM IR (-O0):
define i32 @IR0AX1(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = trunc i32 %0 to i8
%15 = trunc i32 %1 to i8
store i8 %14, i8* %8
store i8 %15, i8* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i8* %5, i8** %13
%16 = load i32, i32* %11
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* inttoptr (i64 11111111 to i8*), i64 %17
%19 = load i8, i8* %18
%20 = load i8*, i8** %12
store i8 %19, i8* %20
%21 = load i32, i32* %7
ret i32 %21
}

LLVM IR (-O2):
define i32 @IR0AX1(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture writeonly %4, i8* nocapture readnone %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds i8, i8* inttoptr (i64 11111111 to i8*), i64 %7
%9 = load i8, i8* %8
store i8 %9, i8* %4
ret i32 undef
}
/* Variables and functions */
long long xor_ll(long long *, long long *);
long long intr_wrap_540(long long p1, long long p2) { return xor_ll(&p1, &p2); }


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

x86 assembly (clang, -O2):
<intr_wrap_540>:
sub    $0x18,%rsp
mov    %rdi,0x10(%rsp)
mov    %rsi,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <xor_ll@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i64 @intr_wrap_540(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = call i64 @xor_ll(i64* %3, i64* %4)
ret i64 %5
}

LLVM IR (-O2):
define i64 @intr_wrap_540(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = call i64 @xor_ll(i64* %3, i64* %4)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ posix_memalign;
int main(int argc, char *argv[]) {
  (void)argc;
  (void)argv;
  (void)posix_memalign;
  exit(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)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@posix_memalign = global i32 0
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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = load i32, i32* @posix_memalign
%9 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@posix_memalign = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int, int);
__attribute__((cold)) my_cold_memset(void *a, int b, int c) { memset(a, b, c); }


x86 assembly (clang, -O0):
<my_cold_memset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <memset@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_cold_memset>:
jmp    1030 <memset@plt>
cs nopw 0x0(%rax,%rax,1)
nop

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

LLVM IR (-O2):
define i32 @my_cold_memset(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @memset(i8* %0, i32 %1, i32 %2)
ret i32 undef
}
int SetSocketKeepAlive(const int fd __attribute__((__unused__)),
                       const int onoff __attribute__((__unused__))) {
  ;
  ;
  return (-1);
}


x86 assembly (clang, -O0):
<SetSocketKeepAlive>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @SetSocketKeepAlive(i32 %0, i32 %1) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ VDP_doDMAEx(unsigned char, unsigned long, unsigned short,
                               unsigned short, int);
void VDP_doDMA(unsigned char location, unsigned long from, unsigned short to,
               unsigned short len) {
  VDP_doDMAEx(location, from, to, len, 2);
}


x86 assembly (clang, -O0):
<VDP_doDMA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cx,%ax
mov    %dx,%cx
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %cx,-0x12(%rbp)
mov    %ax,-0x14(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rsi
mov    -0x12(%rbp),%ax
mov    $0x2,%r8d
movzbl %cl,%edi
movzwl %ax,%edx
movzwl -0x14(%rbp),%ecx
call   1030 <VDP_doDMAEx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VDP_doDMA>:
mov    $0x2,%r8d
jmp    1030 <VDP_doDMAEx@plt>

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

LLVM IR (-O2):
define void @VDP_doDMA(i8 zeroext %0, i64 %1, i16 zeroext %2, i16 zeroext %3) {
%5 = tail call i32 @VDP_doDMAEx(i8 zeroext %0, i64 %1, i16 zeroext %2, i16 zeroext %3, i32 2)
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
void set_uint16(char *buf, const uint16_t val) {
  buf[0] = (val >> 0) & 0xFF;
  buf[1] = (val >> 8) & 0xFF;
}


x86 assembly (clang, -O0):
<set_uint16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_uint16>:
mov    %si,(%rdi)
ret

LLVM IR (-O0):
define void @set_uint16(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 0
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i32, i32* %4
%12 = ashr i32 %11, 8
%13 = and i32 %12, 255
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
ret void
}

LLVM IR (-O2):
define void @set_uint16(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
store i8 %3, i8* %0
%4 = lshr i32 %1, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
scalar_t__ read(int, void *, size_t);
uint8_t bool_read(int fd, void *array, size_t n) {
  return read(fd, array, n) < 0 ? 0 : 1;
}


x86 assembly (clang, -O0):
<bool_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <read@plt>
mov    %rax,%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovl  %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bool_read>:
push   %rax
call   1030 <read@plt>
shr    $0x3f,%rax
xor    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @bool_read(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i64 @read(i32 %7, i8* %8, i64 %9)
%11 = icmp slt i64 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 0, i32 1
ret i32 %13
}

LLVM IR (-O2):
define i32 @bool_read(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i64 @read(i32 %0, i8* %1, i64 %2)
%5 = lshr i64 %4, 63
%6 = trunc i64 %5 to i32
%7 = xor i32 %6, 1
ret i32 %7
}
int test_imm_F5uint16_reg(unsigned short val) {
  return ((val) & (-0xF5 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_F5uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff0b,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_F5uint16_reg>:
test   $0xff0b,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_F5uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -245
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void erhoehe(int x[]) {
  x[0] = x[0] + 1;
  x[1] = x[1] + 3;
  x[2] = x[2] + 5;
}


x86 assembly (clang, -O0):
<erhoehe>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x3,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
add    $0x5,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<erhoehe>:
addl   $0x1,(%rdi)
addl   $0x3,0x4(%rdi)
addl   $0x5,0x8(%rdi)
ret

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

LLVM IR (-O2):
define void @erhoehe(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = add nsw i32 %2, 1
store i32 %3, i32* %0
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = add nsw i32 %5, 3
store i32 %6, i32* %4
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 5
store i32 %9, i32* %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int i, sn = 0;
  for (i = 1; i <= 8; i++) {
    sn = sn + (2);
  }
  assert(sn == 8 * (2) || sn == 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jg     114e <main+0x3e>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    $0x1,%al
cmpl   $0x10,-0xc(%rbp)
mov    %al,-0xd(%rbp)
je     1167 <main+0x57>
cmpl   $0x0,-0xc(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
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* %3
store i32 1, i32* %2
br label %4
4: ; preds = %10, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 8
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 2
store i32 %9, i32* %3
br label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %4
13: ; preds = %4
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 16
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 0
br label %19
19: ; preds = %16, %13
%20 = phi i1 [ true, %13 ], [ %18, %16 ]
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
extern void __set_64bit(unsigned long long *ptr, unsigned int low,
                        unsigned int high) {
  __asm__ __volatile__("\n1:\t"
                       "movl (%0), %%eax\n\t"
                       "movl 4(%0), %%edx\n\t"
                       "cmpxchg8b (%0)\n\t"
                       "jnz 1b"
                       :
                       : "D"(ptr), "b"(low), "c"(high)
                       : "ax", "dx", "memory");
}


x86 assembly (clang, -O0):
<__set_64bit>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%ebx
mov    -0x18(%rbp),%ecx
mov    (%rdi),%eax
mov    0x4(%rdi),%edx
cmpxchg8b (%rdi)
jne    1119 <__set_64bit+0x19>
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<__set_64bit>:
push   %rbx
mov    %edx,%ecx
mov    %esi,%ebx
mov    (%rdi),%eax
mov    0x4(%rdi),%edx
cmpxchg8b (%rdi)
jne    1105 <__set_64bit+0x5>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @__set_64bit(i64* %0, i32 %1, i32 %2) {
tail call void asm sideeffect "\0A1:\09movl ($0), %eax\0A\09movl 4($0), %edx\0A\09cmpxchg8b ($0)\0A\09jnz 1b", "{di},{bx},{cx},~{ax},~{dx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64* %0, i32 %1, i32 %2)
ret void
}
unsigned long long hash_pass(const char *str) {
  unsigned long long hash = 0;
  while (*str) {
    hash = hash * 101 + *str++;
  }
  return hash;
}


x86 assembly (clang, -O0):
<hash_pass>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1141 <hash_pass+0x41>
imul   $0x65,-0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <hash_pass+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_pass>:
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <hash_pass+0x27>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
imul   $0x65,%rax,%rdx
movsbq %cl,%rax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash_pass+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @hash_pass(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %3
br label %4
4: ; preds = %8, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %4
%9 = load i64, i64* %3
%10 = mul i64 %9, 101
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
%13 = load i8, i8* %11
%14 = sext i8 %13 to i64
%15 = add i64 %10, %14
store i64 %15, i64* %3
br label %4
16: ; preds = %4
%17 = load i64, i64* %3
ret i64 %17
}

LLVM IR (-O2):
define i64 @hash_pass(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i64 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = mul i64 %6, 101
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i64
%11 = add i64 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 0, %1 ], [ %11, %4 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ bignum_integer_length(int /*<<< orphan*/);
int /*<<< orphan*/ dpeek();
int /*<<< orphan*/ drepl(int /*<<< orphan*/);
int /*<<< orphan*/ tag_bignum(int /*<<< orphan*/);
int /*<<< orphan*/ untag_object(int /*<<< orphan*/);
void primitive_bignum_log2_impl(void) {
  drepl(tag_bignum(bignum_integer_length(untag_object(dpeek()))));
}


x86 assembly (clang, -O0):
<primitive_bignum_log2_impl>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <dpeek@plt>
mov    %eax,%edi
call   1040 <untag_object@plt>
mov    %eax,%edi
call   1060 <bignum_integer_length@plt>
mov    %eax,%edi
call   1070 <tag_bignum@plt>
mov    %eax,%edi
call   1050 <drepl@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<primitive_bignum_log2_impl>:
push   %rax
xor    %eax,%eax
call   1030 <dpeek@plt>
mov    %eax,%edi
call   1040 <untag_object@plt>
mov    %eax,%edi
call   1060 <bignum_integer_length@plt>
mov    %eax,%edi
call   1070 <tag_bignum@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <drepl@plt>

LLVM IR (-O0):
define void @primitive_bignum_log2_impl() {
%1 = call i32 (...) @dpeek()
%2 = call i32 @untag_object(i32 %1)
%3 = call i32 @bignum_integer_length(i32 %2)
%4 = call i32 @tag_bignum(i32 %3)
%5 = call i32 @drepl(i32 %4)
ret void
}

LLVM IR (-O2):
define void @primitive_bignum_log2_impl() {
%1 = tail call i32 (...) @dpeek()
%2 = tail call i32 @untag_object(i32 %1)
%3 = tail call i32 @bignum_integer_length(i32 %2)
%4 = tail call i32 @tag_bignum(i32 %3)
%5 = tail call i32 @drepl(i32 %4)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t ri_reg(uint32_t address) { return (address & 0xffff) >> 2; }


x86 assembly (clang, -O0):
<ri_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
sar    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ri_reg>:
mov    %edi,%eax
shr    $0x2,%eax
and    $0x3fff,%eax
ret

LLVM IR (-O0):
define i32 @ri_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 65535
%5 = ashr i32 %4, 2
ret i32 %5
}

LLVM IR (-O2):
define i32 @ri_reg(i32 %0) {
%2 = lshr i32 %0, 2
%3 = and i32 %2, 16383
ret i32 %3
}
/* Type definitions */
struct cxl_ioctl_start_work {
  int dummy;
};

/* Variables and functions */
struct cxl_ioctl_start_work *calloc(int, int);
struct cxl_ioctl_start_work *cxl_work_alloc(void) {
  return calloc(1, sizeof(struct cxl_ioctl_start_work));
}


x86 assembly (clang, -O0):
<cxl_work_alloc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cxl_work_alloc>:
mov    $0x1,%edi
mov    $0x4,%esi
jmp    1030 <calloc@plt>

LLVM IR (-O0):
%struct.cxl_ioctl_start_work = type { i32 }
define %struct.cxl_ioctl_start_work* @cxl_work_alloc() {
%1 = call %struct.cxl_ioctl_start_work* @calloc(i32 1, i32 4)
ret %struct.cxl_ioctl_start_work* %1
}

LLVM IR (-O2):
%struct.cxl_ioctl_start_work = type { i32 }
define noalias %struct.cxl_ioctl_start_work* @cxl_work_alloc() {
%1 = tail call %struct.cxl_ioctl_start_work* @calloc(i32 1, i32 4)
ret %struct.cxl_ioctl_start_work* %1
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int wait(int /*<<< orphan*/ *);
void INThandler(int sig) {
  pid_t pid;
  pid = wait(NULL);
  printf("PID %d killed\n", pid);
}


x86 assembly (clang, -O0):
<INThandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <wait@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<INThandler>:
push   %rax
xor    %edi,%edi
call   1040 <wait@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"PID %d killed\0A\00"
define void @INThandler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @wait(i32* null)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"PID %d killed\0A\00"
define void @INThandler(i32 %0) {
%2 = tail call i32 @wait(i32* null)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_sys_cfg_rts_threshold_usage(void) {
  printf("\nUsage : sys_cfg_rts_threshold [RTS_THRESHOLD]\n");
  printf("\nIf RTS_THRESHOLD is provided, a 'set' is performed, else a 'get' "
         "is performed.\n");
  return;
}


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

x86 assembly (clang, -O2):
<print_sys_cfg_rts_threshold_usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0b(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"\0AUsage : sys_cfg_rts_threshold [RTS_THRESHOLD]\0A\00"
@.str.1 = [81 x i8] c"\0AIf RTS_THRESHOLD is provided, a 'set' is performed, else a 'get' is performed.\0A\00"
define void @print_sys_cfg_rts_threshold_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [47 x i8] c"\0AUsage : sys_cfg_rts_threshold [RTS_THRESHOLD]\00"
@str.2 = [80 x i8] c"\0AIf RTS_THRESHOLD is provided, a 'set' is performed, else a 'get' is performed.\00"
define void @print_sys_cfg_rts_threshold_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int is_hangul_tpart(int32_t code) {
  return (0x11A7 < code && code < 0x11A7 + 28);
}


x86 assembly (clang, -O0):
<is_hangul_tpart>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    $0x11a7,%ecx
cmp    -0x4(%rbp),%ecx
mov    %al,-0x5(%rbp)
jge    1127 <is_hangul_tpart+0x27>
cmpl   $0x11c3,-0x4(%rbp)
setl   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_hangul_tpart>:
add    $0xffffee58,%edi
xor    %eax,%eax
cmp    $0x1b,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @is_hangul_tpart(i32 %0) {
%2 = add i32 %0, -4520
%3 = icmp ult i32 %2, 27
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ swap(char *, int, int);
void reverse(char s[], int left, int right) {
  if (left >= right)
    return;
  swap(s, left, right);
  reverse(s, ++left, --right);
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1143 <reverse+0x23>
jmp    116d <reverse+0x4d>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <swap@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0xc(%rbp)
mov    -0x10(%rbp),%edx
add    $0xffffffff,%edx
mov    %edx,-0x10(%rbp)
call   1030 <reverse@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %rbp
push   %r14
push   %rbx
cmp    %edx,%esi
jge    1136 <reverse+0x26>
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
nop
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <swap@plt>
add    $0x1,%ebp
add    $0xffffffff,%ebx
cmp    %ebx,%ebp
jl     1120 <reverse+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @reverse(i8* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %12
5: ; preds = %3, %5
%6 = phi i32 [ %10, %5 ], [ %2, %3 ]
%7 = phi i32 [ %9, %5 ], [ %1, %3 ]
%8 = tail call i32 @swap(i8* %0, i32 %7, i32 %6)
%9 = add nsw i32 %7, 1
%10 = add nsw i32 %6, -1
%11 = icmp slt i32 %9, %10
br i1 %11, label %5, label %12
12: ; preds = %5, %3
ret void
}
/* Type definitions */
struct dirent64 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __NR_getdents64;
int syscall(int /*<<< orphan*/, int, struct dirent64 *, size_t);
int getdents64(int fd, struct dirent64 *dirp, size_t count) {
  return syscall(__NR_getdents64, fd, dirp, count);
}


x86 assembly (clang, -O0):
<getdents64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getdents64>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.dirent64 = type { i32 }
@__NR_getdents64 = global i32 0
define i32 @getdents64(i32 %0, %struct.dirent64* %1, i64 %2) {
%4 = alloca i32
%5 = alloca %struct.dirent64*
%6 = alloca i64
store i32 %0, i32* %4
store %struct.dirent64* %1, %struct.dirent64** %5
store i64 %2, i64* %6
%7 = load i32, i32* @__NR_getdents64
%8 = load i32, i32* %4
%9 = load %struct.dirent64*, %struct.dirent64** %5
%10 = load i64, i64* %6
%11 = call i32 @syscall(i32 %7, i32 %8, %struct.dirent64* %9, i64 %10)
ret i32 %11
}

LLVM IR (-O2):
%struct.dirent64 = type { i32 }
@__NR_getdents64 = global i32 0
define i32 @getdents64(i32 %0, %struct.dirent64* %1, i64 %2) {
%4 = load i32, i32* @__NR_getdents64
%5 = tail call i32 @syscall(i32 %4, i32 %0, %struct.dirent64* %1, i64 %2)
ret i32 %5
}
unsigned GetFieldW16(unsigned *A, register unsigned index) {
  register unsigned i = index / 2, j = (index & 1) << 4, result;
  result = (A[i] << (16 - j)) >> (16);
  return result;
}


x86 assembly (clang, -O0):
<GetFieldW16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
shl    $0x4,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    $0x10,%ecx
sub    -0x14(%rbp),%ecx
shl    %cl,%eax
shr    $0x10,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetFieldW16>:
mov    %esi,%ecx
mov    %esi,%eax
shr    %eax
shl    $0x4,%ecx
mov    (%rdi,%rax,4),%eax
not    %cl
and    $0x10,%cl
shl    %cl,%eax
shr    $0x10,%eax
ret

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

LLVM IR (-O2):
define i32 @GetFieldW16(i32* nocapture %0, i32 %1) {
%3 = lshr i32 %1, 1
%4 = shl i32 %1, 4
%5 = zext i32 %3 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = and i32 %4, 16
%9 = xor i32 %8, 16
%10 = shl i32 %7, %9
%11 = lshr i32 %10, 16
ret i32 %11
}
int ltdf2(double a, double b) { return a < b; }


x86 assembly (clang, -O0):
<ltdf2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltdf2>:
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
ret

LLVM IR (-O0):
define i32 @ltdf2(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp olt double %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @ltdf2(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ lst_remove(void *, int /*<<< orphan*/);
int lst_size(void *);
void lst_destroy(void *lst) {
  int count = lst_size(lst);
LOOP:
  if (count) {
    lst_remove(lst, count--);
    goto LOOP;
  }
  free(lst);
  return;
}


x86 assembly (clang, -O0):
<lst_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <lst_size@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     116b <lst_destroy+0x3b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    %esi,%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
call   1050 <lst_remove@plt>
jmp    1148 <lst_destroy+0x18>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lst_destroy>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <lst_size@plt>
test   %eax,%eax
je     115f <lst_destroy+0x2f>
mov    %eax,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <lst_remove@plt>
add    $0xffffffff,%ebp
jne    1150 <lst_destroy+0x20>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @lst_destroy(i8* %0) {
%2 = tail call i32 @lst_size(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %6, %4 ], [ %2, %1 ]
%6 = add nsw i32 %5, -1
%7 = tail call i32 @lst_remove(i8* %0, i32 %5)
%8 = icmp eq i32 %6, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %1
%10 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int *malloc(int);
int *alloc_1d_int(int ndim1) { return malloc(ndim1 * sizeof(int)); }


x86 assembly (clang, -O0):
<alloc_1d_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_1d_int>:
shl    $0x2,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i32* @alloc_1d_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = mul i64 %4, 4
%6 = trunc i64 %5 to i32
%7 = call i32* @malloc(i32 %6)
ret i32* %7
}

LLVM IR (-O2):
define noalias i32* @alloc_1d_int(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i32* @malloc(i32 %2)
ret i32* %3
}
/* Variables and functions */
int f(int, int);
int main() {
  int a = 0;
  int x;
  if (x < 0) {
    x = 0;
    a = f(x, a);
  } else {
    a = f(x, a);
  }
  a++;
  if (a < 3) {
  ERROR:
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    114a <main+0x3a>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <f@plt>
mov    %eax,-0x8(%rbp)
jmp    1158 <main+0x48>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <f@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    117c <main+0x6c>
jmp    1170 <main+0x60>
movl   $0xffffffff,-0x4(%rbp)
jmp    1183 <main+0x73>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1030 <f@plt>
xor    %ecx,%ecx
cmp    $0x2,%eax
setl   %cl
neg    %ecx
mov    %ecx,%eax
pop    %rcx
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
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %0
store i32 0, i32* %3
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = call i32 @f(i32 %7, i32 %8)
store i32 %9, i32* %2
br label %14
10: ; preds = %0
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = call i32 @f(i32 %11, i32 %12)
store i32 %13, i32* %2
br label %14
14: ; preds = %10, %6
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 3
br i1 %18, label %19, label %21
19: ; preds = %14
br label %20
20: ; preds = %19
store i32 -1, i32* %1
br label %22
21: ; preds = %14
store i32 0, i32* %1
br label %22
22: ; preds = %21, %20
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 0, i32 0)
%2 = icmp slt i32 %1, 2
%3 = sext i1 %2 to i32
ret i32 %3
}
int main(void) {
  int *b;
  int a = 1;
  b = b + a;
  b = b - a;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
unsigned int hash_func(const char *key, int maxSize) {
  unsigned int hashVal = 0;
  while (*key != '\0')
    hashVal = (hashVal << 5) + *key++;
  return hashVal % maxSize;
}


x86 assembly (clang, -O0):
<hash_func>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1144 <hash_func+0x44>
mov    -0x10(%rbp),%eax
shl    $0x5,%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <hash_func+0x12>
mov    -0x10(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_func>:
mov    (%rdi),%cl
test   %cl,%cl
je     1125 <hash_func+0x25>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
shl    $0x5,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash_func+0x10>
jmp    1127 <hash_func+0x27>
xor    %eax,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @hash_func(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i32 [ %12, %5 ], [ 0, %2 ]
%8 = phi i8* [ %11, %5 ], [ %0, %2 ]
%9 = sext i8 %6 to i32
%10 = shl i32 %7, 5
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = add i32 %10, %9
%13 = load i8, i8* %11
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %12, %5 ]
%17 = urem i32 %16, %1
ret i32 %17
}
/* Variables and functions */
char *nodename_to_filename_1(char *, int);
char *nodename_to_filename(char *nodename) {
  return nodename_to_filename_1(nodename, 1);
}


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

x86 assembly (clang, -O2):
<nodename_to_filename>:
mov    $0x1,%esi
jmp    1030 <nodename_to_filename_1@plt>

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

LLVM IR (-O2):
define i8* @nodename_to_filename(i8* %0) {
%2 = tail call i8* @nodename_to_filename_1(i8* %0, i32 1)
ret i8* %2
}
int ishex(int ch) {
  if ((ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f'))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<ishex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     111b <ishex+0x1b>
cmpl   $0x46,-0x8(%rbp)
jle    112f <ishex+0x2f>
cmpl   $0x61,-0x8(%rbp)
jl     113b <ishex+0x3b>
cmpl   $0x66,-0x8(%rbp)
jg     113b <ishex+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1142 <ishex+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ishex>:
and    $0xffffffdf,%edi
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x6,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ishex(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 70
br i1 %8, label %15, label %9
9: ; preds = %6, %1
%10 = load i32, i32* %3
%11 = icmp sge i32 %10, 97
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp sle i32 %13, 102
br i1 %14, label %15, label %16
15: ; preds = %12, %6
store i32 1, i32* %2
br label %17
16: ; preds = %12, %9
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @ishex(i32 %0) {
%2 = and i32 %0, -33
%3 = add i32 %2, -65
%4 = icmp ult i32 %3, 6
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int dbg_break(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @dbg_break() {
ret i32 1
}

LLVM IR (-O2):
define i32 @dbg_break() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
int main(void) {
  syslog(LOG_ERR, "%m");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <syslog@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@LOG_ERR = global i32 0
@.str = [3 x i8] c"%m\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @LOG_ERR
%3 = call i32 @syslog(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@LOG_ERR = global i32 0
@.str = [3 x i8] c"%m\00"
define i32 @main() {
%1 = load i32, i32* @LOG_ERR
%2 = tail call i32 @syslog(i32 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 0
}