xunge/DecIR huggingface dataset:
void mmm(int y) {
  if (y != 0)
    y++;
  y = y / y;
}


x86 assembly (clang, -O0):
<mmm>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     111a <mmm+0x1a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

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

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

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


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

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

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

LLVM IR (-O2):
define void @MMU_InvalidateTlbDatasEntry() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_OK;
int access(char const *, int /*<<< orphan*/);
int fileExists(const char *name) { return (access(name, F_OK) != -1) ? 1 : 0; }


x86 assembly (clang, -O0):
<fileExists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0xffffffff,%edx
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileExists>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@F_OK = global i32 0
define i32 @fileExists(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @F_OK
%5 = call i32 @access(i8* %3, i32 %4)
%6 = icmp ne i32 %5, -1
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 1, i32 0
ret i32 %8
}

LLVM IR (-O2):
@F_OK = global i32 0
define i32 @fileExists(i8* nocapture %0) {
%2 = load i32, i32* @F_OK
%3 = tail call i32 @access(i8* %0, i32 %2)
%4 = icmp ne i32 %3, -1
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int rj_readbyte(int);
int rj_readstat(void) { return rj_readbyte(0x00); }


x86 assembly (clang, -O0):
<rj_readstat>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <rj_readbyte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rj_readstat>:
xor    %edi,%edi
jmp    1030 <rj_readbyte@plt>

LLVM IR (-O0):
define i32 @rj_readstat() {
%1 = call i32 @rj_readbyte(i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @rj_readstat() {
%1 = tail call i32 @rj_readbyte(i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int);
char *convert_tty(int tty_nr) {
  static char buf[20];
  sprintf(buf, "%d:%d", (tty_nr & 0xff00) >> 8,
          (tty_nr & 0xff) | ((tty_nr & 0xfff00000) >> 20));
  return buf;
}


x86 assembly (clang, -O0):
<convert_tty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xff00,%edx
sar    $0x8,%edx
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
mov    -0x4(%rbp),%eax
and    $0xfff00000,%eax
shr    $0x14,%eax
or     %eax,%ecx
lea    0x2efc(%rip),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2ee9(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_tty>:
push   %rbx
mov    %edi,%eax
movzbl %ah,%edx
movzbl %al,%ecx
shr    $0x14,%eax
or     %eax,%ecx
lea    0x2f1b(%rip),%rbx
lea    0xed4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@convert_tty.buf = internal global [20 x i8] zeroinitializer
@.str = [6 x i8] c"%d:%d\00"
define i8* @convert_tty(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 65280
%5 = ashr i32 %4, 8
%6 = load i32, i32* %2
%7 = and i32 %6, 255
%8 = load i32, i32* %2
%9 = and i32 %8, -1048576
%10 = lshr i32 %9, 20
%11 = or i32 %7, %10
%12 = call i32 @sprintf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @convert_tty.buf, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %11)
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @convert_tty.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@convert_tty.buf = internal global [20 x i8] zeroinitializer
@.str = [6 x i8] c"%d:%d\00"
define i8* @convert_tty(i32 %0) {
%2 = lshr i32 %0, 8
%3 = and i32 %2, 255
%4 = and i32 %0, 255
%5 = lshr i32 %0, 20
%6 = or i32 %4, %5
%7 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @convert_tty.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %6)
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @convert_tty.buf, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ perror(char *);
int send(int, char *, int, int /*<<< orphan*/);
void *module_worker_thread(void *fd) {
  int sockfd = *(int *)fd;
  if (send(sockfd, "Hello, world!", 13, 0) == -1) {
    perror("send");
  }
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<module_worker_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    0xeb1(%rip),%rsi
mov    $0xd,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
cmp    $0xffffffff,%eax
jne    1170 <module_worker_thread+0x40>
lea    0xea3(%rip),%rdi
call   1050 <perror@plt>
mov    -0xc(%rbp),%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<module_worker_thread>:
push   %rbx
mov    (%rdi),%ebx
lea    0xec6(%rip),%rsi
mov    %ebx,%edi
mov    $0xd,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
cmp    $0xffffffff,%eax
je     1158 <module_worker_thread+0x28>
mov    %ebx,%edi
call   1040 <close@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xeaf(%rip),%rdi
call   1050 <perror@plt>
jmp    114d <module_worker_thread+0x1d>

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

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, world!\00"
@.str.1 = [5 x i8] c"send\00"
define noalias i8* @module_worker_thread(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @send(i32 %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 13, i32 0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = tail call i32 @close(i32 %3)
ret i8* null
}
void gbox_send_good_night(void) {}


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

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

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

LLVM IR (-O2):
define void @gbox_send_good_night() {
ret void
}
/* Variables and functions */
void abort();
void *realloc(void *, int /*<<< orphan*/);
int /*<<< orphan*/ size_mul(size_t, size_t);
void *xrealloc(void *p, size_t nmemb, size_t size) {
  p = realloc(p, size_mul(nmemb, size));
  (p ? (void)0 : abort());
  return p;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <size_mul@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1178 <xrealloc+0x48>
jmp    117d <xrealloc+0x4d>
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1040 <size_mul@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <realloc@plt>
test   %rax,%rax
je     1150 <xrealloc+0x20>
pop    %rbx
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @xrealloc(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = load i64, i64* %6
%10 = call i32 @size_mul(i64 %8, i64 %9)
%11 = call i8* @realloc(i8* %7, i32 %10)
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %15
14: ; preds = %3
br label %17
15: ; preds = %3
unreachable
16: ; No predecessors!
br label %17
17: ; preds = %16, %14
%18 = load i8*, i8** %4
ret i8* %18
}

LLVM IR (-O2):
define i8* @xrealloc(i8* %0, i64 %1, i64 %2) {
%4 = tail call i32 @size_mul(i64 %1, i64 %2)
%5 = tail call i8* @realloc(i8* %0, i32 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %3
tail call void @abort()
unreachable
8: ; preds = %3
ret i8* %5
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
unsigned int mgetvb(const uint8_t *data) {
  unsigned int value = 0;
  int len = 0;
  uint8_t c;
  do {
    c = data[len];
    value = (value << 7) | (c & 0x7F);
  } while (len < 4 && (c & 0x80) != 0);
  return value;
}


x86 assembly (clang, -O0):
<mgetvb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x7,%eax
mov    -0x14(%rbp),%ecx
and    $0x7f,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x4,-0x10(%rbp)
mov    %al,-0x15(%rbp)
jge    1155 <mgetvb+0x55>
mov    -0x14(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1116 <mgetvb+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mgetvb>:
mov    (%rdi),%ecx
mov    %ecx,%edx
and    $0x7f,%edx
xor    %eax,%eax
nopl   0x0(%rax)
shl    $0x7,%eax
or     %edx,%eax
test   $0x80,%cl
jne    1110 <mgetvb+0x10>
ret

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

LLVM IR (-O2):
define i32 @mgetvb(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 127
%4 = and i32 %2, 128
%5 = icmp eq i32 %4, 0
br label %6
6: ; preds = %6, %1
%7 = phi i32 [ 0, %1 ], [ %9, %6 ]
%8 = shl i32 %7, 7
%9 = or i32 %3, %8
br i1 %5, label %10, label %6
10: ; preds = %6
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t __fwrite(void const *, size_t, size_t, int /*<<< orphan*/ *);
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) {
  size_t ret = __fwrite(ptr, size, nmemb, stream);
  return ret;
}


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

x86 assembly (clang, -O2):
<fwrite>:
jmp    1030 <__fwrite@plt>

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

LLVM IR (-O2):
define i64 @fwrite(i8* %0, i64 %1, i64 %2, i32* %3) {
%5 = tail call i64 @__fwrite(i8* %0, i64 %1, i64 %2, i32* %3)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ pll_init(int);
void loc_set_clock(int clock_in_mhz) {
  if (clock_in_mhz >= 160 && clock_in_mhz <= 430) {
    pll_init(clock_in_mhz * 1000000);
  }
}


x86 assembly (clang, -O0):
<loc_set_clock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xa0,-0x4(%rbp)
jl     1141 <loc_set_clock+0x31>
cmpl   $0x1ae,-0x4(%rbp)
jg     1141 <loc_set_clock+0x31>
imul   $0xf4240,-0x4(%rbp),%edi
call   1030 <pll_init@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loc_set_clock>:
lea    -0xa0(%rdi),%eax
cmp    $0x10e,%eax
ja     1128 <loc_set_clock+0x18>
imul   $0xf4240,%edi,%edi
jmp    1030 <pll_init@plt>
ret

LLVM IR (-O0):
define void @loc_set_clock(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 160
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 430
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load i32, i32* %2
%10 = mul nsw i32 %9, 1000000
%11 = call i32 @pll_init(i32 %10)
br label %12
12: ; preds = %8, %5, %1
ret void
}

LLVM IR (-O2):
define void @loc_set_clock(i32 %0) {
%2 = add i32 %0, -160
%3 = icmp ult i32 %2, 271
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = mul nuw nsw i32 %0, 1000000
%6 = tail call i32 @pll_init(i32 %5)
br label %7
7: ; preds = %4, %1
ret void
}
/* Variables and functions */
scalar_t__ next_int();
float next_float() { return (float)next_int() / (1LL << 32); }


x86 assembly (clang, -O0):
<next_float>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <next_int@plt>
cvtsi2ss %rax,%xmm0
movss  0xed8(%rip),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_float>:
push   %rax
xor    %eax,%eax
call   1030 <next_int@plt>
cvtsi2ss %rax,%xmm0
mulss  0xedb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @next_float() {
%1 = call i64 (...) @next_int()
%2 = sitofp i64 %1 to float
%3 = fdiv float %2, 0x41F0000000000000
ret float %3
}

LLVM IR (-O2):
define float @next_float() {
%1 = tail call i64 (...) @next_int()
%2 = sitofp i64 %1 to float
%3 = fmul float %2, 0x3DF0000000000000
ret float %3
}
/* Variables and functions */
char *get_header(void *data, const char *h) {
  (void)data;
  (void)h;
  return NULL;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @get_header(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8* null
}
int __test() {
  int x = 3;
  int y = 0;
  switch (x) {
  case 1:
    y = 4;
    break;
  case 2:
    return 6;
  case 17:
  case 5:
    y = 42;
  default:
    y = 1337;
  }
  return y;
}


x86 assembly (clang, -O0):
<__test>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x10,%eax
ja     115a <__test+0x5a>
mov    -0x18(%rbp),%rax
lea    0xece(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x4,-0xc(%rbp)
jmp    1161 <__test+0x61>
movl   $0x6,-0x4(%rbp)
jmp    1167 <__test+0x67>
movl   $0x2a,-0xc(%rbp)
movl   $0x539,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @__test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 3, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
switch i32 %4, label %8 [
i32 1, label %5
i32 2, label %6
i32 17, label %7
i32 5, label %7
]
5: ; preds = %0
store i32 4, i32* %3
br label %9
6: ; preds = %0
store i32 6, i32* %1
br label %11
7: ; preds = %0, %0
store i32 42, i32* %3
br label %8
8: ; preds = %0, %7
store i32 1337, i32* %3
br label %9
9: ; preds = %8, %5
%10 = load i32, i32* %3
store i32 %10, i32* %1
br label %11
11: ; preds = %9, %6
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
define i32 @__test() {
ret i32 1337
}
int main() {
  if (0 ? 1 : 0)
    return 1;
  if (1 ? 0 : 1)
    return 2;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%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
store i32 0, i32* %1
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int test_imm_50int32_mem(int *val) {
  return ((*val) & (0x50 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_50int32_mem>:
testb  $0x50,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_50int32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 80
%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_50int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 80
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ cls_();
int /*<<< orphan*/ setpos(int /*<<< orphan*/, int /*<<< orphan*/);
void cls(void) {
  cls_();
  setpos(0, 0);
}


x86 assembly (clang, -O0):
<cls>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <cls_@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <setpos@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cls>:
push   %rax
xor    %eax,%eax
call   1030 <cls_@plt>
xor    %edi,%edi
xor    %esi,%esi
pop    %rax
jmp    1040 <setpos@plt>

LLVM IR (-O0):
define void @cls() {
%1 = call i32 (...) @cls_()
%2 = call i32 @setpos(i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @cls() {
%1 = tail call i32 (...) @cls_()
%2 = tail call i32 @setpos(i32 0, i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ set_pin(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
void io_invert_pin(uint8_t pin, uint8_t polarity) {
  set_pin(pin, polarity, 0x02, 0x03);
}


x86 assembly (clang, -O0):
<io_invert_pin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1030 <set_pin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_invert_pin>:
mov    $0x2,%edx
mov    $0x3,%ecx
jmp    1030 <set_pin@plt>

LLVM IR (-O0):
define void @io_invert_pin(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 = call i32 @set_pin(i32 %5, i32 %6, i32 2, i32 3)
ret void
}

LLVM IR (-O2):
define void @io_invert_pin(i32 %0, i32 %1) {
%3 = tail call i32 @set_pin(i32 %0, i32 %1, i32 2, i32 3)
ret void
}
int test_imm_03int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x03 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_03int64_midword_mem>:
testb  $0x3,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_03int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 196608
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int SDL_imageFilterBitAndMMX(unsigned char *Src1, unsigned char *Src2,
                             unsigned char *Dest, int length) {
  return (0);
}


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

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

LLVM IR (-O0):
define i32 @SDL_imageFilterBitAndMMX(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @SDL_imageFilterBitAndMMX(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i32 %3) {
ret i32 0
}
unsigned int l_near_pow_2(int n) {
  unsigned int i = 1;
  while (i < n)
    i <<= 1;
  return i ? i : n;
}


x86 assembly (clang, -O0):
<l_near_pow_2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1128 <l_near_pow_2+0x28>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <l_near_pow_2+0xe>
cmpl   $0x0,-0x8(%rbp)
je     113d <l_near_pow_2+0x3d>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <l_near_pow_2+0x43>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<l_near_pow_2>:
mov    %edi,%eax
mov    $0x1,%edx
nopw   0x0(%rax,%rax,1)
mov    %edx,%ecx
lea    (%rcx,%rcx,1),%edx
cmp    %eax,%ecx
jb     1110 <l_near_pow_2+0x10>
test   %ecx,%ecx
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @l_near_pow_2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp ult i32 %5, %6
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* %3
%10 = shl i32 %9, 1
store i32 %10, i32* %3
br label %4
11: ; preds = %4
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = load i32, i32* %3
br label %18
16: ; preds = %11
%17 = load i32, i32* %2
br label %18
18: ; preds = %16, %14
%19 = phi i32 [ %15, %14 ], [ %17, %16 ]
ret i32 %19
}

LLVM IR (-O2):
define i32 @l_near_pow_2(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %5, %2 ]
%4 = icmp ult i32 %3, %0
%5 = shl i32 %3, 1
br i1 %4, label %2, label %6
6: ; preds = %2
%7 = icmp eq i32 %3, 0
%8 = select i1 %7, i32 %0, i32 %3
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ SWAP(unsigned char *, unsigned char *);
void SWAP32(void *i_in) {
  unsigned char *inptr = (unsigned char *)i_in;
  SWAP(inptr, &inptr[3]);
  SWAP(&inptr[1], &inptr[2]);
}


x86 assembly (clang, -O0):
<SWAP32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x3,%rsi
call   1030 <SWAP@plt>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
add    $0x2,%rsi
call   1030 <SWAP@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SWAP32>:
push   %rbx
mov    %rdi,%rbx
lea    0x3(%rdi),%rsi
call   1030 <SWAP@plt>
lea    0x1(%rbx),%rdi
add    $0x2,%rbx
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <SWAP@plt>

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

LLVM IR (-O2):
define void @SWAP32(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = tail call i32 @SWAP(i8* %0, i8* %2)
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = tail call i32 @SWAP(i8* %4, i8* %5)
ret void
}
/* Variables and functions */
int LOG_NDELAY;
int LOG_PERROR;
int LOG_PID;
int /*<<< orphan*/ LOG_USER;
int /*<<< orphan*/ atexit(int /*<<< orphan*/);
int /*<<< orphan*/ closelog;
int /*<<< orphan*/ openlog(char *, int, int /*<<< orphan*/);
void helium_logging_start() {
  openlog("libhelium", LOG_PERROR | LOG_NDELAY | LOG_PID, LOG_USER);
  atexit(closelog);
}


x86 assembly (clang, -O0):
<helium_logging_start>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    0x2e84(%rip),%rax
or     (%rax),%esi
mov    0x2e8b(%rip),%rax
or     (%rax),%esi
mov    0x2ea2(%rip),%rax
mov    (%rax),%edx
lea    0xeb1(%rip),%rdi
call   1040 <openlog@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1170 <atexit>
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax

x86 assembly (clang, -O2):
<helium_logging_start>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    0x2e89(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e8e(%rip),%rax
or     (%rax),%esi
mov    0x2ea5(%rip),%rax
mov    (%rax),%edx
lea    0xeb4(%rip),%rdi
call   1040 <openlog@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1160 <atexit>

LLVM IR (-O0):
@.str = [10 x i8] c"libhelium\00"
@LOG_PERROR = global i32 0
@LOG_NDELAY = global i32 0
@LOG_PID = global i32 0
@LOG_USER = global i32 0
@closelog = global i32 0
define void @helium_logging_start() {
%1 = load i32, i32* @LOG_PERROR
%2 = load i32, i32* @LOG_NDELAY
%3 = or i32 %1, %2
%4 = load i32, i32* @LOG_PID
%5 = or i32 %3, %4
%6 = load i32, i32* @LOG_USER
%7 = call i32 @openlog(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i32, i32* @closelog
%9 = call i32 @atexit(i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"libhelium\00"
@LOG_PERROR = global i32 0
@LOG_NDELAY = global i32 0
@LOG_PID = global i32 0
@LOG_USER = global i32 0
@closelog = global i32 0
define void @helium_logging_start() {
%1 = load i32, i32* @LOG_PERROR
%2 = load i32, i32* @LOG_NDELAY
%3 = or i32 %2, %1
%4 = load i32, i32* @LOG_PID
%5 = or i32 %3, %4
%6 = load i32, i32* @LOG_USER
%7 = tail call i32 @openlog(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i32, i32* @closelog
%9 = tail call i32 @atexit(i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ol(char *);
m_inc() { ol("INC  AX"); }


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"INC AX\00"
define i32 @m_inc() {
%1 = tail call i32 @ol(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
int newton(int n, int k) {
  if (k == 0 || k == n)
    return 1;
  else
    return newton(n - 1, k - 1) + newton(n - 1, k);
}


x86 assembly (clang, -O0):
<newton>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1134 <newton+0x24>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1140 <newton+0x30>
movl   $0x1,-0x4(%rbp)
jmp    116c <newton+0x5c>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <newton@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
call   1030 <newton@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newton>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebp
test   %esi,%esi
je     1162 <newton+0x52>
mov    %esi,%r14d
mov    %edi,%ebx
cmp    %edi,%esi
je     1162 <newton+0x52>
lea    -0x1(%r14),%r15d
neg    %r14d
add    $0xffffffff,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
mov    %r15d,%esi
call   1030 <newton@plt>
add    %eax,%ebp
lea    (%r14,%rbx,1),%eax
add    $0xffffffff,%eax
mov    %ebx,%ecx
add    $0xffffffff,%ecx
mov    %ecx,%ebx
cmp    $0xffffffff,%eax
jne    1140 <newton+0x30>
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @newton(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = icmp eq i32 %1, %0
%5 = or i1 %3, %4
br i1 %5, label %17, label %6
6: ; preds = %2
%7 = add nsw i32 %1, -1
br label %8
8: ; preds = %6, %8
%9 = phi i32 [ %0, %6 ], [ %11, %8 ]
%10 = phi i32 [ 0, %6 ], [ %13, %8 ]
%11 = add nsw i32 %9, -1
%12 = tail call i32 @newton(i32 %11, i32 %7)
%13 = add nsw i32 %12, %10
%14 = icmp eq i32 %11, %1
br i1 %14, label %15, label %8
15: ; preds = %8
%16 = add i32 %13, 1
br label %17
17: ; preds = %15, %2
%18 = phi i32 [ 1, %2 ], [ %16, %15 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
long start();
int main() {
  long x = start();
  if (x != -1)
    printf("\nDifference : %u", x);
  else
    printf("Not found");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <start@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0xffffffffffffffff,-0x10(%rbp)
je     115c <main+0x3c>
mov    -0x10(%rbp),%rsi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    116a <main+0x4a>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <start@plt>
cmp    $0xffffffffffffffff,%rax
je     1141 <main+0x21>
lea    0xecb(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    114f <main+0x2f>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\0ADifference : %u\00"
@.str.1 = [10 x i8] c"Not found\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
%3 = call i64 (...) @start()
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = icmp ne i64 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load i64, i64* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %7)
br label %11
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"\0ADifference : %u\00"
@.str.1 = [10 x i8] c"Not found\00"
define i32 @main() {
%1 = tail call i64 (...) @start()
%2 = icmp eq i64 %1, -1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %1)
br label %7
5: ; preds = %0
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
ret i32 0
}
int isinff(float x) { return 0; }


x86 assembly (clang, -O0):
<isinff>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @isinff(float %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ reverse(char *);
int main(int argc, char **argv) {
  if (argc > 1) {
    reverse(argv[1]);
    printf("%s\n", argv[1]);
    return 0;
  }
  printf("Not enougth arguments\n");
  return 1;
}


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)
cmpl   $0x1,-0x8(%rbp)
jle    116f <main+0x4f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <reverse@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1184 <main+0x64>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jl     113a <main+0x1a>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1030 <reverse@plt>
mov    0x8(%rbx),%rdi
xor    %ebx,%ebx
jmp    1146 <main+0x26>
mov    $0x1,%ebx
lea    0xeba(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [23 x i8] c"Not enougth arguments\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @reverse(i8* %11)
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 0, i32* %3
br label %19
17: ; preds = %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %19
19: ; preds = %17, %8
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@str = [22 x i8] c"Not enougth arguments\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @reverse(i8* %6)
%8 = load i8*, i8** %5
br label %9
9: ; preds = %2, %4
%10 = phi i8* [ %8, %4 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0), %2 ]
%11 = phi i32 [ 0, %4 ], [ 1, %2 ]
%12 = tail call i32 @puts(i8* dereferenceable(1) %10)
ret i32 %11
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  unsigned long A;
  unsigned long B;
  unsigned long C;
  unsigned long D;
};
typedef TYPE_1__ MD5_CTX;

/* Variables and functions */
int /*<<< orphan*/ memset(TYPE_1__ *, int /*<<< orphan*/, int);
int MD5_Init(MD5_CTX *c) {
  memset(c, 0, sizeof(*c));
  c->A = (unsigned long)0x67452301L;
  c->B = (unsigned long)0xefcdab89L;
  c->C = (unsigned long)0x98badcfeL;
  c->D = (unsigned long)0x10325476L;
  return 1;
}


x86 assembly (clang, -O0):
<MD5_Init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rax
movq   $0x67452301,(%rax)
mov    -0x8(%rbp),%rax
mov    $0xefcdab89,%ecx
mov    %rcx,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    $0x98badcfe,%ecx
mov    %rcx,0x10(%rax)
mov    -0x8(%rbp),%rax
movq   $0x10325476,0x18(%rax)
10
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MD5_Init>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
movaps 0xed9(%rip),%xmm0
movups %xmm0,(%rbx)
movaps 0xedf(%rip),%xmm0
movups %xmm0,0x10(%rbx)
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i64, i64, i64, i64 }
define i32 @MD5_Init(%struct.TYPE_4__* %0) {
%2 = alloca %struct.TYPE_4__*
store %struct.TYPE_4__* %0, %struct.TYPE_4__** %2
%3 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%4 = call i32 @memset(%struct.TYPE_4__* %3, i32 0, i32 32)
%5 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%6 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %5, i32 0, i32 0
store i64 1732584193, i64* %6
%7 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 1
store i64 4023233417, i64* %8
%9 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%10 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %9, i32 0, i32 2
store i64 2562383102, i64* %10
%11 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%12 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %11, i32 0, i32 3
store i64 271733878, i64* %12
ret i32 1
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i64, i64, i64, i64 }
define i32 @MD5_Init(%struct.TYPE_4__* %0) {
%2 = tail call i32 @memset(%struct.TYPE_4__* %0, i32 0, i32 32)
%3 = bitcast %struct.TYPE_4__* %0 to <2 x i64>*
store <2 x i64> <i64 1732584193, i64 4023233417>, <2 x i64>* %3
%4 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 2
%5 = bitcast i64* %4 to <2 x i64>*
store <2 x i64> <i64 2562383102, i64 271733878>, <2 x i64>* %5
ret i32 1
}
/* Variables and functions */
scalar_t__ extern_const(int);
int __attribute__((no)) foo2(int n) {
  int ret = 0;
  int i;
  for (i = 0; i < n; i++)
    ret += extern_const(i);
  return ret;
}


x86 assembly (clang, -O0):
<foo2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1158 <foo2+0x48>
mov    -0xc(%rbp),%edi
call   1030 <extern_const@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1129 <foo2+0x19>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo2>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    1133 <foo2+0x23>
mov    %edi,%r14d
xor    %ebx,%ebx
xor    %ebp,%ebp
nop
mov    %ebx,%edi
call   1030 <extern_const@plt>
add    %eax,%ebp
add    $0x1,%ebx
cmp    %ebx,%r14d
jne    1120 <foo2+0x10>
jmp    1135 <foo2+0x25>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @foo2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %16, %1
%6 = load i32, i32* %4
%7 = load i32, i32* %2
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %19
9: ; preds = %5
%10 = load i32, i32* %4
%11 = call i64 @extern_const(i32 %10)
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = add nsw i64 %13, %11
%15 = trunc i64 %14 to i32
store i32 %15, i32* %3
br label %16
16: ; preds = %9
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %5
19: ; preds = %5
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @foo2(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %11
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ 0, %1 ]
%6 = tail call i64 @extern_const(i32 %4)
%7 = trunc i64 %6 to i32
%8 = add i32 %5, %7
%9 = add nuw nsw i32 %4, 1
%10 = icmp eq i32 %9, %0
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %12
}
void BreakCOM(int portnum) {}


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

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

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

LLVM IR (-O2):
define void @BreakCOM(i32 %0) {
ret void
}
/* Variables and functions */
int Get32(int);
int uart_is_receive_fifo_empty(void) {
  if ((Get32(0x20201018u) & (1 << 4)) != 0) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<uart_is_receive_fifo_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x20201018,%edi
call   1030 <Get32@plt>
and    $0x10,%eax
cmp    $0x0,%eax
je     113a <uart_is_receive_fifo_empty+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1141 <uart_is_receive_fifo_empty+0x31>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_is_receive_fifo_empty>:
push   %rax
mov    $0x20201018,%edi
call   1030 <Get32@plt>
xor    %ecx,%ecx
test   $0x10,%al
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @uart_is_receive_fifo_empty() {
%1 = tail call i32 @Get32(i32 538972184)
%2 = lshr i32 %1, 4
%3 = and i32 %2, 1
%4 = xor i32 %3, 1
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ bin;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
scalar_t__ system_checked(char *);
int bin_exists(const char *binary) {
  char bin[1024] = {0};
  snprintf(&bin[0], sizeof(bin), "type %s 1>/dev/null 2>/dev/null", binary);
  return (system_checked(bin) == 0);
}


x86 assembly (clang, -O0):
<bin_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x400,%esi
lea    0xe97(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x410(%rbp),%rdi
call   1050 <system_checked@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin_exists>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    $0x400,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xeaa(%rip),%rdx
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rbx,%rcx
call   1030 <snprintf@plt>
mov    %r14,%rdi
call   1050 <system_checked@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [32 x i8] c"type %s 1>/dev/null 2>/dev/null\00"
define i32 @bin_exists(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8]
store i8* %0, i8** %2
%4 = bitcast [1024 x i8]* %3 to i8*
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @snprintf(i8* %5, i32 1024, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = call i64 @system_checked(i8* %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
@.str = [32 x i8] c"type %s 1>/dev/null 2>/dev/null\00"
define i32 @bin_exists(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 1024, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i64 @system_checked(i8* %3)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ GPIODirModeSet(unsigned long, unsigned char, int);
int /*<<< orphan*/ GPIOPadConfigSet(unsigned long, unsigned char, int, int);
void GPIOPinTypeUSBDigital(unsigned long ulPort, unsigned char ucPins) {
  ;
  GPIODirModeSet(ulPort, ucPins, 0x00000002);
  GPIOPadConfigSet(ulPort, ucPins, 0x00000001, 0x00000008);
}


x86 assembly (clang, -O0):
<GPIOPinTypeUSBDigital>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%edx
movzbl -0x9(%rbp),%esi
call   1040 <GPIODirModeSet@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%edx
mov    $0x8,%ecx
movzbl -0x9(%rbp),%esi
call   1030 <GPIOPadConfigSet@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPIOPinTypeUSBDigital>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x2,%edx
call   1040 <GPIODirModeSet@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
mov    $0x8,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <GPIOPadConfigSet@plt>

LLVM IR (-O0):
define void @GPIOPinTypeUSBDigital(i64 %0, i8 zeroext %1) {
%3 = alloca i64
%4 = alloca i8
store i64 %0, i64* %3
store i8 %1, i8* %4
%5 = load i64, i64* %3
%6 = load i8, i8* %4
%7 = call i32 @GPIODirModeSet(i64 %5, i8 zeroext %6, i32 2)
%8 = load i64, i64* %3
%9 = load i8, i8* %4
%10 = call i32 @GPIOPadConfigSet(i64 %8, i8 zeroext %9, i32 1, i32 8)
ret void
}

LLVM IR (-O2):
define void @GPIOPinTypeUSBDigital(i64 %0, i8 zeroext %1) {
%3 = tail call i32 @GPIODirModeSet(i64 %0, i8 zeroext %1, i32 2)
%4 = tail call i32 @GPIOPadConfigSet(i64 %0, i8 zeroext %1, i32 1, i32 8)
ret void
}