xunge/DecIR huggingface dataset:
/* Variables and functions */
int fls(int mask) {
  int bit;
  if (mask == 0)
    return (0);
  for (bit = 1; mask != 1; bit++)
    mask = (unsigned int)mask >> 1;
  return (bit);
}


x86 assembly (clang, -O0):
<fls>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <fls+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    114b <fls+0x4b>
movl   $0x1,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     1145 <fls+0x45>
mov    -0x8(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <fls+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fls>:
cmp    $0x2,%edi
jae    1108 <fls+0x8>
mov    %edi,%eax
ret
mov    $0x1,%eax
nopl   (%rax)
shr    %edi
add    $0x1,%eax
cmp    $0x1,%edi
jne    1110 <fls+0x10>
ret

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

LLVM IR (-O2):
define i32 @fls(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 1, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp eq i32 %6, 1
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ %0, %1 ], [ %7, %3 ]
ret i32 %10
}
int test_imm_54uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x54 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_54uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 84
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void print_error(const char *msg) { fprintf(stderr, "%s\n", msg); }


x86 assembly (clang, -O0):
<print_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_error>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @print_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @print_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int errno;
int symlink(char *, char *);
int create(char *path, char *target) {
  errno = 0;
  if (symlink(target, path) == -1) {
    return -errno;
  }
  return 0;
}


x86 assembly (clang, -O0):
<create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2eb9(%rip),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <symlink@plt>
cmp    $0xffffffff,%eax
jne    1156 <create+0x46>
xor    %eax,%eax
mov    0x2e94(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    115d <create+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create>:
push   %rbx
mov    %rdi,%rax
mov    0x2ec5(%rip),%rbx
movl   $0x0,(%rbx)
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <symlink@plt>
xor    %ecx,%ecx
sub    (%rbx),%ecx
xor    %edx,%edx
cmp    $0xffffffff,%eax
cmovne %edx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @create(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* @errno
%6 = load i8*, i8** %5
%7 = load i8*, i8** %4
%8 = call i32 @symlink(i8* %6, i8* %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* @errno
%12 = sub nsw i32 0, %11
store i32 %12, i32* %3
br label %14
13: ; preds = %2
store i32 0, i32* %3
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @create(i8* %0, i8* %1) {
store i32 0, i32* @errno
%3 = tail call i32 @symlink(i8* %1, i8* %0)
%4 = icmp eq i32 %3, -1
%5 = load i32, i32* @errno
%6 = sub nsw i32 0, %5
%7 = select i1 %4, i32 %6, i32 0
ret i32 %7
}
void outl(int port, unsigned int value) {
  __asm__ __volatile__("outl %0, %w1" : : "a"(value), "Nd"(port));
}


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

x86 assembly (clang, -O2):
<outl>:
mov    %esi,%eax
mov    %edi,%edx
out    %eax,(%dx)
ret

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

LLVM IR (-O2):
define void @outl(i32 %0, i32 %1) {
tail call void asm sideeffect "outl $0, ${1:w}", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %1, i32 %0)
ret void
}
char lc(char c) { return c >= 'A' && c <= 'Z' ? (c - 'A') + 'a' : c; }


x86 assembly (clang, -O0):
<lc>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1136 <lc+0x36>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     1136 <lc+0x36>
movsbl -0x1(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <lc+0x3d>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lc>:
lea    -0x41(%rdi),%eax
lea    0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @lc(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 90
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = sub nsw i32 %12, 65
%14 = add nsw i32 %13, 97
br label %18
15: ; preds = %6, %1
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
br label %18
18: ; preds = %15, %10
%19 = phi i32 [ %14, %10 ], [ %17, %15 ]
%20 = trunc i32 %19 to i8
ret i8 %20
}

LLVM IR (-O2):
define signext i8 @lc(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
void oem_pm8921_bms_detected_low_vol(int vol_mv) {}


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

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

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

LLVM IR (-O2):
define void @oem_pm8921_bms_detected_low_vol(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int N = 1;
  int i;
  for (i = 0; i < 50; i++) {
    N *= 2;
    printf("i = %d", i);
    printf(" N  = %d\n", N);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x32,-0xc(%rbp)
jge    116c <main+0x5c>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
xor    %ebp,%ebp
lea    0xedb(%rip),%r14
lea    0xedb(%rip),%r15
nopl   0x0(%rax)
add    %ebx,%ebx
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0x32,%ebp
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"i = %d\00"
@.str.1 = [10 x i8] c" N = %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %7, %1 ]
%3 = phi i32 [ 1, %0 ], [ %4, %1 ]
%4 = shl nsw i32 %3, 1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%7 = add nuw nsw i32 %2, 1
%8 = icmp eq i32 %7, 50
br i1 %8, label %9, label %1
9: ; preds = %1
ret i32 0
}
unsigned max(unsigned x, unsigned 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
jbe    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
cmova  %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 ugt 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 ugt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
__int128_t load2(int data) { return (__int128_t)data << 50; }


x86 assembly (clang, -O0):
<load2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x14(%rbp)
movslq -0x14(%rbp),%rcx
mov    %rcx,%rax
sar    $0x3f,%rax
shld   $0x32,%rcx,%rax
shl    $0x32,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<load2>:
movslq %edi,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
shld   $0x32,%rax,%rdx
shl    $0x32,%rax
ret

LLVM IR (-O0):
define { i64, i64 } @load2(i32 %0) {
%2 = alloca i128
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = sext i32 %4 to i128
%6 = shl i128 %5, 50
store i128 %6, i128* %2
%7 = bitcast i128* %2 to { i64, i64 }*
%8 = load { i64, i64 }, { i64, i64 }* %7
ret { i64, i64 } %8
}

LLVM IR (-O2):
define { i64, i64 } @load2(i32 %0) {
%2 = sext i32 %0 to i128
%3 = shl nsw i128 %2, 50
%4 = trunc i128 %3 to i64
%5 = lshr i128 %3, 64
%6 = trunc i128 %5 to i64
%7 = insertvalue { i64, i64 } poison, i64 %4, 0
%8 = insertvalue { i64, i64 } %7, i64 %6, 1
ret { i64, i64 } %8
}
int getMaxCharsIn32Bit() { return 11; }


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

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

LLVM IR (-O0):
define i32 @getMaxCharsIn32Bit() {
ret i32 11
}

LLVM IR (-O2):
define i32 @getMaxCharsIn32Bit() {
ret i32 11
}
void print_inst_RS_IM13_RD(char *mnemonic, int rs1, int im13, int rd) { ; }


x86 assembly (clang, -O0):
<print_inst_RS_IM13_RD>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @print_inst_RS_IM13_RD(i8* nocapture %0, i32 %1, i32 %2, i32 %3) {
ret void
}
void *GetMemory(unsigned long size) {
  void *ptr;
  unsigned long int *memid;
  ptr = malloc(size + sizeof(unsigned long int));
  if (!ptr) {
    return ((void *)0);
  }
  memid = (unsigned long int *)ptr;
  *memid = 0x12345678l;
  return (unsigned long int *)((char *)ptr + sizeof(unsigned long int));
}


x86 assembly (clang, -O0):
<GetMemory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1145 <GetMemory+0x35>
movq   $0x0,-0x8(%rbp)
jmp    1164 <GetMemory+0x54>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movq   $0x12345678,(%rax)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetMemory>:
push   %rax
add    $0x8,%rdi
call   1030 <malloc@plt>
test   %rax,%rax
je     112c <GetMemory+0x1c>
movq   $0x12345678,(%rax)
add    $0x8,%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define noalias i8* @GetMemory(i64 %0) {
%2 = add i64 %0, 8
%3 = tail call i8* @malloc(i64 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = bitcast i8* %3 to i64*
store i64 305419896, i64* %6
%7 = getelementptr inbounds i8, i8* %3, i64 8
br label %8
8: ; preds = %1, %5
%9 = phi i8* [ %7, %5 ], [ null, %1 ]
ret i8* %9
}
/* Variables and functions */
int doit(int /*<<< orphan*/);
int getch(void) { return doit(0); }


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

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

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

LLVM IR (-O2):
define i32 @getch() {
%1 = tail call i32 @doit(i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_convert_matrix(float **b, long nrl, long nrh, long ncl, long nch) {
  free((void *)(b + nrl - 1));
}


x86 assembly (clang, -O0):
<free_convert_matrix>:
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    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_convert_matrix>:
lea    (%rdi,%rsi,8),%rdi
add    $0xfffffffffffffff8,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_convert_matrix(float** %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca float**
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store float** %0, float*** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%11 = load float**, float*** %6
%12 = load i64, i64* %7
%13 = getelementptr inbounds float*, float** %11, i64 %12
%14 = getelementptr inbounds float*, float** %13, i64 -1
%15 = bitcast float** %14 to i8*
%16 = call i32 @free(i8* %15)
ret void
}

LLVM IR (-O2):
define void @free_convert_matrix(float** nocapture %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = getelementptr inbounds float*, float** %0, i64 %1
%7 = getelementptr inbounds float*, float** %6, i64 -1
%8 = bitcast float** %7 to i8*
%9 = tail call i32 @free(i8* %8)
ret void
}
unsigned int csum_fold(unsigned int sum) {
  __asm__("addl %1, %0\n"
          "adcl $0xffff, %0\n"
          : "=r"(sum)
          : "r"(sum << 16), "0"(sum & 0xffff0000));
  return (~sum) >> 16;
}


x86 assembly (clang, -O0):
<csum_fold>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
shl    $0x10,%ecx
mov    -0x4(%rbp),%eax
and    $0xffff0000,%eax
add    %ecx,%eax
adc    $0xffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
shr    $0x10,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<csum_fold>:
mov    %edi,%eax
mov    %edi,%ecx
shl    $0x10,%ecx
and    $0xffff0000,%eax
add    %ecx,%eax
adc    $0xffff,%eax
not    %eax
shr    $0x10,%eax
ret

LLVM IR (-O0):
define i32 @csum_fold(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 16
%5 = load i32, i32* %2
%6 = and i32 %5, -65536
%7 = call i32 asm "addl $1, $0\0Aadcl $$0xffff, $0\0A", "=r,r,0,~{dirflag},~{fpsr},~{flags}"(i32 %4, i32 %6)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = xor i32 %8, -1
%10 = lshr i32 %9, 16
ret i32 %10
}

LLVM IR (-O2):
define i32 @csum_fold(i32 %0) {
%2 = shl i32 %0, 16
%3 = and i32 %0, -65536
%4 = tail call i32 asm "addl $1, $0\0Aadcl $$0xffff, $0\0A", "=r,r,0,~{dirflag},~{fpsr},~{flags}"(i32 %2, i32 %3)
%5 = xor i32 %4, -1
%6 = lshr i32 %5, 16
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;
typedef int /*<<< orphan*/ cpu_set_t;

/* Variables and functions */
int sched_setaffinity(int /*<<< orphan*/, int, int /*<<< orphan*/ *);
void set_cpu_mask(pid_t pid, cpu_set_t *mask) {
  if (sched_setaffinity(pid, sizeof(cpu_set_t), mask) == -1) {
  }
}


x86 assembly (clang, -O0):
<set_cpu_mask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    $0x4,%esi
call   1030 <sched_setaffinity@plt>
cmp    $0xffffffff,%eax
jne    113e <set_cpu_mask+0x2e>
jmp    113e <set_cpu_mask+0x2e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_cpu_mask>:
mov    %rsi,%rdx
mov    $0x4,%esi
jmp    1030 <sched_setaffinity@plt>

LLVM IR (-O0):
define void @set_cpu_mask(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 @sched_setaffinity(i32 %5, i32 4, i32* %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %10
9: ; preds = %2
br label %10
10: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
define void @set_cpu_mask(i32 %0, i32* %1) {
%3 = tail call i32 @sched_setaffinity(i32 %0, i32 4, i32* %1)
ret void
}
void ftrace_syscall_exit(struct pt_regs *regs) {}


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

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

LLVM IR (-O0):
%struct.pt_regs = type opaque
define void @ftrace_syscall_exit(%struct.pt_regs* %0) {
%2 = alloca %struct.pt_regs*
store %struct.pt_regs* %0, %struct.pt_regs** %2
ret void
}

LLVM IR (-O2):
%struct.pt_regs = type opaque
define void @ftrace_syscall_exit(%struct.pt_regs* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strncpy(char *, char const *, int);
void populate_message(char *message, int buffersize) {
  const char *msg = "Hello!";
  strncpy(message, msg, buffersize - 1);
  message[buffersize - 1] = '\0';
}


x86 assembly (clang, -O0):
<populate_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<populate_message>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movslq %esi,%rbx
lea    -0x1(%rbx),%rdx
lea    0xedb(%rip),%rsi
call   1030 <strncpy@plt>
movb   $0x0,-0x1(%r14,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Hello!\00"
define void @populate_message(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = load i8*, i8** %3
%7 = load i8*, i8** %5
%8 = load i32, i32* %4
%9 = sub nsw i32 %8, 1
%10 = call i32 @strncpy(i8* %6, i8* %7, i32 %9)
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %11, i64 %14
store i8 0, i8* %15
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"Hello!\00"
define void @populate_message(i8* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = sext i32 %3 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 0, i8* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glClearColor(double, double, double, double);
int /*<<< orphan*/ glPointSize(double);
int /*<<< orphan*/ gluOrtho2D(int /*<<< orphan*/, int, int /*<<< orphan*/, int);
void myinit() {
  glClearColor(1.0, 1.0, 1.0, 1.0);
  glPointSize(2.0);
  gluOrtho2D(0, 499, 0, 499);
}


x86 assembly (clang, -O0):
<myinit>:
push   %rbp
mov    %rsp,%rbp
movsd  0xecc(%rip),%xmm3
movaps %xmm3,%xmm0
movaps %xmm3,%xmm1
movaps %xmm3,%xmm2
call   1030 <glClearColor@plt>
movsd  0xeae(%rip),%xmm0
call   1040 <glPointSize@plt>
xor    %edx,%edx
mov    $0x1f3,%ecx
mov    %edx,%edi
mov    %ecx,%esi
call   1050 <gluOrtho2D@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<myinit>:
push   %rax
movsd  0xec7(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
movaps %xmm0,%xmm3
call   1030 <glClearColor@plt>
movsd  0xeb9(%rip),%xmm0
call   1040 <glPointSize@plt>
xor    %edi,%edi
mov    $0x1f3,%esi
xor    %edx,%edx
mov    $0x1f3,%ecx
pop    %rax
jmp    1050 <gluOrtho2D@plt>

LLVM IR (-O0):
define void @myinit() {
%1 = call i32 @glClearColor(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
%2 = call i32 @glPointSize(double 2.000000e+00)
%3 = call i32 @gluOrtho2D(i32 0, i32 499, i32 0, i32 499)
ret void
}

LLVM IR (-O2):
define void @myinit() {
%1 = tail call i32 @glClearColor(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
%2 = tail call i32 @glPointSize(double 2.000000e+00)
%3 = tail call i32 @gluOrtho2D(i32 0, i32 499, i32 0, i32 499)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int /*<<< orphan*/);
int equal(const char *str1, const char *str2) {
  return strncmp(str1, str2, strlen(str1)) == 0;
}


x86 assembly (clang, -O0):
<equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equal>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @equal(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
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = call i64 @strncmp(i8* %5, i8* %6, i32 %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @equal(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
char *checkFlightInfos() { return "VOL 362 POWDER-AIRLINES - Peshawar 6h30"; }


x86 assembly (clang, -O0):
<checkFlightInfos>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkFlightInfos>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [40 x i8] c"VOL 362 POWDER-AIRLINES - Peshawar 6h30\00"
define i8* @checkFlightInfos() {
ret i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [40 x i8] c"VOL 362 POWDER-AIRLINES - Peshawar 6h30\00"
define i8* @checkFlightInfos() {
ret i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ HplMsp430Usart1P__Usart__disableIntr();
void Msp430UartP__0__Usart__disableIntr(void) {
  HplMsp430Usart1P__Usart__disableIntr();
}


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

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

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

LLVM IR (-O2):
define void @Msp430UartP__0__Usart__disableIntr() {
%1 = tail call i32 (...) @HplMsp430Usart1P__Usart__disableIntr()
ret void
}
int main(argc, argv)
int argc;
char **argv;
{
  scan_init();
  scan_print();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <scan_init@plt>
xor    %eax,%eax
call   1030 <scan_print@plt>
xor    %eax,%eax
pop    %rcx
ret

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 = call i32 (...) @scan_init()
%7 = call i32 (...) @scan_print()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @scan_init()
%4 = tail call i32 (...) @scan_print()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ little_endian_read_16(int /*<<< orphan*/ const *, int);
uint16_t sdp_event_query_attribute_byte_get_record_id(const uint8_t *event) {
  return little_endian_read_16(event, 2);
}


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

x86 assembly (clang, -O2):
<sdp_event_query_attribute_byte_get_record_id>:
mov    $0x2,%esi
jmp    1030 <little_endian_read_16@plt>

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

LLVM IR (-O2):
define i32 @sdp_event_query_attribute_byte_get_record_id(i32* %0) {
%2 = tail call i32 @little_endian_read_16(i32* %0, i32 2)
ret i32 %2
}
void matrixOutput() {}


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

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

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

LLVM IR (-O2):
define void @matrixOutput() {
ret void
}
void gtk_frame_get_label_widget() {}


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

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

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

LLVM IR (-O2):
define void @gtk_frame_get_label_widget() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void func2() {
  int i;
  if (i < 5) {
    printf("1\n");
  }
  printf("2\n");
  return;
}


x86 assembly (clang, -O0):
<func2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0x5,-0x4(%rbp)
jge    112e <func2+0x1e>
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"1\0A\00"
@.str.1 = [3 x i8] c"2\0A\00"
define void @func2() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = icmp slt i32 %2, 5
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [2 x i8] c"2\00"
define void @func2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void term_invert() { printf("\033[7m"); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[7m\00"
define void @term_invert() {
%1 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[7m\00"
define void @term_invert() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
int isatty(int file) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @isatty(i32 %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *argv0) {
  fprintf(stderr,
          "Usage: %s [-c count] [-d] -h hostname [-i interval] [-l]\n"
          "\t[-p port] [-r] [-s] \n",
          argv0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [80 x i8] c"Usage: %s [-c count] [-d] -h hostname [-i interval] [-l]\0A\09[-p port] [-r] [-s] \0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [80 x i8] c"Usage: %s [-c count] [-d] -h hostname [-i interval] [-l]\0A\09[-p port] [-r] [-s] \0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int wint_t;

/* Variables and functions */
int EOF;
int wctob(wint_t wc) { return (wc >= 0 && wc < 128) ? wc : EOF; }


x86 assembly (clang, -O0):
<wctob>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1129 <wctob+0x29>
cmpl   $0x80,-0x4(%rbp)
jge    1129 <wctob+0x29>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1135 <wctob+0x35>
mov    0x2eb8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wctob>:
mov    %edi,%eax
cmp    $0x80,%edi
jb     1113 <wctob+0x13>
mov    0x2ed7(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @wctob(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 128
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = load i32, i32* %2
br label %12
10: ; preds = %5, %1
%11 = load i32, i32* @EOF
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @wctob(i32 %0) {
%2 = icmp ult i32 %0, 128
%3 = load i32, i32* @EOF
%4 = select i1 %2, i32 %0, i32 %3
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ LCD_PutChar(char);
int LCD_PutCharStdio(char ch, FILE *fs) {
  (void)fs;
  LCD_PutChar(ch);
  return 1;
}


x86 assembly (clang, -O0):
<LCD_PutCharStdio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <LCD_PutChar@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD_PutCharStdio>:
push   %rax
call   1030 <LCD_PutChar@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @LCD_PutCharStdio(i8 signext %0, i32* nocapture readnone %1) {
%3 = tail call i32 @LCD_PutChar(i8 signext %0)
ret i32 1
}
/* Variables and functions */
int *ialsohaveareffunc(char);
scalar_t__ iamalsoareffunc(int volatile *);
__attribute__((no)) void nope2(char opt) {
  volatile int volatile *x = ialsohaveareffunc(opt);
  x += 0x7FFFFFFFFFFFFEEE;
  x += (int)iamalsoareffunc(x);
  return;
}


x86 assembly (clang, -O0):
<nope2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <ialsohaveareffunc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffbb8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <iamalsoareffunc@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nope2>:
push   %rax
call   1030 <ialsohaveareffunc@plt>
lea    -0x448(%rax),%rdi
pop    %rax
jmp    1040 <iamalsoareffunc@plt>

LLVM IR (-O0):
define void @nope2(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32*
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = call i32* @ialsohaveareffunc(i8 signext %4)
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 9223372036854775534
store i32* %7, i32** %3
%8 = load i32*, i32** %3
%9 = call i64 @iamalsoareffunc(i32* %8)
%10 = trunc i64 %9 to i32
%11 = load i32*, i32** %3
%12 = sext i32 %10 to i64
%13 = getelementptr inbounds i32, i32* %11, i64 %12
store i32* %13, i32** %3
ret void
}

LLVM IR (-O2):
define void @nope2(i8 signext %0) {
%2 = tail call i32* @ialsohaveareffunc(i8 signext %0)
%3 = getelementptr inbounds i32, i32* %2, i64 9223372036854775534
%4 = tail call i64 @iamalsoareffunc(i32* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init(long *, int);
int sum(long *, int, int);
f(int n) {
  long ar[3 * n];
  init(ar, sizeof ar / sizeof *ar);
  return sum(ar, sizeof ar, sizeof(long));
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    %ecx,%eax
lea    (%rax,%rax,2),%eax
mov    %rax,-0x20(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
shl    $0x3,%rax
shr    $0x3,%rax
mov    %eax,%esi
call   1040 <init@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%esi
mov    $0x8,%edx
call   1030 <sum@plt>
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
lea    (%rdi,%rdi,2),%esi
lea    0xf(,%rsi,8),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
shl    $0x3,%edi
lea    (%rdi,%rdi,2),%r14d
mov    %rbx,%rdi
call   1040 <init@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0x8,%edx
call   1030 <sum@plt>
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = mul nsw i32 3, %5
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i64, i64 %7
store i64 %7, i64* %4
%10 = mul nuw i64 8, %7
%11 = udiv i64 %10, 8
%12 = trunc i64 %11 to i32
%13 = call i32 @init(i64* %9, i32 %12)
%14 = mul nuw i64 8, %7
%15 = trunc i64 %14 to i32
%16 = call i32 @sum(i64* %9, i32 %15, i32 8)
%17 = load i8*, i8** %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = mul nsw i32 %0, 3
%3 = zext i32 %2 to i64
%4 = alloca i64, i64 %3
%5 = mul i32 %0, 24
%6 = call i32 @init(i64* %4, i32 %2)
%7 = call i32 @sum(i64* %4, i32 %5, i32 8)
ret i32 %7
}
/* Variables and functions */
unsigned int vsub2(int /*<<< orphan*/, unsigned int);
unsigned int vneg2(unsigned int a) { return vsub2(0, a); }


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

x86 assembly (clang, -O2):
<vneg2>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <vsub2@plt>

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

LLVM IR (-O2):
define i32 @vneg2(i32 %0) {
%2 = tail call i32 @vsub2(i32 0, i32 %0)
ret i32 %2
}
int test_imm_84uint16_mem(unsigned short *val) {
  return ((*val) & (-0x84 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_84uint16_mem>:
movzwl (%rdi),%eax
test   $0xff7c,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_84uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, -132
%7 = icmp ne i32 %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_84uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -132
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void RTDbgAsCreateF(void) {}


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

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

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

LLVM IR (-O2):
define void @RTDbgAsCreateF() {
ret void
}
void increment_PC(int *PC) { *PC = *PC + 1; }


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

x86 assembly (clang, -O2):
<increment_PC>:
addl   $0x1,(%rdi)
ret

LLVM IR (-O0):
define void @increment_PC(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1
%6 = load i32*, i32** %2
store i32 %5, i32* %6
ret void
}

LLVM IR (-O2):
define void @increment_PC(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = add nsw i32 %2, 1
store i32 %3, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
Fhalt() { exit(0); }


x86 assembly (clang, -O0):
<Fhalt>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

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

LLVM IR (-O0):
define i32 @Fhalt() {
%1 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @Fhalt() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ OAL_DELETE_SEMAPHORE();
int fc8150_spib_deinit(void *hDevice) {
  OAL_DELETE_SEMAPHORE();
  return 0;
}


x86 assembly (clang, -O0):
<fc8150_spib_deinit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <OAL_DELETE_SEMAPHORE@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fc8150_spib_deinit>:
push   %rax
xor    %eax,%eax
call   1030 <OAL_DELETE_SEMAPHORE@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @fc8150_spib_deinit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @OAL_DELETE_SEMAPHORE()
ret i32 0
}

LLVM IR (-O2):
define i32 @fc8150_spib_deinit(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @OAL_DELETE_SEMAPHORE()
ret i32 0
}
int dev_printer_read(struct dev_printer *printer) { return 0; }


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

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

LLVM IR (-O0):
%struct.dev_printer = type opaque
define i32 @dev_printer_read(%struct.dev_printer* %0) {
%2 = alloca %struct.dev_printer*
store %struct.dev_printer* %0, %struct.dev_printer** %2
ret i32 0
}

LLVM IR (-O2):
%struct.dev_printer = type opaque
define i32 @dev_printer_read(%struct.dev_printer* nocapture readnone %0) {
ret i32 0
}
void GPMCECCBCHSWDataWrite(unsigned int baseAddr, unsigned int bchData) {
  (*((volatile unsigned int *)(baseAddr + (0x2D0)))) =
      (bchData & (0x0000FFFFu));
}


x86 assembly (clang, -O0):
<GPMCECCBCHSWDataWrite>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
and    $0xffff,%ecx
mov    -0x4(%rbp),%eax
add    $0x2d0,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPMCECCBCHSWDataWrite>:
movzwl %si,%eax
add    $0x2d0,%edi
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @GPMCECCBCHSWDataWrite(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 65535
%7 = load i32, i32* %3
%8 = add i32 %7, 720
%9 = zext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
store volatile i32 %6, i32* %10
ret void
}

LLVM IR (-O2):
define void @GPMCECCBCHSWDataWrite(i32 %0, i32 %1) {
%3 = and i32 %1, 65535
%4 = add i32 %0, 720
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
store volatile i32 %3, i32* %6
ret void
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int stat(char const *, struct stat *);
int is_available(const char *file) {
  struct stat buffer;
  return (1 + stat(file, &buffer));
}


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

x86 assembly (clang, -O2):
<is_available>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @is_available(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @stat(i8* %4, %struct.stat* %3)
%6 = add nsw i32 1, %5
ret i32 %6
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @is_available(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = add nsw i32 %4, 1
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ net_checksum_add(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ net_checksum_finish(int /*<<< orphan*/);
uint16_t net_raw_checksum(uint8_t *data, int length) {
  return net_checksum_finish(net_checksum_add(length, data));
}


x86 assembly (clang, -O0):
<net_raw_checksum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1040 <net_checksum_add@plt>
mov    %eax,%edi
call   1030 <net_checksum_finish@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<net_raw_checksum>:
push   %rax
mov    %rdi,%rax
mov    %esi,%edi
mov    %rax,%rsi
call   1040 <net_checksum_add@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <net_checksum_finish@plt>

LLVM IR (-O0):
define i32 @net_raw_checksum(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32*, i32** %3
%7 = call i32 @net_checksum_add(i32 %5, i32* %6)
%8 = call i32 @net_checksum_finish(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @net_raw_checksum(i32* %0, i32 %1) {
%3 = tail call i32 @net_checksum_add(i32 %1, i32* %0)
%4 = tail call i32 @net_checksum_finish(i32 %3)
ret i32 %4
}
void glk_tick() {}


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

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

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

LLVM IR (-O2):
define void @glk_tick() {
ret void
}