xunge/DecIR huggingface dataset:
/* Variables and functions */
unsigned short vx86_NBSB_Read16(int, unsigned char);
unsigned short nb1_Read16(unsigned char offset) {
  return vx86_NBSB_Read16(1, offset);
}


x86 assembly (clang, -O0):
<nb1_Read16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%edi
movzbl -0x1(%rbp),%esi
call   1030 <vx86_NBSB_Read16@plt>
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i16 @nb1_Read16(i8 zeroext %0) {
%2 = tail call zeroext i16 @vx86_NBSB_Read16(i32 1, i8 zeroext %0)
ret i16 %2
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t zigzagdec64(uint64_t x) { return x >> 1 ^ -(x & 1); }


x86 assembly (clang, -O0):
<zigzagdec64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    -0x4(%rbp),%edx
and    $0x1,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zigzagdec64>:
mov    %edi,%eax
sar    %eax
and    $0x1,%edi
neg    %edi
xor    %edi,%eax
ret

LLVM IR (-O0):
define i32 @zigzagdec64(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 1
%5 = load i32, i32* %2
%6 = and i32 %5, 1
%7 = sub nsw i32 0, %6
%8 = xor i32 %4, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @zigzagdec64(i32 %0) {
%2 = ashr i32 %0, 1
%3 = and i32 %0, 1
%4 = sub nsw i32 0, %3
%5 = xor i32 %2, %4
ret i32 %5
}
int main() {
  int i, j, k;
  i = 1;
  j = 22;
  char a[30];
  a[5] = 'Bari';
  printf("%c", a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x16,-0x8(%rbp)
movb   $0x69,-0x2b(%rbp)
lea    -0x30(%rbp),%rsi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movb   $0x69,0x5(%rsp)
lea    0xee0(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 5
store i8 105, i8* %3
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
int pad_if_needed(int size) {
  return (4 - (size + 2) % 4 == 4) ? size : (size + 4 - size % 4);
}


x86 assembly (clang, -O0):
<pad_if_needed>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    $0x4,%eax
sub    %edx,%eax
cmp    $0x4,%eax
jne    1130 <pad_if_needed+0x30>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    114c <pad_if_needed+0x4c>
mov    -0x4(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
sub    %edx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pad_if_needed>:
mov    %edi,%eax
lea    0x2(%rax),%ecx
test   $0x3,%cl
je     111a <pad_if_needed+0x1a>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
add    $0x4,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @pad_if_needed(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 2
%5 = srem i32 %4, 4
%6 = sub nsw i32 4, %5
%7 = icmp eq i32 %6, 4
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i32, i32* %2
br label %16
10: ; preds = %1
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 4
%13 = load i32, i32* %2
%14 = srem i32 %13, 4
%15 = sub nsw i32 %12, %14
br label %16
16: ; preds = %10, %8
%17 = phi i32 [ %9, %8 ], [ %15, %10 ]
ret i32 %17
}

LLVM IR (-O2):
define i32 @pad_if_needed(i32 %0) {
%2 = add nsw i32 %0, 2
%3 = and i32 %2, 3
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = add nsw i32 %0, 4
%7 = srem i32 %0, 4
%8 = sub i32 %6, %7
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ %0, %1 ]
ret i32 %10
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int sign(int32_t x) { return -((-(x >> 31)) | ((-x) >> 31)); }


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

x86 assembly (clang, -O2):
<sign>:
mov    %edi,%ecx
sar    $0x1f,%ecx
test   %edi,%edi
mov    $0x1,%eax
cmovle %ecx,%eax
ret

LLVM IR (-O0):
define i32 @sign(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 31
%5 = sub nsw i32 0, %4
%6 = load i32, i32* %2
%7 = sub nsw i32 0, %6
%8 = ashr i32 %7, 31
%9 = or i32 %5, %8
%10 = sub nsw i32 0, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @sign(i32 %0) {
%2 = ashr i32 %0, 31
%3 = icmp slt i32 %0, 1
%4 = select i1 %3, i32 %2, i32 1
ret i32 %4
}
char *fgaj_brown(int c) { return c ? "[0;33m" : ""; }


x86 assembly (clang, -O0):
<fgaj_brown>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xef6(%rip),%rax
lea    0xee8(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgaj_brown>:
test   %edi,%edi
lea    0xefe(%rip),%rcx
lea    0xef0(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[0;33m\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @fgaj_brown(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
ret i8* %6
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[0;33m\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @fgaj_brown(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ permute(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int);
int string_length(char *);
int main() {
  char string[] = "ABCDEF";
  int length;
  length = string_length(string);
  printf("String Length = %d\n", length);
  permute(string, 0, length - 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xeb5(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xead(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0xb(%rbp),%rdi
call   1050 <string_length@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
lea    -0xb(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <permute@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
movl   $0x464544,0x3(%rsp)
movl   $0x44434241,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <string_length@plt>
mov    %eax,%ebp
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0xffffffff,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <permute@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.string = [7 x i8] c"ABCDEF\00"
@.str = [20 x i8] c"String Length = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [7 x i8]* %2 to i8*
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%6 = call i32 @string_length(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 1
%12 = call i32 @permute(i8* %9, i32 0, i32 %11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.string = [7 x i8] c"ABCDEF\00"
@.str = [20 x i8] c"String Length = %d\0A\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = call i32 @string_length(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = add nsw i32 %3, -1
%6 = call i32 @permute(i8* %2, i32 0, i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void undefined_handler(void) {
  puts("undefined\n");
  puts("spinning forever...\n");
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<undefined_handler>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
jmp    112c <undefined_handler+0x1c>

x86 assembly (clang, -O2):
<undefined_handler>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
nopl   0x0(%rax)
jmp    1130 <undefined_handler+0x20>

LLVM IR (-O0):
@.str = [11 x i8] c"undefined\0A\00"
@.str.1 = [21 x i8] c"spinning forever...\0A\00"
define void @undefined_handler() {
%1 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %3
3: ; preds = %3, %0
br label %3
}

LLVM IR (-O2):
@.str = [11 x i8] c"undefined\0A\00"
@.str.1 = [21 x i8] c"spinning forever...\0A\00"
define void @undefined_handler() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %3
3: ; preds = %3, %0
br label %3
}
/* Variables and functions */
size_t xmalloc_size(void *ptr) {
  void *realptr = (char *)ptr - (sizeof(size_t));
  size_t size = *((size_t *)realptr);
  if (size & (sizeof(long) - 1)) {
    size += sizeof(long) - (size & (sizeof(long) - 1));
  }
  return size + (sizeof(size_t));
}


x86 assembly (clang, -O0):
<xmalloc_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
and    $0x7,%rax
cmp    $0x0,%rax
je     1149 <xmalloc_size+0x49>
mov    -0x18(%rbp),%rcx
and    $0x7,%rcx
mov    $0x8,%eax
sub    %rcx,%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc_size>:
mov    -0x8(%rdi),%rax
mov    %eax,%ecx
and    $0x7,%ecx
mov    $0x8,%edx
sub    %rcx,%rdx
test   %rcx,%rcx
cmove  %rcx,%rdx
add    %rdx,%rax
add    $0x8,%rax
ret

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

LLVM IR (-O2):
define i64 @xmalloc_size(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 -8
%3 = bitcast i8* %2 to i64*
%4 = load i64, i64* %3
%5 = and i64 %4, 7
%6 = icmp eq i64 %5, 0
%7 = sub nuw nsw i64 8, %5
%8 = select i1 %6, i64 0, i64 %7
%9 = add i64 %4, 8
%10 = add i64 %9, %8
ret i64 %10
}
/* Variables and functions */
int __tuntap_up(char const *);
int tundev_up(const char *name) { return __tuntap_up(name); }


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

x86 assembly (clang, -O2):
<tundev_up>:
jmp    1030 <__tuntap_up@plt>

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

LLVM IR (-O2):
define i32 @tundev_up(i8* %0) {
%2 = tail call i32 @__tuntap_up(i8* %0)
ret i32 %2
}
/* Variables and functions */
int __infer_nondet_int();
int pipe(int fildes[2]) {
  int ret = __infer_nondet_int();
  if (ret < -1 || ret > 0)
    while (1)
      ;
  return ret;
}


x86 assembly (clang, -O0):
<pipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__infer_nondet_int@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jl     113a <pipe+0x2a>
cmpl   $0x0,-0xc(%rbp)
jle    1144 <pipe+0x34>
jmp    113f <pipe+0x2f>
jmp    113f <pipe+0x2f>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pipe>:
push   %rax
xor    %eax,%eax
call   1030 <__infer_nondet_int@plt>
lea    -0x1(%rax),%ecx
cmp    $0xfffffffd,%ecx
ja     1122 <pipe+0x12>
jmp    1120 <pipe+0x10>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @pipe(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = call i32 (...) @__infer_nondet_int()
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, -1
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7, %1
br label %11
11: ; preds = %10, %11
br label %11
12: ; preds = %7
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @pipe(i32* nocapture readnone %0) {
%2 = tail call i32 (...) @__infer_nondet_int()
%3 = add i32 %2, -1
%4 = icmp ult i32 %3, -2
br i1 %4, label %5, label %6
5: ; preds = %1, %5
br label %5
6: ; preds = %1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdout;
void print_labels(char *callSign) {
  printf(":%-9s:PARM.PA Temp\n", callSign);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<print_labels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_labels>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [20 x i8] c":%-9s:PARM.PA Temp\0A\00"
@stdout = global i32 0
define void @print_labels(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @stdout
%6 = call i32 @fflush(i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c":%-9s:PARM.PA Temp\0A\00"
@stdout = global i32 0
define void @print_labels(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret void
}
/* Variables and functions */
int getchar();
int KEYBOARD_check_input() { return getchar(); }


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

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

LLVM IR (-O0):
define i32 @KEYBOARD_check_input() {
%1 = call i32 (...) @getchar()
ret i32 %1
}

LLVM IR (-O2):
define i32 @KEYBOARD_check_input() {
%1 = tail call i32 (...) @getchar()
ret i32 %1
}
/* Variables and functions */
int default_mem_desc(unsigned char, unsigned char, char *, int *);
int decode_mem_supermicro(int prod, unsigned char b2, unsigned char b3,
                          char *desc, int *psz) {
  return (default_mem_desc(b2, b3, desc, psz));
}


x86 assembly (clang, -O0):
<decode_mem_supermicro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %sil,%dl
mov    %edi,-0x4(%rbp)
mov    %dl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %rcx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    -0x5(%rbp),%sil
mov    -0x6(%rbp),%al
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
movzbl %sil,%edi
movzbl %al,%esi
call   1030 <default_mem_desc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_mem_supermicro>:
mov    %esi,%edi
mov    %edx,%esi
mov    %rcx,%rdx
mov    %r8,%rcx
jmp    1030 <default_mem_desc@plt>

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

LLVM IR (-O2):
define i32 @decode_mem_supermicro(i32 %0, i8 zeroext %1, i8 zeroext %2, i8* %3, i32* %4) {
%6 = tail call i32 @default_mem_desc(i8 zeroext %1, i8 zeroext %2, i8* %3, i32* %4)
ret i32 %6
}
void lock(void) { __asm__("lock"); }


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

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

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

LLVM IR (-O2):
define void @lock() {
tail call void asm sideeffect "lock", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rax_free(unsigned int *);
void freeBitVectors(unsigned int **v, int n) {
  int i;
  for (i = 1; i < n; i++)
    rax_free(v[i]);
}


x86 assembly (clang, -O0):
<freeBitVectors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <freeBitVectors+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <rax_free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <freeBitVectors+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeBitVectors>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%esi
jl     1142 <freeBitVectors+0x32>
mov    %rdi,%r14
mov    %esi,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rdi
call   1030 <rax_free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <freeBitVectors+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @freeBitVectors(i32** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 1, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32*, i32** %0, i64 %7
%9 = load i32*, i32** %8
%10 = tail call i32 @rax_free(i32* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
int Cyc_Absyn_xorptr(void *p1, void *p2) {
  return p1 == 0 && p2 == 0 || p1 != 0 && p2 != 0;
}


x86 assembly (clang, -O0):
<Cyc_Absyn_xorptr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1127 <Cyc_Absyn_xorptr+0x27>
mov    $0x1,%al
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1148 <Cyc_Absyn_xorptr+0x48>
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x12(%rbp)
je     1142 <Cyc_Absyn_xorptr+0x42>
cmpq   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Absyn_xorptr>:
mov    %rdi,%rax
or     %rsi,%rax
sete   %al
test   %rdi,%rdi
setne  %cl
test   %rsi,%rsi
setne  %dl
and    %cl,%dl
or     %al,%dl
movzbl %dl,%eax
ret

LLVM IR (-O0):
define i32 @Cyc_Absyn_xorptr(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 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %18, label %10
10: ; preds = %7, %2
%11 = load i8*, i8** %3
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8*, i8** %4
%15 = icmp ne i8* %14, null
br label %16
16: ; preds = %13, %10
%17 = phi i1 [ false, %10 ], [ %15, %13 ]
br label %18
18: ; preds = %16, %7
%19 = phi i1 [ true, %7 ], [ %17, %16 ]
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @Cyc_Absyn_xorptr(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = and i1 %3, %4
%6 = icmp ne i8* %0, null
%7 = icmp ne i8* %1, null
%8 = and i1 %6, %7
%9 = or i1 %5, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
int value() {}


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

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

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

LLVM IR (-O2):
define i32 @value() {
ret i32 undef
}
int f(void) {
  int i = 3;
  int j;
  int a[10];
  i = i++;
  a[i] = i++;
  a[i++] = i;
  j = i++ * i;
  j = i * i++;
  j += --i * ++i;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x8(%rbp),%ecx
mov    -0x8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
cltq
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
imul   %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i32]
store i32 3, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
store i32 %6, i32* %2
store i32 %5, i32* %2
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %10
store i32 %7, i32* %11
%12 = load i32, i32* %2
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
%15 = sext i32 %13 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %15
store i32 %12, i32* %16
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = mul nsw i32 %17, %19
store i32 %20, i32* %3
%21 = load i32, i32* %2
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
%24 = mul nsw i32 %21, %22
store i32 %24, i32* %3
%25 = load i32, i32* %2
%26 = add nsw i32 %25, -1
store i32 %26, i32* %2
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
%29 = mul nsw i32 %26, %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, %29
store i32 %31, i32* %3
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
define i32 @f() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ merge(double *, int);
void merge_sort(double vec[], int vec_size) {
  int mid;
  if (vec_size > 1) {
    mid = vec_size / 2;
    merge_sort(vec, mid);
    merge_sort(vec + mid, vec_size - mid);
    merge(vec, vec_size);
  }
}


x86 assembly (clang, -O0):
<merge_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    1179 <merge_sort+0x59>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1040 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
call   1040 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <merge@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_sort>:
cmp    $0x1,%esi
jle    1154 <merge_sort+0x34>
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%ebx
shr    %ebx
mov    %ebx,%esi
call   1040 <merge_sort@plt>
lea    (%r14,%rbx,8),%rdi
mov    %ebp,%esi
sub    %ebx,%esi
call   1040 <merge_sort@plt>
mov    %r14,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <merge@plt>
ret

LLVM IR (-O0):
define void @merge_sort(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %23
8: ; preds = %2
%9 = load i32, i32* %4
%10 = sdiv i32 %9, 2
store i32 %10, i32* %5
%11 = load double*, double** %3
%12 = load i32, i32* %5
%13 = load double*, double** %3
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %13, i64 %15
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = sub nsw i32 %17, %18
%20 = load double*, double** %3
%21 = load i32, i32* %4
%22 = call i32 @merge(double* %20, i32 %21)
br label %23
23: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
define void @merge_sort(double* %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %5, label %4
4: ; preds = %2, %5
ret void
5: ; preds = %2
%6 = lshr i32 %1, 1
tail call void @merge_sort(double* %0, i32 %6)
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = sub nsw i32 %1, %6
tail call void @merge_sort(double* %8, i32 %9)
%10 = tail call i32 @merge(double* %0, i32 %1)
br label %4
}
/* Variables and functions */
int ffz(unsigned long);
__attribute__((always_)) int sigfindinword(unsigned long word) {
  return ffz(~word);
}


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

x86 assembly (clang, -O2):
<sigfindinword>:
not    %rdi
jmp    1030 <ffz@plt>

LLVM IR (-O0):
define i32 @sigfindinword(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = xor i64 %3, -1
%5 = call i32 @ffz(i64 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @sigfindinword(i64 %0) {
%2 = xor i64 %0, -1
%3 = tail call i32 @ffz(i64 %2)
ret i32 %3
}
/* Variables and functions */
char EOF;
char getchar();
int /*<<< orphan*/ putchar(char);
int main() {
  char c;
  while ((c = getchar()) != EOF) {
    (c == 10) ? putchar(c) : putchar(c - 7);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2ea5(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     117d <main+0x5d>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    1169 <main+0x49>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    1178 <main+0x58>
movsbl -0x5(%rbp),%eax
sub    $0x7,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb7(%rip),%rbx
cmp    (%rbx),%al
je     115e <main+0x3e>
mov    $0xa,%ebp
nopw   0x0(%rax,%rax,1)
lea    -0x7(%rax),%ecx
cmp    $0xa,%al
movzbl %cl,%eax
cmove  %ebp,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%al
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %22, %0
%4 = call signext i8 (...) @getchar()
store i8 %4, i8* %2
%5 = sext i8 %4 to i32
%6 = load i8, i8* @EOF
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %5, %7
br i1 %8, label %9, label %24
9: ; preds = %3
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 10
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i8, i8* %2
%15 = call i32 @putchar(i8 signext %14)
br label %22
16: ; preds = %9
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = sub nsw i32 %18, 7
%20 = trunc i32 %19 to i8
%21 = call i32 @putchar(i8 signext %20)
br label %22
22: ; preds = %16, %13
%23 = phi i32 [ %15, %13 ], [ %21, %16 ]
br label %3
24: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %13, label %4
4: ; preds = %0, %4
%5 = phi i8 [ %10, %4 ], [ %1, %0 ]
%6 = icmp eq i8 %5, 10
%7 = add i8 %5, -7
%8 = select i1 %6, i8 10, i8 %7
%9 = tail call i32 @putchar(i8 signext %8)
%10 = tail call signext i8 (...) @getchar()
%11 = load i8, i8* @EOF
%12 = icmp eq i8 %10, %11
br i1 %12, label %13, label %4
13: ; preds = %4, %0
ret i32 0
}
int test_imm_3Auint32_reg(unsigned int val) {
  return ((val) & (0x3A << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_3Auint32_reg(i32 %0) {
%2 = and i32 %0, 58
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
char *strcpy(char *dst, const char *src) { return __builtin_strcpy(dst, src); }


x86 assembly (clang, -O0):
<strcpy>:
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 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
jmp    1100 <strcpy>

LLVM IR (-O0):
define i8* @strcpy(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 = call i8* @strcpy(i8* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @strcpy(i8* nocapture readnone %0, i8* nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_addba_reject_usage(void) {
  printf("\nUsage : addbareject <m0> <m1> ... <m7>");
  printf("\nOptions: <mx> : 1 enables rejection of ADDBA request for TidX.");
  printf("\n                0 would accept any ADDBAs for TidX.");
  printf("\n         empty - get the addbareject table\n");
  return;
}


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

x86 assembly (clang, -O2):
<print_addba_reject_usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xef4(%rip),%rdi
call   1040 <printf@plt>
lea    0xf28(%rip),%rdi
call   1040 <printf@plt>
lea    0xf51(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"\0AUsage : addbareject <m0> <m1> ... <m7>\00"
@.str.1 = [64 x i8] c"\0AOptions: <mx> : 1 enables rejection of ADDBA request for TidX.\00"
@.str.2 = [53 x i8] c"\0A 0 would accept any ADDBAs for TidX.\00"
@.str.3 = [45 x i8] c"\0A empty - get the addbareject table\0A\00"
define void @print_addba_reject_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"\0AUsage : addbareject <m0> <m1> ... <m7>\00"
@.str.1 = [64 x i8] c"\0AOptions: <mx> : 1 enables rejection of ADDBA request for TidX.\00"
@.str.2 = [53 x i8] c"\0A 0 would accept any ADDBAs for TidX.\00"
@str = [44 x i8] c"\0A empty - get the addbareject table\00"
define void @print_addba_reject_usage() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
size_t fread(void *, size_t, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void fread_safe(void *ptr, size_t size, size_t count, FILE *fp) {
  if (fread(ptr, size, count, fp) != count) {
    fprintf(stderr, "\nError: Couldn't fread from file\n\n");
    exit(-1);
  }
  return;
}


x86 assembly (clang, -O0):
<fread_safe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <fread@plt>
cmp    -0x18(%rbp),%rax
je     1186 <fread_safe+0x56>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fread_safe>:
push   %rbx
mov    %rdx,%rbx
call   1030 <fread@plt>
cmp    %rbx,%rax
jne    1140 <fread_safe+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"\0AError: Couldn't fread from file\0A\0A\00"
define void @fread_safe(i8* %0, i64 %1, i64 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32* %3, i32** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i64, i64* %7
%12 = load i32*, i32** %8
%13 = call i64 @fread(i8* %9, i64 %10, i64 %11, i32* %12)
%14 = load i64, i64* %7
%15 = icmp ne i64 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %4
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @exit(i32 -1)
unreachable
20: ; preds = %4
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"\0AError: Couldn't fread from file\0A\0A\00"
define void @fread_safe(i8* nocapture %0, i64 %1, i64 %2, i32* nocapture %3) {
%5 = tail call i64 @fread(i8* %0, i64 %1, i64 %2, i32* %3)
%6 = icmp eq i64 %5, %2
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %4
ret void
}
int foo(int x, int y) {
  int unknown;
  if (unknown)
    return y + 2;
  return x + 3;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1122 <foo+0x22>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    112b <foo+0x2b>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
lea    0x3(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 3
ret i32 %3
}
double mode_Nor(double mu, double si2) { return mu; }


x86 assembly (clang, -O0):
<mode_Nor>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

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

LLVM IR (-O2):
define double @mode_Nor(double returned %0, double %1) {
ret double %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = 1024;
  int b = 345875;
  printf("%d\n", a + 3587);
  printf("%d\n", 234587 + 3553);
  printf("%d\n", 11212 + b);
  printf("%d\n", a + b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x400,-0x8(%rbp)
movl   $0x54713,-0xc(%rbp)
mov    -0x8(%rbp),%esi
add    $0xe03,%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
mov    $0x3a23c,%esi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
add    $0x2bcc,%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1203,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3a23c,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x572df,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x54b13,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4611)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 238140)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 357087)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 346899)
ret i32 0
}
int exist_in_row(char **tab, char n, int i) {
  int j;
  j = 0;
  while (j < 8) {
    if (tab[i][j] == n)
      return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<exist_in_row>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    1153 <exist_in_row+0x53>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    114e <exist_in_row+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    115a <exist_in_row+0x5a>
jmp    1118 <exist_in_row+0x18>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exist_in_row>:
movslq %edx,%rax
mov    (%rdi,%rax,8),%rax
cmp    %sil,(%rax)
jne    1120 <exist_in_row+0x20>
mov    $0x1,%eax
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
jmp    1120 <exist_in_row+0x20>

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

LLVM IR (-O2):
define i32 @exist_in_row(i8** nocapture %0, i8 signext %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i8*, i8** %0, i64 %4
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, %1
br i1 %8, label %10, label %9
9: ; preds = %3, %9
br label %9
10: ; preds = %3
ret i32 1
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int getRand(int min, int max) {
  static int Init = 0;
  int rc;
  if (Init == 0) {
    srand(time(NULL));
    Init = 1;
  }
  rc = (rand() % (max - min + 1) + min);
  return (rc);
}


x86 assembly (clang, -O0):
<getRand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,0x2ef7(%rip)
jne    1165 <getRand+0x35>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x1,0x2ed7(%rip)
mov    $0x0,%al
call   1050 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
add    -0x4(%rbp),%edx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRand>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
cmpb   $0x0,0x2efe(%rip)
jne    1155 <getRand+0x25>
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movb   $0x1,0x2ee7(%rip)
xor    %eax,%eax
call   1050 <rand@plt>
sub    %ebx,%ebp
add    $0x1,%ebp
cltd
idiv   %ebp
add    %edx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@getRand.Init = internal global i32 0
define i32 @getRand(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* @getRand.Init
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = call i32 @time(i32* null)
%10 = call i32 @srand(i32 %9)
store i32 1, i32* @getRand.Init
br label %11
11: ; preds = %8, %2
%12 = call i32 (...) @rand()
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = sub nsw i32 %13, %14
%16 = add nsw i32 %15, 1
%17 = srem i32 %12, %16
%18 = load i32, i32* %3
%19 = add nsw i32 %17, %18
store i32 %19, i32* %5
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
@getRand.Init = internal unnamed_addr global i1 false
define i32 @getRand(i32 %0, i32 %1) {
%3 = load i1, i1* @getRand.Init
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srand(i32 %5)
store i1 true, i1* @getRand.Init
br label %7
7: ; preds = %4, %2
%8 = tail call i32 (...) @rand()
%9 = sub i32 1, %0
%10 = add i32 %9, %1
%11 = srem i32 %8, %10
%12 = add nsw i32 %11, %0
ret i32 %12
}
void classEnd2RBOX() {}


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

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

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

LLVM IR (-O2):
define void @classEnd2RBOX() {
ret void
}
char *strdup(str) const char *str;
{
  char *p;
  p = (char *)malloc(strlen(str) + 1);
  if (p)
    strcpy(p, str);
  return p;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116d <strdup+0x3d>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1158 <strdup+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add i64 %5, 1
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = load i8*, i8** %2
%13 = call i8* @strcpy(i8* %11, i8* %12)
br label %14
14: ; preds = %10, %1
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
define i8* @strdup(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i8* @strcpy(i8* %4, i8* dereferenceable(1) %0)
br label %8
8: ; preds = %6, %1
ret i8* %4
}