xunge/DecIR huggingface dataset:
/* Variables and functions */
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
void error(char *str) {
  fprintf(stderr, "%s errno is %d\n", str, errno);
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    0x2e98(%rip),%rax
mov    (%rax),%ecx
lea    0xeb7(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    0x2ea4(%rip),%rax
mov    (%rax),%ecx
lea    0xec3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"%s errno is %d\0A\00"
@errno = global i32 0
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = load i32, i32* @errno
%6 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %5)
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"%s errno is %d\0A\00"
@errno = global i32 0
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = load i32, i32* @errno
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %3)
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int c_whence(char const **);
int c_command(const char **wp) { return (c_whence(wp)); }


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

x86 assembly (clang, -O2):
<c_command>:
jmp    1030 <c_whence@plt>

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

LLVM IR (-O2):
define i32 @c_command(i8** %0) {
%2 = tail call i32 @c_whence(i8** %0)
ret i32 %2
}
int emac2_ifinbroadcastpkts_set(unsigned int dev_id,
                                union emac2_ifinbroadcastpkts_u *value) {
  return 1;
}


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

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

LLVM IR (-O0):
%union.emac2_ifinbroadcastpkts_u = type opaque
define i32 @emac2_ifinbroadcastpkts_set(i32 %0, %union.emac2_ifinbroadcastpkts_u* %1) {
%3 = alloca i32
%4 = alloca %union.emac2_ifinbroadcastpkts_u*
store i32 %0, i32* %3
store %union.emac2_ifinbroadcastpkts_u* %1, %union.emac2_ifinbroadcastpkts_u** %4
ret i32 1
}

LLVM IR (-O2):
%union.emac2_ifinbroadcastpkts_u = type opaque
define i32 @emac2_ifinbroadcastpkts_set(i32 %0, %union.emac2_ifinbroadcastpkts_u* nocapture readnone %1) {
ret i32 1
}
/* Variables and functions */
scalar_t__ malloc(int);
int main() {
  int i = 10;
  char *x = (char *)malloc(i * sizeof(char));
  while (i--) {
    ++x;
    *x = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1165 <main+0x55>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
jmp    1139 <main+0x29>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1030 <malloc@plt>
movq   $0x0,0x1(%rax)
movw   $0x0,0x9(%rax)
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 10)
%2 = inttoptr i64 %1 to i8*
%3 = getelementptr i8, i8* %2, i64 1
ret i32 0
}
_Complex float test2(_Complex float f) {
  __asm__("" : "=r"(__real f));
  return f;
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
movlpd %xmm0,-0x10(%rbp)
mov    %eax,-0x10(%rbp)
movss  -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0x4(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
movd   %eax,%xmm1
movss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define <2 x float> @test2(<2 x float> %0) {
%2 = alloca { float, float }
%3 = alloca { float, float }
%4 = bitcast { float, float }* %3 to <2 x float>*
store <2 x float> %0, <2 x float>* %4
%5 = getelementptr inbounds { float, float }, { float, float }* %3, i32 0, i32 0
%6 = call float asm "", "=r,~{dirflag},~{fpsr},~{flags}"()
store float %6, float* %5
%7 = getelementptr inbounds { float, float }, { float, float }* %3, i32 0, i32 0
%8 = load float, float* %7
%9 = getelementptr inbounds { float, float }, { float, float }* %3, i32 0, i32 1
%10 = load float, float* %9
%11 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 0
%12 = getelementptr inbounds { float, float }, { float, float }* %2, i32 0, i32 1
store float %8, float* %11
store float %10, float* %12
%13 = bitcast { float, float }* %2 to <2 x float>*
%14 = load <2 x float>, <2 x float>* %13
ret <2 x float> %14
}

LLVM IR (-O2):
define <2 x float> @test2(<2 x float> %0) {
%2 = tail call float asm "", "=r,~{dirflag},~{fpsr},~{flags}"()
%3 = insertelement <2 x float> %0, float %2, i64 0
ret <2 x float> %3
}
void enable_button_interrupt(void) {
  (*(volatile unsigned long *)((0xE002C000))) =
      ((*(volatile unsigned long *)((0xE002C000))) & ~0x30000000) | 0x20000000;
  (*(volatile unsigned long *)(((0xFFFFF000) + 0x010))) = 0x8000;
}


x86 assembly (clang, -O0):
<enable_button_interrupt>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe002c000,%eax
mov    (%rax),%rcx
and    $0xffffffffcfffffff,%rcx
or     $0x20000000,%rcx
mov    $0xe002c000,%eax
mov    %rcx,(%rax)
mov    $0xfffff010,%eax
movq   $0x8000,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<enable_button_interrupt>:
mov    $0xe002c000,%eax
mov    $0xffffffffcfffffff,%rcx
and    (%rax),%rcx
or     $0x20000000,%rcx
mov    %rcx,(%rax)
movq   $0x8000,0x1ffd3010(%rax)
ret

LLVM IR (-O0):
define void @enable_button_interrupt() {
%1 = load volatile i64, i64* inttoptr (i64 3758276608 to i64*)
%2 = and i64 %1, -805306369
%3 = or i64 %2, 536870912
store volatile i64 %3, i64* inttoptr (i64 3758276608 to i64*)
store volatile i64 32768, i64* inttoptr (i64 4294963216 to i64*)
ret void
}

LLVM IR (-O2):
define void @enable_button_interrupt() {
%1 = load volatile i64, i64* inttoptr (i64 3758276608 to i64*)
%2 = and i64 %1, -805306369
%3 = or i64 %2, 536870912
store volatile i64 %3, i64* inttoptr (i64 3758276608 to i64*)
store volatile i64 32768, i64* inttoptr (i64 4294963216 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int, size_t);
void memset_wrap(void *trg, int ch, size_t n) { memset(trg, ch, n); }


x86 assembly (clang, -O0):
<memset_wrap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <memset@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memset_wrap>:
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define void @memset_wrap(i8* %0, i32 %1, i64 %2) {
%4 = tail call i32 @memset(i8* %0, i32 %1, i64 %2)
ret void
}
int max(x, y) { return x > y ? x : y; }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <max+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <max+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

LLVM IR (-O0):
define i32 @max(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 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ pipeCommands(int, char **);
int main(int ac, char *av[]) { exit(pipeCommands(ac, av)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <pipeCommands@plt>
mov    %eax,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @pipeCommands(i32 %6, i8** %7)
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @pipeCommands(i32 %0, i8** %1)
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ ld_nnmem_a();
void opcode_ea() { ld_nnmem_a(); }


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

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

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

LLVM IR (-O2):
define void @opcode_ea() {
%1 = tail call i32 (...) @ld_nnmem_a()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PinConfigSet(unsigned long, int, int);
int /*<<< orphan*/ PinModeSet(unsigned long, unsigned long);
void PinTypeUART(unsigned long ulPin, unsigned long ulPinMode) {
  PinModeSet(ulPin, ulPinMode);
  PinConfigSet(ulPin, 0x00000020, 0x00000000);
}


x86 assembly (clang, -O0):
<PinTypeUART>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <PinModeSet@plt>
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
xor    %edx,%edx
call   1040 <PinConfigSet@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PinTypeUART>:
push   %rbx
mov    %rdi,%rbx
call   1030 <PinModeSet@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
xor    %edx,%edx
pop    %rbx
jmp    1040 <PinConfigSet@plt>

LLVM IR (-O0):
define void @PinTypeUART(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = call i32 @PinModeSet(i64 %5, i64 %6)
%8 = load i64, i64* %3
%9 = call i32 @PinConfigSet(i64 %8, i32 32, i32 0)
ret void
}

LLVM IR (-O2):
define void @PinTypeUART(i64 %0, i64 %1) {
%3 = tail call i32 @PinModeSet(i64 %0, i64 %1)
%4 = tail call i32 @PinConfigSet(i64 %0, i32 32, i32 0)
ret void
}
/* Variables and functions */
void *decode16(void *, unsigned int *);
void *decode_kind(void *attrs, unsigned *kind, unsigned *version) {
  unsigned head;
  attrs = decode16(attrs, &head);
  *version = head & 0xfff;
  *kind = head >> 12;
  return attrs;
}


x86 assembly (clang, -O0):
<decode_kind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <decode16@plt>
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%ecx
and    $0xfff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
shr    $0xc,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_kind>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
lea    0x4(%rsp),%rsi
call   1030 <decode16@plt>
mov    0x4(%rsp),%ecx
mov    %ecx,%edx
and    $0xfff,%edx
mov    %edx,(%rbx)
shr    $0xc,%ecx
mov    %ecx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @decode_kind(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i8*, i8** %4
%9 = call i8* @decode16(i8* %8, i32* %7)
store i8* %9, i8** %4
%10 = load i32, i32* %7
%11 = and i32 %10, 4095
%12 = load i32*, i32** %6
store i32 %11, i32* %12
%13 = load i32, i32* %7
%14 = lshr i32 %13, 12
%15 = load i32*, i32** %5
store i32 %14, i32* %15
%16 = load i8*, i8** %4
ret i8* %16
}

LLVM IR (-O2):
define i8* @decode_kind(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i8* @decode16(i8* %0, i32* %4)
%7 = load i32, i32* %4
%8 = and i32 %7, 4095
store i32 %8, i32* %2
%9 = lshr i32 %7, 12
store i32 %9, i32* %1
ret i8* %6
}
void drawlocation(void) {}


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

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

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

LLVM IR (-O2):
define void @drawlocation() {
ret void
}
/* Type definitions */
struct mallinfo {
  int ordblks;
};

/* Variables and functions */
struct mallinfo mallinfo();
int /*<<< orphan*/ malloc_stats();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  struct mallinfo m;
  m = mallinfo();
  printf("free chunks: %d\n", m.ordblks);
  malloc_stats();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <mallinfo@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <malloc_stats@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <mallinfo@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <malloc_stats@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.mallinfo = type { i32 }
@.str = [17 x i8] c"free chunks: %d\0A\00"
define i32 @main() {
%1 = alloca %struct.mallinfo
%2 = alloca %struct.mallinfo
%3 = call i32 (...) @mallinfo()
%4 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %2, i32 0, i32 0
store i32 %3, i32* %4
%5 = bitcast %struct.mallinfo* %1 to i8*
%6 = bitcast %struct.mallinfo* %2 to i8*
%7 = getelementptr inbounds %struct.mallinfo, %struct.mallinfo* %1, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 (...) @malloc_stats()
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"free chunks: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @mallinfo()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @malloc_stats()
ret i32 0
}
int findFather(int index) { return (index - 1) / 2; }


x86 assembly (clang, -O0):
<findFather>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<findFather>:
mov    %edi,%eax
add    $0xffffffff,%eax
shr    $0x1f,%eax
add    %edi,%eax
add    $0xffffffff,%eax
sar    %eax
ret

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

LLVM IR (-O2):
define i32 @findFather(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = sdiv i32 %2, 2
ret i32 %3
}
int min3(int a, int b, int c) {
  if (a < b) {
    if (a < c)
      return a;
    else
      return c;
  } else {
    if (b < c)
      return b;
    else
      return c;
  }
}


x86 assembly (clang, -O0):
<min3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113b <min3+0x3b>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1130 <min3+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <min3+0x58>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <min3+0x58>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1152 <min3+0x52>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <min3+0x58>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min3>:
mov    %edx,%eax
cmp    %edx,%edi
cmovl  %edi,%eax
cmp    %esi,%eax
cmovge %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @min3(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %2
%5 = select i1 %4, i32 %0, i32 %2
%6 = icmp slt i32 %5, %1
%7 = select i1 %6, i32 %5, i32 %1
ret i32 %7
}
/* Variables and functions */
char *ecvt(double, int, int *, int *);
char *c_ecvt(double arg0, int arg1, int *arg2, int *arg3) {
  return ecvt(arg0, arg1, arg2, arg3);
}


x86 assembly (clang, -O0):
<c_ecvt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <ecvt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_ecvt>:
jmp    1030 <ecvt@plt>

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

LLVM IR (-O2):
define i8* @c_ecvt(double %0, i32 %1, i32* %2, i32* %3) {
%5 = tail call i8* @ecvt(double %0, i32 %1, i32* %2, i32* %3)
ret i8* %5
}
void init_add_mask_color_pt_funcs_c(void) {}


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

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

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

LLVM IR (-O2):
define void @init_add_mask_color_pt_funcs_c() {
ret void
}
int test_imm_69int32_mem(int *val) {
  return ((*val) & (0x69 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_69int32_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, 105
%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_69int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 105
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int sipserver_del(const char *ifname, const int ifindex,
                  const char *addrPlain) {
  return 0;
}


x86 assembly (clang, -O0):
<sipserver_del>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @sipserver_del(i8* nocapture readnone %0, i32 %1, i8* nocapture readnone %2) {
ret i32 0
}
void CRYPTO_get_ex_new_index(void) {}


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

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

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

LLVM IR (-O2):
define void @CRYPTO_get_ex_new_index() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ VIM_SIF_I2cReadByte(int, unsigned char *);
unsigned char CheckId_GC306(void) {
  unsigned char temp1;
  VIM_SIF_I2cReadByte(0x00, &temp1);
  if (temp1 == 0xD1) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<CheckId_GC306>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
cmp    $0xd1,%eax
jne    113b <CheckId_GC306+0x2b>
movb   $0x1,-0x1(%rbp)
jmp    113f <CheckId_GC306+0x2f>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckId_GC306>:
push   %rax
lea    0x7(%rsp),%rsi
xor    %edi,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
cmpb   $0xd1,0x7(%rsp)
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @CheckId_GC306() {
%1 = alloca i8
%2 = alloca i8
%3 = call i32 @VIM_SIF_I2cReadByte(i32 0, i8* %2)
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = icmp eq i32 %5, 209
br i1 %6, label %7, label %8
7: ; preds = %0
store i8 1, i8* %1
br label %9
8: ; preds = %0
store i8 0, i8* %1
br label %9
9: ; preds = %8, %7
%10 = load i8, i8* %1
ret i8 %10
}

LLVM IR (-O2):
define zeroext i8 @CheckId_GC306() {
%1 = alloca i8
%2 = call i32 @VIM_SIF_I2cReadByte(i32 0, i8* %1)
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, -47
%5 = zext i1 %4 to i8
ret i8 %5
}
int fnumToMilliHertz(unsigned int fnum, unsigned int block,
                     unsigned int conversionFactor) {
  return (1000ull * conversionFactor * fnum) >> (20 - block);
}


x86 assembly (clang, -O0):
<fnumToMilliHertz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   $0x3e8,%rax,%rax
mov    -0x4(%rbp),%ecx
imul   %rcx,%rax
mov    $0x14,%ecx
sub    -0x8(%rbp),%ecx
mov    %ecx,%ecx
shr    %cl,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnumToMilliHertz>:
mov    %edx,%eax
mov    %edi,%ecx
imul   %rax,%rcx
imul   $0x3e8,%rcx,%rax
mov    $0x14,%cl
sub    %sil,%cl
shr    %cl,%rax
ret

LLVM IR (-O0):
define i32 @fnumToMilliHertz(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = zext i32 %7 to i64
%9 = mul i64 1000, %8
%10 = load i32, i32* %4
%11 = zext i32 %10 to i64
%12 = mul i64 %9, %11
%13 = load i32, i32* %5
%14 = sub i32 20, %13
%15 = zext i32 %14 to i64
%16 = lshr i64 %12, %15
%17 = trunc i64 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @fnumToMilliHertz(i32 %0, i32 %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = zext i32 %0 to i64
%6 = mul nuw nsw i64 %5, 1000
%7 = mul i64 %6, %4
%8 = sub i32 20, %1
%9 = zext i32 %8 to i64
%10 = lshr i64 %7, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ fmt_100percent_8(char *);
int /*<<< orphan*/ printf(char *, char *);
void test2() {
  char pbuf[10] = {'\0'};
  fmt_100percent_8(pbuf);
  printf("pbuf=%s\n", pbuf);
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0xa(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <memset@plt>
lea    -0xa(%rbp),%rdi
call   1050 <fmt_100percent_8@plt>
lea    -0xa(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
push   %rbx
sub    $0x10,%rsp
movw   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <fmt_100percent_8@plt>
lea    0xeba(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"pbuf=%s\0A\00"
define void @test2() {
%1 = alloca [10 x i8]
%2 = bitcast [10 x i8]* %1 to i8*
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = call i32 @fmt_100percent_8(i8* %3)
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"pbuf=%s\0A\00"
define void @test2() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @fmt_100percent_8(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ displayBits(char);
void unpackCharacters(unsigned s) {
  unsigned tmp;
  char c1;
  char c2;
  tmp = s & 65280;
  tmp >>= 8;
  c1 = tmp;
  displayBits(c1);
  tmp = s & 255;
  c2 = tmp;
  displayBits(c2);
}


x86 assembly (clang, -O0):
<unpackCharacters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%edi
call   1030 <displayBits@plt>
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,-0xa(%rbp)
movsbl -0xa(%rbp),%edi
call   1030 <displayBits@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unpackCharacters>:
push   %rbx
mov    %edi,%ebx
mov    %edi,%eax
shr    $0x8,%eax
movsbl %al,%edi
call   1030 <displayBits@plt>
movsbl %bl,%edi
pop    %rbx
jmp    1030 <displayBits@plt>

LLVM IR (-O0):
define void @unpackCharacters(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = and i32 %6, 65280
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = lshr i32 %8, 8
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = trunc i32 %10 to i8
store i8 %11, i8* %4
%12 = load i8, i8* %4
%13 = call i32 @displayBits(i8 signext %12)
%14 = load i32, i32* %2
%15 = and i32 %14, 255
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = trunc i32 %16 to i8
store i8 %17, i8* %5
%18 = load i8, i8* %5
%19 = call i32 @displayBits(i8 signext %18)
ret void
}

LLVM IR (-O2):
define void @unpackCharacters(i32 %0) {
%2 = lshr i32 %0, 8
%3 = trunc i32 %2 to i8
%4 = tail call i32 @displayBits(i8 signext %3)
%5 = trunc i32 %0 to i8
%6 = tail call i32 @displayBits(i8 signext %5)
ret void
}
void rational_add(long double *x, long double *y, long double *z) {
  (*z) = (*x) + (*y);
}


x86 assembly (clang, -O0):
<rational_add>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
fldt   (%rax)
mov    -0x10(%rbp),%rax
fldt   (%rax)
faddp  %st,%st(1)
mov    -0x18(%rbp),%rax
fstpt  (%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rational_add>:
fldt   (%rdi)
fldt   (%rsi)
faddp  %st,%st(1)
fstpt  (%rdx)
ret

LLVM IR (-O0):
define void @rational_add(x86_fp80* %0, x86_fp80* %1, x86_fp80* %2) {
%4 = alloca x86_fp80*
%5 = alloca x86_fp80*
%6 = alloca x86_fp80*
store x86_fp80* %0, x86_fp80** %4
store x86_fp80* %1, x86_fp80** %5
store x86_fp80* %2, x86_fp80** %6
%7 = load x86_fp80*, x86_fp80** %4
%8 = load x86_fp80, x86_fp80* %7
%9 = load x86_fp80*, x86_fp80** %5
%10 = load x86_fp80, x86_fp80* %9
%11 = fadd x86_fp80 %8, %10
%12 = load x86_fp80*, x86_fp80** %6
store x86_fp80 %11, x86_fp80* %12
ret void
}

LLVM IR (-O2):
define void @rational_add(x86_fp80* nocapture %0, x86_fp80* nocapture %1, x86_fp80* nocapture writeonly %2) {
%4 = load x86_fp80, x86_fp80* %0
%5 = load x86_fp80, x86_fp80* %1
%6 = fadd x86_fp80 %4, %5
store x86_fp80 %6, x86_fp80* %2
ret void
}
/* Variables and functions */
void *calloc(size_t, size_t);
void *Ccalloc(size_t nelem, size_t elsize) { return calloc(nelem, elsize); }


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

x86 assembly (clang, -O2):
<Ccalloc>:
jmp    1030 <calloc@plt>

LLVM IR (-O0):
define i8* @Ccalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = call i8* @calloc(i64 %5, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @Ccalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
ret i8* %3
}
void fc2580_wait_msec(void *pTuner, int a) { return; }


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

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

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

LLVM IR (-O2):
define void @fc2580_wait_msec(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_tagstruct_put_proplist() {
  printf("NOT IMPLEMENTED:"
         "pa_tagstruct_put_proplist"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [43 x i8] c"NOT IMPLEMENTED:pa_tagstruct_put_proplist\0A\00"
define i32 @pa_tagstruct_put_proplist() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [42 x i8] c"NOT IMPLEMENTED:pa_tagstruct_put_proplist\00"
define i32 @pa_tagstruct_put_proplist() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Reez Patel\n512,UB\nChennai-602302\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [34 x i8] c"Reez Patel\0A512,UB\0AChennai-602302\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [33 x i8] c"Reez Patel\0A512,UB\0AChennai-602302\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void classic() { printf("Hello World\n"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World\0A\00"
define void @classic() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"Hello World\00"
define void @classic() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void *s_realloc(void *ptr, size_t size) {
  void *retval;
  retval = realloc(ptr, size);
  if (!retval) {
    fprintf(stderr, "Fatal system error : %s", strerror(errno));
    exit(-2);
  };
  return retval;
}


x86 assembly (clang, -O0):
<s_realloc>:
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 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a2 <s_realloc+0x62>
mov    0x2e6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xe6d(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xfffffffe,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_realloc>:
push   %rbx
call   1040 <realloc@plt>
test   %rax,%rax
je     114d <s_realloc+0xd>
pop    %rbx
ret
mov    0x2e8c(%rip),%rax
mov    (%rax),%ebx
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe95(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    $0xfffffffe,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Fatal system error : %s\00"
@errno = global i32 0
define i8* @s_realloc(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* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %17, label %11
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i32, i32* @errno
%14 = call i8* @strerror(i32 %13)
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 @exit(i32 -2)
unreachable
17: ; preds = %2
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Fatal system error : %s\00"
@errno = global i32 0
define noalias i8* @s_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i32, i32* @errno
%8 = tail call i8* @strerror(i32 %7)
%9 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 -2)
unreachable
11: ; preds = %2
ret i8* %3
}
unsigned long hashInt(unsigned long int x) {
  x = ((x >> 16) ^ x) * 0x45d9f3b;
  x = ((x >> 16) ^ x) * 0x45d9f3b;
  x = ((x >> 16) ^ x);
  return x;
}


x86 assembly (clang, -O0):
<hashInt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
xor    -0x8(%rbp),%rax
imul   $0x45d9f3b,%rax,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
xor    -0x8(%rbp),%rax
imul   $0x45d9f3b,%rax,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
xor    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashInt>:
mov    %rdi,%rax
shr    $0x10,%rax
xor    %rdi,%rax
imul   $0x45d9f3b,%rax,%rax
mov    %rax,%rcx
shr    $0x10,%rcx
xor    %rax,%rcx
imul   $0x45d9f3b,%rcx,%rcx
mov    %rcx,%rax
shr    $0x10,%rax
xor    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @hashInt(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = load i64, i64* %2
%6 = xor i64 %4, %5
%7 = mul i64 %6, 73244475
store i64 %7, i64* %2
%8 = load i64, i64* %2
%9 = lshr i64 %8, 16
%10 = load i64, i64* %2
%11 = xor i64 %9, %10
%12 = mul i64 %11, 73244475
store i64 %12, i64* %2
%13 = load i64, i64* %2
%14 = lshr i64 %13, 16
%15 = load i64, i64* %2
%16 = xor i64 %14, %15
store i64 %16, i64* %2
%17 = load i64, i64* %2
ret i64 %17
}

LLVM IR (-O2):
define i64 @hashInt(i64 %0) {
%2 = lshr i64 %0, 16
%3 = xor i64 %2, %0
%4 = mul i64 %3, 73244475
%5 = lshr i64 %4, 16
%6 = xor i64 %5, %4
%7 = mul i64 %6, 73244475
%8 = lshr i64 %7, 16
%9 = xor i64 %8, %7
ret i64 %9
}
void finalhousekeeping(void) { return; }


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

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

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

LLVM IR (-O2):
define void @finalhousekeeping() {
ret void
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ sleep(int);
int main() {
  int i;
  char *array;
  array = malloc(1024 * 1024 * 1024);
  for (i = 0; i < 1024 * 1024 * 1024; i += 1)
    array[i] = 'c';
  sleep(100011);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x40000000,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x40000000,-0x8(%rbp)
jge    116b <main+0x4b>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movb   $0x63,(%rax,%rcx,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <main+0x24>
mov    $0x186ab,%edi
call   1040 <sleep@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x186ab,%edi
call   1030 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i8* @malloc(i32 1073741824)
store i8* %4, i8** %3
store i32 0, i32* %2
br label %5
5: ; preds = %13, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 1073741824
br i1 %7, label %8, label %16
8: ; preds = %5
%9 = load i8*, i8** %3
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
store i8 99, i8* %12
br label %13
13: ; preds = %8
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %5
16: ; preds = %5
%17 = call i32 @sleep(i32 100011)
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @sleep(i32 100011)
ret i32 0
}
/* Type definitions */
typedef int uint32_t;
typedef int int8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void print_line_int8_t(uint32_t i, uint32_t j, int8_t v, int magma) {
  if (magma)
    printf("A[%u,%u]:=%d;\n", i, j, v);
  else
    printf("%u %u %d\n", i, j, v);
}


x86 assembly (clang, -O0):
<print_line_int8_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1148 <print_line_int8_t+0x38>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
jmp    115d <print_line_int8_t+0x4d>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_line_int8_t>:
mov    %edx,%eax
mov    %esi,%edx
mov    %edi,%esi
test   %ecx,%ecx
lea    0xef0(%rip),%rcx
lea    0xeda(%rip),%rdi
cmove  %rcx,%rdi
mov    %eax,%ecx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"A[%u,%u]:=%d;\0A\00"
@.str.1 = [10 x i8] c"%u %u %d\0A\00"
define void @print_line_int8_t(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %3, 0
%6 = select i1 %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0)
%7 = tail call i32 @printf(i8* %6, i32 %0, i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int has_valid_chars(char const *, char *);
int semver_is_alpha(const char *s) {
  return has_valid_chars(
      s, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
}


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

x86 assembly (clang, -O2):
<semver_is_alpha>:
lea    0xee9(%rip),%rsi
jmp    1030 <has_valid_chars@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
define i32 @semver_is_alpha(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @has_valid_chars(i8* %3, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
@.str = [53 x i8] c"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
define i32 @semver_is_alpha(i8* %0) {
%2 = tail call i32 @has_valid_chars(i8* %0, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fortune_cookie(char *);
int main(int argc, char const *argv[]) {
  char quote[] = "Please print this string!";
  fortune_cookie(quote);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xecd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeca(%rip),%ax
mov    %ax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <fortune_cookie@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movups 0xeef(%rip),%xmm0
movups %xmm0,0xa(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <fortune_cookie@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.quote = [26 x i8] c"Please print this string!\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [26 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [26 x i8]* %6 to i8*
%8 = getelementptr inbounds [26 x i8], [26 x i8]* %6, i64 0, i64 0
%9 = call i32 @fortune_cookie(i8* %8)
ret i32 0
}

LLVM IR (-O2):
@__const.main.quote = [26 x i8] c"Please print this string!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [26 x i8]
%4 = getelementptr inbounds [26 x i8], [26 x i8]* %3, i64 0, i64 0
%5 = call i32 @fortune_cookie(i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int print_version(void) {
  printf("iwc(1) - version %s\n", "0.1.3");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"iwc(1) - version %s\0A\00"
@.str.1 = [6 x i8] c"0.1.3\00"
define i32 @print_version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"iwc(1) - version %s\0A\00"
@.str.1 = [6 x i8] c"0.1.3\00"
define i32 @print_version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
int test_imm_17int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x17 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_17int64_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, 23
%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_17int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 1507328
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}