xunge/DecIR huggingface dataset:
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int lines, c;
  lines = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\n')
      lines++;
  }
  printf("%d\n", lines);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xc(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     1167 <main+0x47>
cmpl   $0xa,-0xc(%rbp)
jne    1162 <main+0x42>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
mov    -0x8(%rbp),%esi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb4(%rip),%r14
cmp    (%r14),%eax
je     1156 <main+0x36>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
jne    1140 <main+0x20>
lea    0xea3(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
@.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 0, i32* %2
br label %4
4: ; preds = %14, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %3
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 10
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %14
14: ; preds = %11, %8
br label %4
15: ; preds = %4
%16 = load i32, i32* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %13, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %10, %4 ], [ %1, %0 ]
%6 = phi i32 [ %9, %4 ], [ 0, %0 ]
%7 = icmp eq i32 %5, 10
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %6, %8
%10 = tail call i32 (...) @getchar()
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %4
13: ; preds = %4, %0
%14 = phi i32 [ 0, %0 ], [ %9, %4 ]
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}
/* Variables and functions */
bool _rate_in_range(unsigned int rate) {
  const unsigned MHz = 1000 * 1000;
  return (rate <= 240 * MHz && rate >= 80 * MHz);
}


x86 assembly (clang, -O0):
<_rate_in_range>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0xf4240,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0xe4e1c00,-0x4(%rbp)
mov    %al,-0x9(%rbp)
ja     112d <_rate_in_range+0x2d>
cmpl   $0x4c4b400,-0x4(%rbp)
setae  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_rate_in_range>:
add    $0xfb3b4c00,%edi
xor    %eax,%eax
cmp    $0x9896801,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @_rate_in_range(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1000000, i32* %3
%4 = load i32, i32* %2
%5 = icmp ule i32 %4, 240000000
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp uge i32 %7, 80000000
br label %9
9: ; preds = %6, %1
%10 = phi i1 [ false, %1 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @_rate_in_range(i32 %0) {
%2 = add i32 %0, -80000000
%3 = icmp ult i32 %2, 160000001
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
void set_previous_free_block(void *ptr, void *previous_ptr) {
  char *p = ptr;
  void **previous_block_info;
  p += (sizeof(size_t));
  previous_block_info = (void **)p;
  *previous_block_info = previous_ptr;
}


x86 assembly (clang, -O0):
<set_previous_free_block>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_previous_free_block>:
mov    %rsi,0x8(%rdi)
ret

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

LLVM IR (-O2):
define void @set_previous_free_block(i8* nocapture writeonly %0, i8* %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 8
%4 = bitcast i8* %3 to i8**
store i8* %1, i8** %4
ret void
}
/* Variables and functions */
int japi_focuslistener(int);
int j_focuslistener(int arg0) { return (japi_focuslistener(arg0)); }


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

x86 assembly (clang, -O2):
<j_focuslistener>:
jmp    1030 <japi_focuslistener@plt>

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

LLVM IR (-O2):
define i32 @j_focuslistener(i32 %0) {
%2 = tail call i32 @japi_focuslistener(i32 %0)
ret i32 %2
}
struct B {
  int a, b;
  float c, d;
} bf() {
  return (struct B){1, 2, 3, 4};
}


x86 assembly (clang, -O0):
<bf>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x10(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0x40400000,-0x8(%rbp)
movl   $0x40800000,-0x4(%rbp)
mov    -0x10(%rbp),%rax
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<bf>:
movaps 0xef9(%rip),%xmm0
movabs $0x200000001,%rax
ret

LLVM IR (-O0):
%struct.B = type { i32, i32, float, float }
define { i64, <2 x float> } @bf() {
%1 = alloca %struct.B
%2 = getelementptr inbounds %struct.B, %struct.B* %1, i32 0, i32 0
store i32 1, i32* %2
%3 = getelementptr inbounds %struct.B, %struct.B* %1, i32 0, i32 1
store i32 2, i32* %3
%4 = getelementptr inbounds %struct.B, %struct.B* %1, i32 0, i32 2
store float 3.000000e+00, float* %4
%5 = getelementptr inbounds %struct.B, %struct.B* %1, i32 0, i32 3
store float 4.000000e+00, float* %5
%6 = bitcast %struct.B* %1 to { i64, <2 x float> }*
%7 = load { i64, <2 x float> }, { i64, <2 x float> }* %6
ret { i64, <2 x float> } %7
}

LLVM IR (-O2):
define { i64, <2 x float> } @bf() {
ret { i64, <2 x float> } { i64 8589934593, <2 x float> <float 3.000000e+00, float 4.000000e+00> }
}
void enable_hblk_interrupt() {
  (*(volatile unsigned long *)(((0xFFFFF000) + 0x010))) = 0x00020;
}


x86 assembly (clang, -O0):
<enable_hblk_interrupt>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffff010,%eax
movq   $0x20,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<enable_hblk_interrupt>:
mov    $0xfffff010,%eax
movq   $0x20,(%rax)
ret

LLVM IR (-O0):
define void @enable_hblk_interrupt() {
store volatile i64 32, i64* inttoptr (i64 4294963216 to i64*)
ret void
}

LLVM IR (-O2):
define void @enable_hblk_interrupt() {
store volatile i64 32, i64* inttoptr (i64 4294963216 to i64*)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ setOfItems;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int setOfItems[3] = {1, 2, 3};
  int i;
  for (i = 0; i < sizeof(setOfItems) / sizeof(int); i++) {
    printf("%d\n", setOfItems[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x3,%rax
jae    116a <main+0x5a>
movslq -0x14(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113a <main+0x2a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.setOfItems = [3 x i32] [i32 1, i32 2, i32 3]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [3 x i32]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %15, %0
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = icmp ult i64 %7, 3
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %9
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %5
18: ; preds = %5
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 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlockattr_t;

/* Variables and functions */
int pthread_rwlockattr_init(pthread_rwlockattr_t *attr) {
  ;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @pthread_rwlockattr_init(i32* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int prefix_length(unsigned base) {
  switch (base) {
  case 2:
    return 2;
  case 8:
    return 2;
  case 10:
    return 0;
  case 16:
    return 2;
  default:
    abort();
    return -1;
  }
}


x86 assembly (clang, -O0):
<prefix_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xe,%eax
ja     1174 <prefix_length+0x64>
mov    -0x10(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x2,-0x4(%rbp)
jmp    117b <prefix_length+0x6b>
movl   $0x2,-0x4(%rbp)
jmp    117b <prefix_length+0x6b>
movl   $0x0,-0x4(%rbp)
jmp    117b <prefix_length+0x6b>
movl   $0x2,-0x4(%rbp)
jmp    117b <prefix_length+0x6b>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prefix_length>:
push   %rax
add    $0xfffffffe,%edi
ror    %edi
cmp    $0x8,%edi
jae    1134 <prefix_length+0x24>
mov    $0x99,%eax
bt     %edi,%eax
jae    1134 <prefix_length+0x24>
movslq %edi,%rax
lea    0xed1(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
@switch.table.prefix_length = [8 x i32] [i32 2, i32 2, i32 2, i32 2, i32 0, i32 2, i32 2, i32 2]
define i32 @prefix_length(i32 %0) {
%2 = add i32 %0, -2
%3 = tail call i32 @llvm.fshl.i32(i32 %2, i32 %2, i32 31)
%4 = icmp ult i32 %3, 8
br i1 %4, label %7, label %5
5: ; preds = %7, %1
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = trunc i32 %3 to i8
%9 = lshr i8 -103, %8
%10 = and i8 %9, 1
%11 = icmp eq i8 %10, 0
br i1 %11, label %5, label %12
12: ; preds = %7
%13 = sext i32 %3 to i64
%14 = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.prefix_length, i64 0, i64 %13
%15 = load i32, i32* %14
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ uart_puts(char *);
void calc_init(int *calc_on) {
  uart_puts("hello in calc\r\n");
  *calc_on = 1;
}


x86 assembly (clang, -O0):
<calc_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <uart_puts@plt>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_init>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
call   1030 <uart_puts@plt>
movl   $0x1,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"hello in calc\0D\0A\00"
define void @calc_init(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 @uart_puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = load i32*, i32** %2
store i32 1, i32* %4
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"hello in calc\0D\0A\00"
define void @calc_init(i32* nocapture writeonly %0) {
%2 = tail call i32 @uart_puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %0
ret void
}
void alg(char *buf, int squ) {
  buf[0] = "abcdefgh"[squ & 7];
  buf[1] = "87654321"[squ >> 3];
  buf[2] = 0;
}


x86 assembly (clang, -O0):
<alg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x7,%eax
movslq %eax,%rcx
lea    0xee5(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x3,%eax
movslq %eax,%rcx
lea    0xed5(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x2(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<alg>:
mov    %esi,%eax
and    $0x7,%eax
lea    0xef4(%rip),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,(%rdi)
sar    $0x3,%esi
movslq %esi,%rax
lea    0xeeb(%rip),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,0x1(%rdi)
movb   $0x0,0x2(%rdi)
ret

LLVM IR (-O0):
@.str = [9 x i8] c"abcdefgh\00"
@.str.1 = [9 x i8] c"87654321\00"
define void @alg(i8* %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 = and i32 %5, 7
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [9 x i8], [9 x i8]* @.str, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
store i8 %9, i8* %11
%12 = load i32, i32* %4
%13 = ashr i32 %12, 3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [9 x i8], [9 x i8]* @.str.1, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 1
store i8 %16, i8* %18
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 2
store i8 0, i8* %20
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"abcdefgh\00"
@.str.1 = [9 x i8] c"87654321\00"
define void @alg(i8* nocapture writeonly %0, i32 %1) {
%3 = and i32 %1, 7
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds [9 x i8], [9 x i8]* @.str, i64 0, i64 %4
%6 = load i8, i8* %5
store i8 %6, i8* %0
%7 = ashr i32 %1, 3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [9 x i8], [9 x i8]* @.str.1, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %10, i8* %11
%12 = getelementptr inbounds i8, i8* %0, i64 2
store i8 0, i8* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ check_int(int *, int *, char *);
void check_int_(int *x, int *y, char *ret) { check_int(x, y, ret); }


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

x86 assembly (clang, -O2):
<check_int_>:
jmp    1030 <check_int@plt>

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

LLVM IR (-O2):
define void @check_int_(i32* %0, i32* %1, i8* %2) {
%4 = tail call i32 @check_int(i32* %0, i32* %1, i8* %2)
ret void
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int /*<<< orphan*/ S_ISDIR(int /*<<< orphan*/);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ lstat(char *, struct stat *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  struct stat buf;
  if (lstat(".", &buf) != 0 || !S_ISDIR(buf.st_mode))
    abort();
  printf("pass\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <lstat@plt>
cmp    $0x0,%rax
jne    118a <main+0x3a>
mov    -0x8(%rbp),%edi
call   1050 <S_ISDIR@plt>
cmp    $0x0,%eax
jne    1191 <main+0x41>
mov    $0x0,%al
call   1030 <abort@plt>
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
mov    %rsp,%rsi
call   1060 <lstat@plt>
test   %rax,%rax
jne    1171 <main+0x21>
mov    (%rsp),%edi
call   1050 <S_ISDIR@plt>
test   %eax,%eax
jne    1178 <main+0x28>
xor    %eax,%eax
call   1030 <abort@plt>
lea    0xe83(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [2 x i8] c".\00"
@.str.1 = [6 x i8] c"pass\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.stat
store i32 0, i32* %1
%3 = call i64 @lstat(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%4 = icmp ne i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%7 = load i32, i32* %6
%8 = call i32 @S_ISDIR(i32 %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %5, %0
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %5
%13 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [2 x i8] c".\00"
@str = [5 x i8] c"pass\00"
define i32 @main() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = call i64 @lstat(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = tail call i32 @S_ISDIR(i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %5, %0
%11 = tail call i32 (...) @abort()
unreachable
12: ; preds = %5
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int f185(int *);
int f186(int *p) { return f185(p); }


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

x86 assembly (clang, -O2):
<f186>:
jmp    1030 <f185@plt>

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

LLVM IR (-O2):
define i32 @f186(i32* %0) {
%2 = tail call i32 @f185(i32* %0)
ret i32 %2
}
/* Variables and functions */
size_t strcspn(char const *, char const *);
char *strpbrk(const char *str1, const char *str2) {
  size_t i = strcspn(str1, str2);
  if (str1[i] == '\0') {
    return NULL;
  } else {
    return (char *)str1 + i;
  }
}


x86 assembly (clang, -O0):
<strpbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcspn@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    1153 <strpbrk+0x43>
movq   $0x0,-0x8(%rbp)
jmp    115f <strpbrk+0x4f>
mov    -0x10(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strpbrk>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strcspn@plt>
lea    (%rbx,%rax,1),%rdx
xor    %ecx,%ecx
cmpb   $0x0,(%rbx,%rax,1)
cmovne %rdx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @strpbrk(i8* %0, i8* nocapture %1) {
%3 = tail call i64 @strcspn(i8* %0, i8* %1)
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = select i1 %6, i8* null, i8* %4
ret i8* %7
}
int add_i(int a, int b) { return (a + b); }


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

x86 assembly (clang, -O2):
<add_i>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @add_i(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @add_i(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
void test(void) { __asm__("         jmp 0x800000;     "); }


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
jmp    800000 <completed.0+0x7fbfe0>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
jmp    800000 <completed.0+0x7fbfe0>
ret

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

LLVM IR (-O2):
define void @test() {
tail call void asm sideeffect " jmp 0x800000; ", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void always_pass() {}


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

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

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

LLVM IR (-O2):
define void @always_pass() {
ret void
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
size_t strlen(char const *);
char *strndup(const char *str, size_t n) {
  size_t len = strlen(str);
  if (len > n)
    len = n;
  char *ptr = (char *)malloc(len + 1);
  memcpy(ptr, str, len);
  ptr[len] = 0;
  return ptr;
}


x86 assembly (clang, -O0):
<strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    1163 <strndup+0x33>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strndup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%rbx
cmp    %r15,%rax
cmova  %r15,%rbx
lea    0x1(%rbx),%rdi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <memcpy@plt>
movb   $0x0,(%r15,%rbx,1)
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strndup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%7 = load i8*, i8** %3
%8 = call i64 @strlen(i8* %7)
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = load i64, i64* %4
%11 = icmp ugt i64 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i64, i64* %4
store i64 %13, i64* %5
br label %14
14: ; preds = %12, %2
%15 = load i64, i64* %5
%16 = add i64 %15, 1
%17 = call i64 @malloc(i64 %16)
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = load i8*, i8** %3
%21 = load i64, i64* %5
%22 = call i32 @memcpy(i8* %19, i8* %20, i64 %21)
%23 = load i8*, i8** %6
%24 = load i64, i64* %5
%25 = getelementptr inbounds i8, i8* %23, i64 %24
store i8 0, i8* %25
%26 = load i8*, i8** %6
ret i8* %26
}

LLVM IR (-O2):
define i8* @strndup(i8* %0, i64 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = icmp ugt i64 %3, %1
%5 = select i1 %4, i64 %1, i64 %3
%6 = add i64 %5, 1
%7 = tail call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @memcpy(i8* %8, i8* %0, i64 %5)
%10 = getelementptr inbounds i8, i8* %8, i64 %5
store i8 0, i8* %10
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void test(const char *s) { printf("%s\n", s); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @test(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int test_imm_43uint8_mem(unsigned char *val) {
  return ((*val) & (-0x43 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_43uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, -67
%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_43uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -67
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void swap(int *v, int i, int j) {
  int t = v[i];
  v[i] = v[j];
  v[j] = t;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @swap(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %7
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
void local_irq_enable(void) { __asm__ __volatile__("" : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @local_irq_enable() {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
double mode_Bet(double a, double b) {
  if ((a > 1) && (b > 1)) {
    return ((a - 1) / (a + b - 2));
  } else {
    return (a / (a + b));
  }
}


x86 assembly (clang, -O0):
<mode_Bet>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xee5(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1171 <mode_Bet+0x71>
movsd  -0x18(%rbp),%xmm0
movsd  0xece(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1171 <mode_Bet+0x71>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb7(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
movsd  0xea9(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1189 <mode_Bet+0x89>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mode_Bet>:
ucomisd 0xef8(%rip),%xmm0
jbe    1135 <mode_Bet+0x35>
ucomisd 0xeee(%rip),%xmm1
jbe    1135 <mode_Bet+0x35>
movsd  0xeec(%rip),%xmm2
addsd  %xmm0,%xmm2
addsd  %xmm0,%xmm1
addsd  0xee4(%rip),%xmm1
divsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
ret
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @mode_Bet(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = fcmp ogt double %6, 1.000000e+00
br i1 %7, label %8, label %19
8: ; preds = %2
%9 = load double, double* %5
%10 = fcmp ogt double %9, 1.000000e+00
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load double, double* %4
%13 = fsub double %12, 1.000000e+00
%14 = load double, double* %4
%15 = load double, double* %5
%16 = fadd double %14, %15
%17 = fsub double %16, 2.000000e+00
%18 = fdiv double %13, %17
store double %18, double* %3
br label %25
19: ; preds = %8, %2
%20 = load double, double* %4
%21 = load double, double* %4
%22 = load double, double* %5
%23 = fadd double %21, %22
%24 = fdiv double %20, %23
store double %24, double* %3
br label %25
25: ; preds = %19, %11
%26 = load double, double* %3
ret double %26
}

LLVM IR (-O2):
define double @mode_Bet(double %0, double %1) {
%3 = fcmp ogt double %0, 1.000000e+00
%4 = fcmp ogt double %1, 1.000000e+00
%5 = and i1 %3, %4
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = fadd double %0, -1.000000e+00
%8 = fadd double %0, %1
%9 = fadd double %8, -2.000000e+00
%10 = fdiv double %7, %9
br label %14
11: ; preds = %2
%12 = fadd double %0, %1
%13 = fdiv double %0, %12
br label %14
14: ; preds = %11, %6
%15 = phi double [ %10, %6 ], [ %13, %11 ]
ret double %15
}
int test_imm_C2uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xC2 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_C2uint64_midword_reg>:
test   $0xc20000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_C2uint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 194
%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_C2uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 12713984
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int do_cursorpos(int /*<<< orphan*/);
int do_cursorpos_void(void) { return do_cursorpos(0); }


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

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

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

LLVM IR (-O2):
define i32 @do_cursorpos_void() {
%1 = tail call i32 @do_cursorpos(i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
int fn1() { foo(12); }


x86 assembly (clang, -O0):
<fn1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc,%edi
call   1030 <foo@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn1>:
mov    $0xc,%edi
jmp    1030 <foo@plt>

LLVM IR (-O0):
define i32 @fn1() {
%1 = alloca i32
%2 = call i32 @foo(i32 12)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @fn1() {
%1 = tail call i32 @foo(i32 12)
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int XDestroyWindow(Display *display, Window win) {}


x86 assembly (clang, -O0):
<XDestroyWindow>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @XDestroyWindow(i32* nocapture readnone %0, i32 %1) {
ret i32 undef
}
/* Type definitions */
struct XCSF {
  int dummy;
};
struct Cl {
  int dummy;
};

/* Variables and functions */
double pred_size(struct XCSF const *, struct Cl const *);
double cl_pred_size(const struct XCSF *xcsf, const struct Cl *c) {
  return pred_size(xcsf, c);
}


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

x86 assembly (clang, -O2):
<cl_pred_size>:
jmp    1030 <pred_size@plt>

LLVM IR (-O0):
%struct.XCSF = type { i32 }
%struct.Cl = type { i32 }
define double @cl_pred_size(%struct.XCSF* %0, %struct.Cl* %1) {
%3 = alloca %struct.XCSF*
%4 = alloca %struct.Cl*
store %struct.XCSF* %0, %struct.XCSF** %3
store %struct.Cl* %1, %struct.Cl** %4
%5 = load %struct.XCSF*, %struct.XCSF** %3
%6 = load %struct.Cl*, %struct.Cl** %4
%7 = call double @pred_size(%struct.XCSF* %5, %struct.Cl* %6)
ret double %7
}

LLVM IR (-O2):
%struct.XCSF = type { i32 }
%struct.Cl = type { i32 }
define double @cl_pred_size(%struct.XCSF* %0, %struct.Cl* %1) {
%3 = tail call double @pred_size(%struct.XCSF* %0, %struct.Cl* %1)
ret double %3
}
/* Variables and functions */
int getchr();
int /*<<< orphan*/ ungetcc(int);
void get_return(void) {
  int c;
  c = getchr();
  if (c != '\n' && c != '\r' && c != ' ' && c != (-2))
    ungetcc(c);
}


x86 assembly (clang, -O0):
<get_return>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchr@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
je     1162 <get_return+0x42>
cmpl   $0xd,-0x4(%rbp)
je     1162 <get_return+0x42>
cmpl   $0x20,-0x4(%rbp)
je     1162 <get_return+0x42>
cmpl   $0xfffffffe,-0x4(%rbp)
je     1162 <get_return+0x42>
mov    -0x4(%rbp),%edi
call   1040 <ungetcc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_return>:
push   %rax
xor    %eax,%eax
call   1030 <getchr@plt>
lea    0x2(%rax),%ecx
cmp    $0x22,%ecx
ja     1142 <get_return+0x22>
movabs $0x400009001,%rdx
bt     %rcx,%rdx
jae    1142 <get_return+0x22>
pop    %rax
ret
mov    %eax,%edi
pop    %rax
jmp    1040 <ungetcc@plt>

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

LLVM IR (-O2):
define void @get_return() {
%1 = tail call i32 (...) @getchr()
switch i32 %1, label %2 [
i32 -2, label %4
i32 32, label %4
i32 13, label %4
i32 10, label %4
]
2: ; preds = %0
%3 = tail call i32 @ungetcc(i32 %1)
br label %4
4: ; preds = %0, %0, %0, %0, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isodigit(int);
void t_isodigit_0xf1() {
  Assert_real((isodigit(241) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isodigit.c",
              1210, ("isodigit should be 0 for 0xf1"));
}


x86 assembly (clang, -O0):
<t_isodigit_0xf1>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf1,%edi
call   1040 <isodigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x4ba,%edx
lea    0xf5c(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isodigit_0xf1>:
push   %rax
mov    $0xf1,%edi
call   1040 <isodigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x4ba,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0xf1\00"
define void @t_isodigit_0xf1() {
%1 = call i64 @isodigit(i32 241)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1210, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0xf1\00"
define void @t_isodigit_0xf1() {
%1 = tail call i64 @isodigit(i32 241)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1210, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *sncopy_char(char *, char const *, int, char);
char *sncopy_spc(char *d, const char *s, int n) {
  return sncopy_char(d, s, n, ' ');
}


x86 assembly (clang, -O0):
<sncopy_spc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x20,%ecx
call   1030 <sncopy_char@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sncopy_spc>:
mov    $0x20,%ecx
jmp    1030 <sncopy_char@plt>

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

LLVM IR (-O2):
define i8* @sncopy_spc(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @sncopy_char(i8* %0, i8* %1, i32 %2, i8 signext 32)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int, int);
void logMsgSend(int t, int srcAddr, int destAddr, int msgLen, int msgId) {
  printf("%3d: node %d starts send msg %d to %d, %d packets\n", t, srcAddr,
         msgId, destAddr, msgLen);
}


x86 assembly (clang, -O0):
<logMsgSend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logMsgSend>:
mov    %ecx,%r9d
mov    %edx,%eax
mov    %esi,%edx
mov    %edi,%esi
lea    0xee0(%rip),%rdi
mov    %r8d,%ecx
mov    %eax,%r8d
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"%3d: node %d starts send msg %d to %d, %d packets\0A\00"
define void @logMsgSend(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %10
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12, i32 %13, i32 %14, i32 %15)
ret void
}

LLVM IR (-O2):
@.str = [51 x i8] c"%3d: node %d starts send msg %d to %d, %d packets\0A\00"
define void @logMsgSend(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %4, i32 %2, i32 %3)
ret void
}
/* Variables and functions */
int *malloc(int);
void diagnosticTest(int in) {
  if (in > 5) {
    int *p = malloc(12);
    (*p)++;
  }
  in++;
}


x86 assembly (clang, -O0):
<diagnosticTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jle    113e <diagnosticTest+0x2e>
mov    $0xc,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diagnosticTest>:
cmp    $0x6,%edi
jl     1127 <diagnosticTest+0x17>
push   %rax
mov    $0xc,%edi
call   1030 <malloc@plt>
addl   $0x1,(%rax)
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @diagnosticTest(i32 %0) {
%2 = icmp sgt i32 %0, 5
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = tail call i32* @malloc(i32 12)
%5 = load i32, i32* %4
%6 = add nsw i32 %5, 1
store i32 %6, i32* %4
br label %7
7: ; preds = %3, %1
ret void
}
OP(ed, c6) { illegal_2(); }


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <illegal_2@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_2()
ret i32 undef
}
/* Variables and functions */
int f225(int *);
int f226(int *p) { return f225(p); }


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

x86 assembly (clang, -O2):
<f226>:
jmp    1030 <f225@plt>

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

LLVM IR (-O2):
define i32 @f226(i32* %0) {
%2 = tail call i32 @f225(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void not_enough_arg_space(void *arg) {
  fprintf(stderr, "Arguments to function too large.\n");
  exit(-50);
}


x86 assembly (clang, -O0):
<not_enough_arg_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffce,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<not_enough_arg_space>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffce,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Arguments to function too large.\0A\00"
define void @not_enough_arg_space(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @exit(i32 -50)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Arguments to function too large.\0A\00"
define void @not_enough_arg_space(i8* nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 -50)
unreachable
}