xunge/DecIR huggingface dataset:
/* Type definitions */
struct cpu {
  int dummy;
};

/* Variables and functions */
unsigned char cpu_get_r8(struct cpu *, int);
unsigned char cpu_get_h(struct cpu *cpu) { return cpu_get_r8(cpu, (7)); }


x86 assembly (clang, -O0):
<cpu_get_h>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x7,%esi
call   1030 <cpu_get_r8@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_get_h>:
mov    $0x7,%esi
jmp    1030 <cpu_get_r8@plt>

LLVM IR (-O0):
%struct.cpu = type { i32 }
define zeroext i8 @cpu_get_h(%struct.cpu* %0) {
%2 = alloca %struct.cpu*
store %struct.cpu* %0, %struct.cpu** %2
%3 = load %struct.cpu*, %struct.cpu** %2
%4 = call zeroext i8 @cpu_get_r8(%struct.cpu* %3, i32 7)
ret i8 %4
}

LLVM IR (-O2):
%struct.cpu = type { i32 }
define zeroext i8 @cpu_get_h(%struct.cpu* %0) {
%2 = tail call zeroext i8 @cpu_get_r8(%struct.cpu* %0, i32 7)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ TCIOFLUSH;
int /*<<< orphan*/ tcflush(int, int /*<<< orphan*/);
int write(int, void *, int);
int mwsp_write(int fd, void *data, int len) {
  tcflush(fd, TCIOFLUSH);
  int wrt = write(fd, data, len);
  if (wrt < 0) {
    return -2;
  }
  return wrt;
}


x86 assembly (clang, -O0):
<mwsp_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
call   1040 <tcflush@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    116b <mwsp_write+0x4b>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1171 <mwsp_write+0x51>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mwsp_write>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
call   1040 <tcflush@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <write@plt>
test   %eax,%eax
mov    $0xfffffffe,%ecx
cmovs  %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@TCIOFLUSH = global i32 0
define i32 @mwsp_write(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i32, i32* %5
%10 = load i32, i32* @TCIOFLUSH
%11 = call i32 @tcflush(i32 %9, i32 %10)
%12 = load i32, i32* %5
%13 = load i8*, i8** %6
%14 = load i32, i32* %7
%15 = call i32 @write(i32 %12, i8* %13, i32 %14)
store i32 %15, i32* %8
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %3
store i32 -2, i32* %4
br label %21
19: ; preds = %3
%20 = load i32, i32* %8
store i32 %20, i32* %4
br label %21
21: ; preds = %19, %18
%22 = load i32, i32* %4
ret i32 %22
}

LLVM IR (-O2):
@TCIOFLUSH = global i32 0
define i32 @mwsp_write(i32 %0, i8* nocapture %1, i32 %2) {
%4 = load i32, i32* @TCIOFLUSH
%5 = tail call i32 @tcflush(i32 %0, i32 %4)
%6 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
%7 = icmp slt i32 %6, 0
%8 = select i1 %7, i32 -2, i32 %6
ret i32 %8
}
int unlock(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @unlock() {
ret i32 0
}

LLVM IR (-O2):
define i32 @unlock() {
ret i32 0
}
int mul1(int a, int b) { return a * b; }


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

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

LLVM IR (-O0):
define i32 @mul1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = mul nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @mul1(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}
int d(int x, int y) {
  unsigned t = x & y;
  unsigned tt = x | y;
  tt = tt + 1;
  return t - tt;
}


x86 assembly (clang, -O0):
<d>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d>:
mov    %esi,%eax
and    %edi,%eax
or     %edi,%esi
not    %esi
add    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @d(i32 %0, i32 %1) {
%3 = and i32 %1, %0
%4 = or i32 %1, %0
%5 = xor i32 %4, -1
%6 = add i32 %3, %5
ret i32 %6
}
void RTLockValidatorClassCreateExV(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLockValidatorClassCreateExV() {
ret void
}
int x_log2w(int w) { return (((int)(sizeof(int) * 8)) - __builtin_clz(w)); }


x86 assembly (clang, -O0):
<x_log2w>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
bsr    %eax,%ecx
xor    $0x1f,%ecx
mov    $0x20,%eax
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_log2w>:
bsr    %edi,%eax
xor    $0xffffffe0,%eax
add    $0x21,%eax
ret

LLVM IR (-O0):
define i32 @x_log2w(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @llvm.ctlz.i32(i32 %3, i1 true)
%5 = sub nsw i32 32, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @x_log2w(i32 %0) {
%2 = tail call i32 @llvm.ctlz.i32(i32 %0, i1 true)
%3 = sub nuw nsw i32 32, %2
ret i32 %3
}
int foo(
    struct A { int x; } a, struct A b) {
  int f(char *x);
  struct A c;
  c.x = 43;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0x10(%rbp)
movl   $0x2b,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.A = type { i32 }
define i32 @foo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.A
%5 = alloca %struct.A
%6 = alloca %struct.A
%7 = getelementptr inbounds %struct.A, %struct.A* %4, i32 0, i32 0
store i32 %0, i32* %7
%8 = getelementptr inbounds %struct.A, %struct.A* %5, i32 0, i32 0
store i32 %1, i32* %8
%9 = getelementptr inbounds %struct.A, %struct.A* %6, i32 0, i32 0
store i32 43, i32* %9
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int getpid();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
void child_code(int delay) {
  printf("child %d here, will sleep for %d seconds\n", getpid(), delay);
  sleep(delay);
  printf("child done. abouut to exit\n");
  exit(17);
}


x86 assembly (clang, -O0):
<child_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
mov    -0x4(%rbp),%edx
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1060 <sleep@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x11,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<child_code>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xe9f(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
call   1070 <sleep@plt>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x11,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"child %d here, will sleep for %d seconds\0A\00"
@.str.1 = [28 x i8] c"child done. abouut to exit\0A\00"
define void @child_code(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @getpid()
%4 = load i32, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @sleep(i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @exit(i32 17)
unreachable
}

LLVM IR (-O2):
@.str = [42 x i8] c"child %d here, will sleep for %d seconds\0A\00"
@str = [27 x i8] c"child done. abouut to exit\00"
define void @child_code(i32 %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %0)
%4 = tail call i32 @sleep(i32 %0)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 17)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
void endGame() { endwin(); }


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

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

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

LLVM IR (-O2):
define void @endGame() {
%1 = tail call i32 (...) @endwin()
ret void
}
yyTerm(f) long f;
{ printf("%s", (const char *)f); }


x86 assembly (clang, -O0):
<yyTerm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yyTerm>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @yyTerm(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = inttoptr i64 %4 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @yyTerm(i64 %0) {
%2 = inttoptr i64 %0 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ delay_ms(int);
void delay_s(char d) {
  char i;
  for (i = 0; i < 10; i++) {
    delay_ms(100);
  }
}


x86 assembly (clang, -O0):
<delay_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0xa,%eax
jge    1146 <delay_s+0x36>
mov    $0x64,%edi
call   1030 <delay_ms@plt>
mov    -0x2(%rbp),%al
add    $0x1,%al
mov    %al,-0x2(%rbp)
jmp    1122 <delay_s+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay_s>:
push   %rax
mov    $0x64,%edi
call   1030 <delay_ms@plt>
mov    $0x64,%edi
call   1030 <delay_ms@plt>
mov    $0x64,%edi
call   1030 <delay_ms@plt>
mov    $0x64,%edi
call   1030 <delay_ms@plt>
mov    $0x64,%edi
call   1030 <delay_ms@plt>
mov    $0x64,%edi
call   1030 <delay_ms@plt>
mov    $0x64,%edi
call   1030 <delay_ms@plt>
mov    $0x64,%edi
call   1030 <delay_ms@plt>
mov    $0x64,%edi
call   1030 <delay_ms@plt>
mov    $0x64,%edi
pop    %rax
jmp    1030 <delay_ms@plt>

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

LLVM IR (-O2):
define void @delay_s(i8 signext %0) {
%2 = tail call i32 @delay_ms(i32 100)
%3 = tail call i32 @delay_ms(i32 100)
%4 = tail call i32 @delay_ms(i32 100)
%5 = tail call i32 @delay_ms(i32 100)
%6 = tail call i32 @delay_ms(i32 100)
%7 = tail call i32 @delay_ms(i32 100)
%8 = tail call i32 @delay_ms(i32 100)
%9 = tail call i32 @delay_ms(i32 100)
%10 = tail call i32 @delay_ms(i32 100)
%11 = tail call i32 @delay_ms(i32 100)
ret void
}
int test_imm_BBint64_highword_reg(long long val) {
  return ((val >> 32) & (0xBB << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_BBint64_highword_reg>:
movabs $0xbb00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_BBint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 187
%6 = icmp ne i64 %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_BBint64_highword_reg(i64 %0) {
%2 = and i64 %0, 803158884352
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct test {
  int dummy;
};

/* Variables and functions */
void priv_cred_cleanup(int asroot, int injail, struct test *test) {}


x86 assembly (clang, -O0):
<priv_cred_cleanup>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.test = type { i32 }
define void @priv_cred_cleanup(i32 %0, i32 %1, %struct.test* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.test*
store i32 %0, i32* %4
store i32 %1, i32* %5
store %struct.test* %2, %struct.test** %6
ret void
}

LLVM IR (-O2):
%struct.test = type { i32 }
define void @priv_cred_cleanup(i32 %0, i32 %1, %struct.test* nocapture %2) {
ret void
}
int test_imm_40uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x40 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_40uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 64
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
double log2f(float);
float log10f(float x) {
  double log10_2;
  return log10_2 * log2f(x);
}


x86 assembly (clang, -O0):
<log10f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <log2f@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log10f>:
push   %rax
call   1030 <log2f@plt>
movss  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @log10f(float %0) {
%2 = alloca float
%3 = alloca double
store float %0, float* %2
%4 = load double, double* %3
%5 = load float, float* %2
%6 = call double @log2f(float %5)
%7 = fmul double %4, %6
%8 = fptrunc double %7 to float
ret float %8
}

LLVM IR (-O2):
define float @log10f(float %0) {
%2 = tail call double @log2f(float %0)
ret float 0x7FF8000000000000
}
/* Variables and functions */
int /*<<< orphan*/ dead();
void test6() {
  switch (40) {
  case 1:
    dead();
    break;
  case 4: {
    dead();
    break;
  }
  }
}


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

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

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

LLVM IR (-O2):
define void @test6() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *, int);
int /*<<< orphan*/ output_byte(int);
void emit_fmul(int r) {
  assem_debug("fmul st%d", r);
  output_byte(0xd8);
  output_byte(0xc8 + r);
}


x86 assembly (clang, -O0):
<emit_fmul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0xd8,%edi
call   1040 <output_byte@plt>
mov    -0x4(%rbp),%edi
add    $0xc8,%edi
call   1040 <output_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fmul>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1030 <assem_debug@plt>
mov    $0xd8,%edi
call   1040 <output_byte@plt>
add    $0xc8,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1040 <output_byte@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"fmul st%d\00"
define void @emit_fmul(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @assem_debug(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @output_byte(i32 216)
%6 = load i32, i32* %2
%7 = add nsw i32 200, %6
%8 = call i32 @output_byte(i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"fmul st%d\00"
define void @emit_fmul(i32 %0) {
%2 = tail call i32 @assem_debug(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @output_byte(i32 216)
%4 = add nsw i32 %0, 200
%5 = tail call i32 @output_byte(i32 %4)
ret void
}
char *reg_token_advance(char *ptr, char *colname, char sep) {
  char *optr = colname;
  while (*ptr != sep && *ptr != '\0') {
    *optr++ = *ptr++;
  }
  *optr = '\0';
  return ptr;
}


x86 assembly (clang, -O0):
<reg_token_advance>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
movsbl -0x11(%rbp),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x21(%rbp)
je     1141 <reg_token_advance+0x41>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1151 <reg_token_advance+0x51>
jmp    1178 <reg_token_advance+0x78>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
jmp    1119 <reg_token_advance+0x19>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg_token_advance>:
mov    %rdi,%rax
mov    (%rdi),%cl
cmp    %dl,%cl
je     1126 <reg_token_advance+0x26>
nopl   0x0(%rax)
test   %cl,%cl
je     1126 <reg_token_advance+0x26>
mov    %cl,(%rsi)
add    $0x1,%rsi
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
cmp    %dl,%cl
jne    1110 <reg_token_advance+0x10>
movb   $0x0,(%rsi)
ret

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

LLVM IR (-O2):
define i8* @reg_token_advance(i8* %0, i8* nocapture writeonly %1, i8 signext %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, %2
%6 = icmp eq i8 %4, 0
%7 = or i1 %5, %6
br i1 %7, label %18, label %8
8: ; preds = %3, %8
%9 = phi i8 [ %14, %8 ], [ %4, %3 ]
%10 = phi i8* [ %13, %8 ], [ %1, %3 ]
%11 = phi i8* [ %12, %8 ], [ %0, %3 ]
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %9, i8* %10
%14 = load i8, i8* %12
%15 = icmp eq i8 %14, %2
%16 = icmp eq i8 %14, 0
%17 = or i1 %15, %16
br i1 %17, label %18, label %8
18: ; preds = %8, %3
%19 = phi i8* [ %0, %3 ], [ %12, %8 ]
%20 = phi i8* [ %1, %3 ], [ %13, %8 ]
store i8 0, i8* %20
ret i8* %19
}
/* Variables and functions */
double log10_rd(double);
double log10_ru(double);
double log10_rz(double x) {
  if (x > 1)
    return log10_rd(x);
  else
    return log10_ru(x);
}


x86 assembly (clang, -O0):
<log10_rz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xec6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1158 <log10_rz+0x38>
movsd  -0x10(%rbp),%xmm0
call   1030 <log10_rd@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1167 <log10_rz+0x47>
movsd  -0x10(%rbp),%xmm0
call   1040 <log10_ru@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log10_rz>:
ucomisd 0xed8(%rip),%xmm0
jbe    112f <log10_rz+0xf>
jmp    1030 <log10_rd@plt>
jmp    1040 <log10_ru@plt>

LLVM IR (-O0):
define double @log10_rz(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ogt double %4, 1.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load double, double* %3
%8 = call double @log10_rd(double %7)
store double %8, double* %2
br label %12
9: ; preds = %1
%10 = load double, double* %3
%11 = call double @log10_ru(double %10)
store double %11, double* %2
br label %12
12: ; preds = %9, %6
%13 = load double, double* %2
ret double %13
}

LLVM IR (-O2):
define double @log10_rz(double %0) {
%2 = fcmp ogt double %0, 1.000000e+00
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call double @log10_rd(double %0)
br label %7
5: ; preds = %1
%6 = tail call double @log10_ru(double %0)
br label %7
7: ; preds = %5, %3
%8 = phi double [ %4, %3 ], [ %6, %5 ]
ret double %8
}
/* Type definitions */
struct skynet_monitor {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct skynet_monitor *);
void skynet_monitor_delete(struct skynet_monitor *sm) { free(sm); }


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

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

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

LLVM IR (-O2):
%struct.skynet_monitor = type { i32 }
define void @skynet_monitor_delete(%struct.skynet_monitor* nocapture %0) {
%2 = tail call i32 @free(%struct.skynet_monitor* %0)
ret void
}
/* Variables and functions */
float sqrt(int);
float CircularEaseIn(float p) { return 1 - sqrt(1 - (p * p)); }


x86 assembly (clang, -O0):
<CircularEaseIn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm1,%xmm0
movss  0xec0(%rip),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movss  0xea8(%rip),%xmm0
subss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CircularEaseIn>:
push   %rax
mulss  %xmm0,%xmm0
movss  0xee3(%rip),%xmm1
subss  %xmm0,%xmm1
cvttss2si %xmm1,%edi
call   1030 <sqrt@plt>
movss  0xece(%rip),%xmm1
subss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @CircularEaseIn(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = fneg float %3
%6 = call float @llvm.fmuladd.f32(float %5, float %4, float 1.000000e+00)
%7 = fptosi float %6 to i32
%8 = call float @sqrt(i32 %7)
%9 = fsub float 1.000000e+00, %8
ret float %9
}

LLVM IR (-O2):
define float @CircularEaseIn(float %0) {
%2 = fneg float %0
%3 = tail call float @llvm.fmuladd.f32(float %2, float %0, float 1.000000e+00)
%4 = fptosi float %3 to i32
%5 = tail call float @sqrt(i32 %4)
%6 = fsub float 1.000000e+00, %5
ret float %6
}
int clickplc_exe_Connect2Upper_dec(unsigned char *stream, void *obj) {
  int encsize = 4;
  return (encsize);
}


x86 assembly (clang, -O0):
<clickplc_exe_Connect2Upper_dec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @clickplc_exe_Connect2Upper_dec(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 4
}
/* Type definitions */
typedef unsigned int uint8_t;

/* Variables and functions */
void spi_send_byte(uint8_t b) {
  (*(volatile uint8_t *)(void *)(0xfffee404)) = b;
  do {
  } while (
      !(!(!(((*(volatile uint8_t *)(void *)(0xfffee400))) & (1U << (7))))));
}


x86 assembly (clang, -O0):
<spi_send_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0xfffee404,%eax
mov    %ecx,(%rax)
jmp    1116 <spi_send_byte+0x16>
mov    $0xfffee400,%eax
mov    (%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
xor    $0xff,%al
test   $0x1,%al
jne    1111 <spi_send_byte+0x11>
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_send_byte>:
mov    $0xfffee400,%eax
mov    %edi,0x4(%rax)
nopl   0x0(%rax,%rax,1)
testl  $0x80,(%rax)
je     1110 <spi_send_byte+0x10>
ret

LLVM IR (-O0):
define void @spi_send_byte(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
store volatile i32 %3, i32* inttoptr (i64 4294894596 to i32*)
br label %4
4: ; preds = %5, %1
br label %5
5: ; preds = %4
%6 = load volatile i32, i32* inttoptr (i64 4294894592 to i32*)
%7 = and i32 %6, 128
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = xor i1 %9, true
%11 = xor i1 %10, true
br i1 %11, label %4, label %12
12: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @spi_send_byte(i32 %0) {
store volatile i32 %0, i32* inttoptr (i64 4294894596 to i32*)
br label %2
2: ; preds = %2, %1
%3 = load volatile i32, i32* inttoptr (i64 4294894592 to i32*)
%4 = and i32 %3, 128
%5 = icmp eq i32 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void command_text() {
  printf("Usage:\n");
  printf("       dhcp6r [-d] [-cu] [-cm <interface>] [-sm <interface>] "
         "[-su <address>] [-sf <interface>+<address>] \n");
  exit(1);
}


x86 assembly (clang, -O0):
<command_text>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<command_text>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [107 x i8] c" dhcp6r [-d] [-cu] [-cm <interface>] [-sm <interface>] [-su <address>] [-sf <interface>+<address>] \0A\00"
define void @command_text() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [7 x i8] c"Usage:\00"
@str.2 = [106 x i8] c" dhcp6r [-d] [-cu] [-cm <interface>] [-sm <interface>] [-su <address>] [-sf <interface>+<address>] \00"
define void @command_text() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([106 x i8], [106 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
void _farnspokel(unsigned long offset, unsigned long value) {
  __asm__ __volatile__(".byte 0x64\n"
                       "	movl %k0,(%k1)"
                       :
                       : "ri"(value), "r"(offset));
}


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

x86 assembly (clang, -O2):
<_farnspokel>:
mov    %esi,%fs:(%edi)
ret

LLVM IR (-O0):
define void @_farnspokel(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
ret void
}

LLVM IR (-O2):
define void @_farnspokel(i64 %0, i64 %1) {
tail call void asm sideeffect ".byte 0x64\0A\09movl ${0:k},(${1:k})", "ri,r,~{dirflag},~{fpsr},~{flags}"(i64 %1, i64 %0)
ret void
}
int test_imm_D2uint32_reg(unsigned int val) {
  return ((val) & (0xD2 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D2uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xd2,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_D2uint32_reg(i32 %0) {
%2 = and i32 %0, 210
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void write_str(int fd, char *str) { write(fd, str, strlen(str)); }


x86 assembly (clang, -O0):
<write_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_str>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @write_str(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @write(i32 %5, i8* %6, i32 %8)
ret void
}

LLVM IR (-O2):
define void @write_str(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %3)
ret void
}
int flip_sign(int current_state) {
  int new_state = 0;
  if (current_state != 1) {
    new_state = 1;
  } else {
    new_state = -1;
  }
  return new_state;
}


x86 assembly (clang, -O0):
<flip_sign>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
je     1124 <flip_sign+0x24>
movl   $0x1,-0x8(%rbp)
jmp    112b <flip_sign+0x2b>
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flip_sign>:
xor    %eax,%eax
cmp    $0x1,%edi
setne  %al
add    %eax,%eax
add    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @flip_sign(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i32 -1, i32 1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int listen(int, int);
int /*<<< orphan*/ perror(char *);
int listen_(int *sockfd) {
  int ret = listen(*sockfd, 10);
  if (-1 == ret) {
    perror("listen");
    exit(1);
  }
  return ret;
}


x86 assembly (clang, -O0):
<listen_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    $0xa,%esi
call   1030 <listen@plt>
mov    %eax,-0xc(%rbp)
mov    $0xffffffff,%eax
cmp    -0xc(%rbp),%eax
jne    1173 <listen_+0x43>
lea    0xe9c(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<listen_>:
push   %rax
mov    (%rdi),%edi
mov    $0xa,%esi
call   1030 <listen@plt>
cmp    $0xffffffff,%eax
je     1144 <listen_+0x14>
pop    %rcx
ret
lea    0xeb5(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"listen\00"
define i32 @listen_(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @listen(i32 %2, i32 10)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i32 %3
}
/* Variables and functions */
void *malloc(size_t);
void *alloc_mem(size_t s) { return malloc(s); }


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

x86 assembly (clang, -O2):
<alloc_mem>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @alloc_mem(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @malloc(i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define noalias i8* @alloc_mem(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
void OBJ_create(void) {}


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

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

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

LLVM IR (-O2):
define void @OBJ_create() {
ret void
}
void bfq_check_next_active(struct bfq_sched_data *sd,
                           struct bfq_entity *entity) {}


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

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

LLVM IR (-O0):
%struct.bfq_sched_data = type opaque
%struct.bfq_entity = type opaque
define void @bfq_check_next_active(%struct.bfq_sched_data* %0, %struct.bfq_entity* %1) {
%3 = alloca %struct.bfq_sched_data*
%4 = alloca %struct.bfq_entity*
store %struct.bfq_sched_data* %0, %struct.bfq_sched_data** %3
store %struct.bfq_entity* %1, %struct.bfq_entity** %4
ret void
}

LLVM IR (-O2):
%struct.bfq_sched_data = type opaque
%struct.bfq_entity = type opaque
define void @bfq_check_next_active(%struct.bfq_sched_data* nocapture %0, %struct.bfq_entity* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ read_u64(int /*<<< orphan*/ *);
int64_t read_64(FILE *stream) { return read_u64(stream); }


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

x86 assembly (clang, -O2):
<read_64>:
jmp    1030 <read_u64@plt>

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

LLVM IR (-O2):
define i32 @read_64(i32* %0) {
%2 = tail call i32 @read_u64(i32* %0)
ret i32 %2
}
void os_setSignalHandlers(void) {}


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

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

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

LLVM IR (-O2):
define void @os_setSignalHandlers() {
ret void
}
/* Variables and functions */
float pow(float, double);
float fresnel_schlick(float v_dot_h, float f0) {
  float base = 1.0 - v_dot_h;
  float exponential = pow(base, 5.0);
  return exponential + f0 * (1.0 - exponential);
}


x86 assembly (clang, -O0):
<fresnel_schlick>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xecd(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movsd  0xebb(%rip),%xmm1
call   1030 <pow@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm3
movsd  0xe86(%rip),%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fresnel_schlick>:
push   %rax
movss  %xmm1,0x4(%rsp)
movss  0xee1(%rip),%xmm2
subss  %xmm0,%xmm2
movsd  0xedd(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <pow@plt>
cvtss2sd %xmm0,%xmm0
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xec7(%rip),%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @fresnel_schlick(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %3
store float %1, float* %4
%7 = load float, float* %3
%8 = fpext float %7 to double
%9 = fsub double 1.000000e+00, %8
%10 = fptrunc double %9 to float
store float %10, float* %5
%11 = load float, float* %5
%12 = call float @pow(float %11, double 5.000000e+00)
store float %12, float* %6
%13 = load float, float* %6
%14 = fpext float %13 to double
%15 = load float, float* %4
%16 = fpext float %15 to double
%17 = load float, float* %6
%18 = fpext float %17 to double
%19 = fsub double 1.000000e+00, %18
%20 = call double @llvm.fmuladd.f64(double %16, double %19, double %14)
%21 = fptrunc double %20 to float
ret float %21
}

LLVM IR (-O2):
define float @fresnel_schlick(float %0, float %1) {
%3 = fsub float 1.000000e+00, %0
%4 = tail call float @pow(float %3, double 5.000000e+00)
%5 = fpext float %4 to double
%6 = fpext float %1 to double
%7 = fsub double 1.000000e+00, %5
%8 = tail call double @llvm.fmuladd.f64(double %6, double %7, double %5)
%9 = fptrunc double %8 to float
ret float %9
}
int maqc(int x) { return x * x; }


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

x86 assembly (clang, -O2):
<maqc>:
mov    %edi,%eax
imul   %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @maqc(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
void drop_root_privilege() {}


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

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

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

LLVM IR (-O2):
define void @drop_root_privilege() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printk(char *, void *, void *);
void print_ip_sym(unsigned long ip) {
  printk("[<%pP>] %pS\n", (void *)ip, (void *)ip);
}


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

x86 assembly (clang, -O2):
<print_ip_sym>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
mov    %rdx,%rsi
jmp    1030 <printk@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"[<%pP>] %pS\0A\00"
define void @print_ip_sym(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
%5 = load i64, i64* %2
%6 = inttoptr i64 %5 to i8*
%7 = call i32 @printk(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"[<%pP>] %pS\0A\00"
define void @print_ip_sym(i64 %0) {
%2 = inttoptr i64 %0 to i8*
%3 = tail call i32 @printk(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %2)
ret void
}
void system_part1_init() {}


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

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

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

LLVM IR (-O2):
define void @system_part1_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("Usage: twad [FILE] [HUNK]\n"
         "Retrieve hunk from specified .wad file.\n");
}


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

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

LLVM IR (-O0):
@.str = [67 x i8] c"Usage: twad [FILE] [HUNK]\0ARetrieve hunk from specified .wad file.\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [66 x i8] c"Usage: twad [FILE] [HUNK]\0ARetrieve hunk from specified .wad file.\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct SN_env {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SN_close_env(struct SN_env *);
extern void russian_KOI8_R_close_env(struct SN_env *z) { SN_close_env(z); }


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

x86 assembly (clang, -O2):
<russian_KOI8_R_close_env>:
jmp    1030 <SN_close_env@plt>

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

LLVM IR (-O2):
%struct.SN_env = type { i32 }
define void @russian_KOI8_R_close_env(%struct.SN_env* %0) {
%2 = tail call i32 @SN_close_env(%struct.SN_env* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
char *strndup(char const *, size_t);
char *xstrndup(const char *s, size_t n) {
  char *dup;
  dup = strndup(s, n);
  if (!dup)
    abort();
  return (dup);
}


x86 assembly (clang, -O0):
<xstrndup>:
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   1040 <strndup@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1153 <xstrndup+0x33>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrndup>:
push   %rax
call   1040 <strndup@plt>
test   %rax,%rax
je     112d <xstrndup+0xd>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define noalias i8* @xstrndup(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @strndup(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int length, width, board;
  scanf("%d%d", &length, &width);
  board = length * width;
  board /= 2;
  printf("%d", board);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

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