xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fib(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  printf("Enter number: ");
  scanf("%d", &n);
  fib(n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1050 <fib@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
call   1050 <fib@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter number: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 @fib(i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter number: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @fib(i32 %5)
ret i32 0
}
void free_matrix(int m, float **a) {
  int i;
  for (i = 0; i < m; ++i) {
    free(a[i]);
  }
  free(a);
}


x86 assembly (clang, -O0):
<free_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1151 <free_matrix+0x41>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <free_matrix+0x16>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_matrix>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
test   %edi,%edi
jle    1142 <free_matrix+0x32>
mov    %edi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_matrix+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_matrix(i32 %0, float** %1) {
%3 = alloca i32
%4 = alloca float**
%5 = alloca i32
store i32 %0, i32* %3
store float** %1, float*** %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load float**, float*** %4
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds float*, float** %11, i64 %13
%15 = load float*, float** %14
%16 = bitcast float* %15 to i8*
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
%21 = load float**, float*** %4
%22 = bitcast float** %21 to i8*
ret void
}

LLVM IR (-O2):
define void @free_matrix(i32 %0, float** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds float*, float** %1, i64 %7
%9 = bitcast float** %8 to i8**
%10 = load i8*, i8** %9
tail call void @free(i8* %10)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = bitcast float** %1 to i8*
tail call void @free(i8* %14)
ret void
}
int ungetch(int n) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ungetch(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __funcs_on_exit();
int /*<<< orphan*/ __stdio_exit();
void __wasm_call_dtors(void) {
  __funcs_on_exit();
  __stdio_exit();
}


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

x86 assembly (clang, -O2):
<__wasm_call_dtors>:
push   %rax
xor    %eax,%eax
call   1040 <__funcs_on_exit@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <__stdio_exit@plt>

LLVM IR (-O0):
define void @__wasm_call_dtors() {
%1 = call i32 (...) @__funcs_on_exit()
%2 = call i32 (...) @__stdio_exit()
ret void
}

LLVM IR (-O2):
define void @__wasm_call_dtors() {
%1 = tail call i32 (...) @__funcs_on_exit()
%2 = tail call i32 (...) @__stdio_exit()
ret void
}
int test_imm_A0uint32_mem(unsigned int *val) {
  return ((*val) & (0xA0 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_A0uint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 160
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
void f(int *p, int n) {
  foo(*(p + n++ * 4));
  foo(*(p + 32 + n++ * 4));
  foo(*(p + 16 + n * 4));
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
shl    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <foo@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
shl    $0x2,%ecx
movslq %ecx,%rcx
mov    0x80(%rax,%rcx,4),%edi
call   1030 <foo@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
mov    0x40(%rax,%rcx,4),%edi
call   1030 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
lea    0x0(,%rbx,4),%eax
cltq
mov    (%rdi,%rax,4),%edi
call   1030 <foo@plt>
lea    0x4(,%rbx,4),%eax
cltq
mov    0x80(%r14,%rax,4),%edi
call   1030 <foo@plt>
lea    0x8(,%rbx,4),%eax
cltq
mov    0x40(%r14,%rax,4),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <foo@plt>

LLVM IR (-O0):
define void @f(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 %6, 1
store i32 %7, i32* %4
%8 = mul nsw i32 %6, 4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %5, i64 %9
%11 = load i32, i32* %10
%12 = call i32 @foo(i32 %11)
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i64 32
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
%17 = mul nsw i32 %15, 4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %14, i64 %18
%20 = load i32, i32* %19
%21 = call i32 @foo(i32 %20)
%22 = load i32*, i32** %3
%23 = getelementptr inbounds i32, i32* %22, i64 16
%24 = load i32, i32* %4
%25 = mul nsw i32 %24, 4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %23, i64 %26
%28 = load i32, i32* %27
%29 = call i32 @foo(i32 %28)
ret void
}

LLVM IR (-O2):
define void @f(i32* nocapture %0, i32 %1) {
%3 = shl nsw i32 %1, 2
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = tail call i32 @foo(i32 %6)
%8 = getelementptr inbounds i32, i32* %0, i64 32
%9 = add i32 %3, 4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
%13 = tail call i32 @foo(i32 %12)
%14 = getelementptr inbounds i32, i32* %0, i64 16
%15 = add i32 %3, 8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = tail call i32 @foo(i32 %18)
ret void
}
__attribute__((no, noclone)) signed __int128 t100_4add(signed __int128 x) {
  signed __int128 y = (3);
  signed __int128 r;
  if (__builtin_add_overflow(x, y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x3,-0x40(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%rax
add    %rsi,%rdx
adc    %rax,%rcx
seto   %al
mov    %rdx,-0x50(%rbp)
mov    %rcx,-0x48(%rbp)
test   $0x1,%al
jne    116e <t100_4add+0x5e>
jmp    1175 <t100_4add+0x65>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x50(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x3,%rbx
adc    $0x0,%r14
jno    112b <t100_4add+0x1b>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rax
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t100_4add(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = alloca i128
%8 = bitcast i128* %4 to { i64, i64 }*
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 0
store i64 %0, i64* %9
%10 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 1
store i64 %1, i64* %10
%11 = load i128, i128* %4
store i128 %11, i128* %5
store i128 3, i128* %6
%12 = load i128, i128* %5
%13 = load i128, i128* %6
%14 = call { i128, i1 } @llvm.sadd.with.overflow.i128(i128 %12, i128 %13)
%15 = extractvalue { i128, i1 } %14, 1
%16 = extractvalue { i128, i1 } %14, 0
store i128 %16, i128* %7
br i1 %15, label %17, label %19
17: ; preds = %2
%18 = call i32 (...) @bar()
br label %19
19: ; preds = %17, %2
%20 = load i128, i128* %7
store i128 %20, i128* %3
%21 = bitcast i128* %3 to { i64, i64 }*
%22 = load { i64, i64 }, { i64, i64 }* %21
ret { i64, i64 } %22
}

LLVM IR (-O2):
define { i64, i64 } @t100_4add(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = tail call { i128, i1 } @llvm.sadd.with.overflow.i128(i128 %6, i128 3)
%8 = extractvalue { i128, i1 } %7, 1
%9 = extractvalue { i128, i1 } %7, 0
br i1 %8, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i128 %9 to i64
%14 = lshr i128 %9, 64
%15 = trunc i128 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
int UARTTransmitEmpty(void) {
  char x = *((char *)0xFFFFFFE5);
  if (x & (1 << 6))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<UARTTransmitEmpty>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffe5,%eax
mov    (%rax),%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     112a <UARTTransmitEmpty+0x2a>
movl   $0x1,-0x4(%rbp)
jmp    1131 <UARTTransmitEmpty+0x31>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTTransmitEmpty>:
mov    $0xffffffe5,%eax
movzbl (%rax),%eax
shr    $0x6,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @UARTTransmitEmpty() {
%1 = alloca i32
%2 = alloca i8
%3 = load i8, i8* inttoptr (i64 4294967269 to i8*)
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = and i32 %5, 64
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 1, i32* %1
br label %10
9: ; preds = %0
store i32 0, i32* %1
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
define i32 @UARTTransmitEmpty() {
%1 = load i8, i8* inttoptr (i64 4294967269 to i8*)
%2 = lshr i8 %1, 6
%3 = and i8 %2, 1
%4 = zext i8 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void U_EMRNOTIMPLEMENTED_print(const char *name, const char *contents) {
  (void)(name);
  (void)(contents);
  printf("   Not Implemented!\n");
}


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

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

LLVM IR (-O0):
@.str = [21 x i8] c" Not Implemented!\0A\00"
define void @U_EMRNOTIMPLEMENTED_print(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 i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c" Not Implemented!\00"
define void @U_EMRNOTIMPLEMENTED_print(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ swapchar(char *, char *);
void swapchar2(void *a, void *b, long s) {
  swapchar(a, b);
  swapchar((char *)a + 1, (char *)b + s);
}


x86 assembly (clang, -O0):
<swapchar2>:
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
call   1030 <swapchar@plt>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
add    -0x18(%rbp),%rsi
call   1030 <swapchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapchar2>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <swapchar@plt>
add    $0x1,%rbx
add    %r14,%r15
mov    %rbx,%rdi
mov    %r15,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <swapchar@plt>

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

LLVM IR (-O2):
define void @swapchar2(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @swapchar(i8* %0, i8* %1)
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = getelementptr inbounds i8, i8* %1, i64 %2
%7 = tail call i32 @swapchar(i8* %5, i8* %6)
ret void
}
unsigned long arch_ffz(unsigned long bitmask) {
  __asm__("bsf %1,%0" : "=r"(bitmask) : "r"(~bitmask));
  return bitmask;
}


x86 assembly (clang, -O0):
<arch_ffz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
xor    $0xffffffffffffffff,%rax
bsf    %rax,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<arch_ffz>:
not    %rdi
bsf    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @arch_ffz(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = xor i64 %3, -1
%5 = call i64 asm "bsf $1,$0", "=r,r,~{dirflag},~{fpsr},~{flags}"(i64 %4)
store i64 %5, i64* %2
%6 = load i64, i64* %2
ret i64 %6
}

LLVM IR (-O2):
define i64 @arch_ffz(i64 %0) {
%2 = xor i64 %0, -1
%3 = tail call i64 asm "bsf $1,$0", "=r,r,~{dirflag},~{fpsr},~{flags}"(i64 %2)
ret i64 %3
}
int utwrap() { return 1; }


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

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

LLVM IR (-O0):
define i32 @utwrap() {
ret i32 1
}

LLVM IR (-O2):
define i32 @utwrap() {
ret i32 1
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite_err(void *, int, int, int /*<<< orphan*/ *);
void toasim_write_64(char *fname, void *val, FILE *file) {
  uint32_t sz = 8;
  fwrite_err(fname, 4, 1, file);
  fwrite_err(&sz, 4, 1, file);
  fwrite_err(val, sz, 1, file);
}


x86 assembly (clang, -O0):
<toasim_write_64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x8,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite_err@plt>
lea    -0x1c(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fwrite_err@plt>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
call   1030 <fwrite_err@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toasim_write_64>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
movl   $0x8,0x4(%rsp)
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite_err@plt>
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite_err@plt>
mov    0x4(%rsp),%esi
mov    %r14,%rdi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite_err@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @toasim_write_64(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
store i32 8, i32* %7
%8 = load i8*, i8** %4
%9 = load i32*, i32** %6
%10 = call i32 @fwrite_err(i8* %8, i32 4, i32 1, i32* %9)
%11 = bitcast i32* %7 to i8*
%12 = load i32*, i32** %6
%13 = call i32 @fwrite_err(i8* %11, i32 4, i32 1, i32* %12)
%14 = load i8*, i8** %5
%15 = load i32, i32* %7
%16 = load i32*, i32** %6
%17 = call i32 @fwrite_err(i8* %14, i32 %15, i32 1, i32* %16)
ret void
}

LLVM IR (-O2):
define void @toasim_write_64(i8* %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
store i32 8, i32* %4
%6 = tail call i32 @fwrite_err(i8* %0, i32 4, i32 1, i32* %2)
%7 = call i32 @fwrite_err(i8* %5, i32 4, i32 1, i32* %2)
%8 = load i32, i32* %4
%9 = call i32 @fwrite_err(i8* %1, i32 %8, i32 1, i32* %2)
ret void
}
/* Variables and functions */
void *alloc5(int volatile);
void *alloc4(volatile int one) { return alloc5(one); }


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

x86 assembly (clang, -O2):
<alloc4>:
mov    %edi,-0x4(%rsp)
mov    -0x4(%rsp),%edi
jmp    1030 <alloc5@plt>

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

LLVM IR (-O2):
define i8* @alloc4(i32 %0) {
%2 = alloca i32
store volatile i32 %0, i32* %2
%3 = load volatile i32, i32* %2
%4 = tail call i8* @alloc5(i32 %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *, int, int);
int tankVol(int, int, int);
void dotest(int h, int d, int vt, int expr) {
  int act = tankVol(h, d, vt);
  if (act != expr)
    printf("Error. Expected %d but got %d\n", expr, act);
  assert(act == expr);
}


x86 assembly (clang, -O0):
<dotest>:
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    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <tankVol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1173 <dotest+0x43>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dotest>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebx
call   1030 <tankVol@plt>
mov    %eax,%ebp
cmp    %ebx,%eax
je     1150 <dotest+0x20>
lea    0xeb9(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1040 <printf@plt>
xor    %edi,%edi
cmp    %ebx,%ebp
sete   %dil
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <assert@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Error. Expected %d but got %d\0A\00"
define void @dotest(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = call i32 @tankVol(i32 %10, i32 %11, i32 %12)
store i32 %13, i32* %9
%14 = load i32, i32* %9
%15 = load i32, i32* %8
%16 = icmp ne i32 %14, %15
br i1 %16, label %17, label %21
17: ; preds = %4
%18 = load i32, i32* %8
%19 = load i32, i32* %9
%20 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %19)
br label %21
21: ; preds = %17, %4
%22 = load i32, i32* %9
%23 = load i32, i32* %8
%24 = icmp eq i32 %22, %23
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Error. Expected %d but got %d\0A\00"
define void @dotest(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @tankVol(i32 %0, i32 %1, i32 %2)
%6 = icmp eq i32 %5, %3
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5)
br label %9
9: ; preds = %7, %4
%10 = zext i1 %6 to i32
%11 = tail call i32 @assert(i32 %10)
ret void
}
/* Variables and functions */
int MyStaticFunction();
int main() { return MyStaticFunction(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <MyStaticFunction@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @MyStaticFunction()
ret i32 %1
}
int test_imm_6Duint16_reg(unsigned short val) {
  return ((val) & (0x6D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Duint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x6d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_6Duint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 109
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void f(int a) { a = a + 1; }


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

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

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

LLVM IR (-O2):
define void @f(i32 %0) {
ret void
}
int main() { return 5; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 5
}
append_nonterm_member(n) { append_member(n); }


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

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

LLVM IR (-O0):
define i32 @append_nonterm_member(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 (i32, ...) bitcast (i32 (...)* @append_member to i32 (i32, ...)*)(i32 %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @append_nonterm_member(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @append_member to i32 (i32, ...)*)(i32 %0)
ret i32 undef
}
int foo() {
  int a[2] = {1, 2}, b[2] = {3, 4};
  char c = 'a';
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    0xef5(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xef2(%rip),%rax
mov    %rax,-0x14(%rbp)
movb   $0x61,-0x15(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.foo.a = [2 x i32] [i32 1, i32 2]
@__const.foo.b = [2 x i32] [i32 3, i32 4]
define i32 @foo() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca [2 x i32]
%4 = alloca i8
%5 = bitcast [2 x i32]* %2 to i8*
%6 = bitcast [2 x i32]* %3 to i8*
store i8 97, i8* %4
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
define i32 @foo() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ uart_puts(char *);
void handle_dabt(void) {
  uart_puts("\nData Abort");
  while (1)
    ;
  return;
}


x86 assembly (clang, -O0):
<handle_dabt>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <uart_puts@plt>
jmp    1120 <handle_dabt+0x10>

x86 assembly (clang, -O2):
<handle_dabt>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <uart_puts@plt>
nopl   (%rax)
jmp    1120 <handle_dabt+0x10>

LLVM IR (-O0):
@.str = [12 x i8] c"\0AData Abort\00"
define void @handle_dabt() {
%1 = call i32 @uart_puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
@.str = [12 x i8] c"\0AData Abort\00"
define void @handle_dabt() {
%1 = tail call i32 @uart_puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}
void cvmx_pow_tag_sw_null(void) {
  if (1)
    __cvmx_pow_warn_if_pending_switch(__FUNCTION__);
  cvmx_pow_tag_sw_wait();
  cvmx_pow_tag_sw_null_nocheck();
}


x86 assembly (clang, -O0):
<cvmx_pow_tag_sw_null>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1050 <__cvmx_pow_warn_if_pending_switch@plt>
mov    $0x0,%al
call   1040 <cvmx_pow_tag_sw_wait@plt>
mov    $0x0,%al
call   1030 <cvmx_pow_tag_sw_null_nocheck@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cvmx_pow_tag_sw_null>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1050 <__cvmx_pow_warn_if_pending_switch@plt>
xor    %eax,%eax
call   1040 <cvmx_pow_tag_sw_wait@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <cvmx_pow_tag_sw_null_nocheck@plt>

LLVM IR (-O0):
@__FUNCTION__.cvmx_pow_tag_sw_null = [21 x i8] c"cvmx_pow_tag_sw_null\00"
define void @cvmx_pow_tag_sw_null() {
%1 = call i32 (i8*, ...) bitcast (i32 (...)* @__cvmx_pow_warn_if_pending_switch to i32 (i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__FUNCTION__.cvmx_pow_tag_sw_null, i64 0, i64 0))
%2 = call i32 (...) @cvmx_pow_tag_sw_wait()
%3 = call i32 (...) @cvmx_pow_tag_sw_null_nocheck()
ret void
}

LLVM IR (-O2):
@__FUNCTION__.cvmx_pow_tag_sw_null = [21 x i8] c"cvmx_pow_tag_sw_null\00"
define void @cvmx_pow_tag_sw_null() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @__cvmx_pow_warn_if_pending_switch to i32 (i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__FUNCTION__.cvmx_pow_tag_sw_null, i64 0, i64 0))
%2 = tail call i32 (...) @cvmx_pow_tag_sw_wait()
%3 = tail call i32 (...) @cvmx_pow_tag_sw_null_nocheck()
ret void
}
void g_signal_new_valist() {}


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

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

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

LLVM IR (-O2):
define void @g_signal_new_valist() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ printf(char *, int);
int waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
void sighandler(int signo) {
  printf("catch signo = %d\n", signo);
  while (1) {
    int ret = waitpid(-1, NULL, WNOHANG);
    printf("ret = %d\n", ret);
    if (ret > 0)
      return;
  }
}


x86 assembly (clang, -O0):
<sighandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <waitpid@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1173 <sighandler+0x53>
add    $0x10,%rsp
pop    %rbp
ret
jmp    113a <sighandler+0x1a>

x86 assembly (clang, -O2):
<sighandler>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%esi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eaf(%rip),%r14
lea    0xed2(%rip),%rbx
mov    (%r14),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1040 <waitpid@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
test   %ebp,%ebp
jle    1140 <sighandler+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"catch signo = %d\0A\00"
@WNOHANG = global i32 0
@.str.1 = [10 x i8] c"ret = %d\0A\00"
define void @sighandler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %6
6: ; preds = %1, %14
%7 = load i32, i32* @WNOHANG
%8 = call i32 @waitpid(i32 -1, i32* null, i32 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %6
ret void
14: ; preds = %6
br label %6
}

LLVM IR (-O2):
@.str = [18 x i8] c"catch signo = %d\0A\00"
@WNOHANG = global i32 0
@.str.1 = [10 x i8] c"ret = %d\0A\00"
define void @sighandler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %3
3: ; preds = %3, %1
%4 = load i32, i32* @WNOHANG
%5 = tail call i32 @waitpid(i32 -1, i32* null, i32 %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = icmp slt i32 %5, 1
br i1 %7, label %3, label %8
8: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
main() {
  printf("%c\n", 'c', 'i', 'c', '-', 't', 'e', 's', 't');
  printf("it is not so simple");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee1(%rip),%rdi
mov    $0x63,%ecx
mov    $0x69,%edx
mov    $0x2d,%r8d
mov    $0x74,%r9d
mov    %ecx,%esi
movl   $0x65,(%rsp)
movl   $0x73,0x8(%rsp)
movl   $0x74,0x10(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
sub    $0x8,%rsp
lea    0xee4(%rip),%rdi
mov    $0x63,%esi
mov    $0x69,%edx
mov    $0x63,%ecx
mov    $0x2d,%r8d
mov    $0x74,%r9d
xor    %eax,%eax
push   $0x74
push   $0x73
push   $0x65
call   1030 <printf@plt>
add    $0x20,%rsp
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [20 x i8] c"it is not so simple\00"
define i32 @main() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 99, i32 105, i32 99, i32 45, i32 116, i32 101, i32 115, i32 116)
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [20 x i8] c"it is not so simple\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 99, i32 105, i32 99, i32 45, i32 116, i32 101, i32 115, i32 116)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
char *gs_substr(char *, size_t, size_t);
char *strdup(char *);
char *gs_substr_m(char *str, size_t pos, size_t len) {
  char *ptr;
  if (!str)
    return NULL;
  ptr = strdup(str);
  if (!ptr)
    return NULL;
  return gs_substr(ptr, pos, len);
}


x86 assembly (clang, -O0):
<gs_substr_m>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114c <gs_substr_m+0x2c>
movq   $0x0,-0x8(%rbp)
jmp    1186 <gs_substr_m+0x66>
mov    -0x10(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1171 <gs_substr_m+0x51>
movq   $0x0,-0x8(%rbp)
jmp    1186 <gs_substr_m+0x66>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <gs_substr@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gs_substr_m>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     114e <gs_substr_m+0x2e>
mov    %rdx,%r14
mov    %rsi,%rbx
call   1040 <strdup@plt>
test   %rax,%rax
je     114e <gs_substr_m+0x2e>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <gs_substr@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @gs_substr_m(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %3
store i8* null, i8** %4
br label %23
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = call i8* @strdup(i8* %13)
store i8* %14, i8** %8
%15 = load i8*, i8** %8
%16 = icmp ne i8* %15, null
br i1 %16, label %18, label %17
17: ; preds = %12
store i8* null, i8** %4
br label %23
18: ; preds = %12
%19 = load i8*, i8** %8
%20 = load i64, i64* %6
%21 = load i64, i64* %7
%22 = call i8* @gs_substr(i8* %19, i64 %20, i64 %21)
store i8* %22, i8** %4
br label %23
23: ; preds = %18, %17, %11
%24 = load i8*, i8** %4
ret i8* %24
}

LLVM IR (-O2):
define i8* @gs_substr_m(i8* %0, i64 %1, i64 %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = tail call i8* @strdup(i8* %0)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i8* @gs_substr(i8* %6, i64 %1, i64 %2)
br label %10
10: ; preds = %5, %3, %8
%11 = phi i8* [ %9, %8 ], [ null, %3 ], [ null, %5 ]
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ showbyte(char *, int);
void showint(int a) {
  printf("int a=%d\t// Hex:%x\n", a, a);
  showbyte((char *)&a, sizeof(int));
}


x86 assembly (clang, -O0):
<showint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
lea    -0x4(%rbp),%rdi
mov    $0x4,%esi
call   1040 <showbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showint>:
push   %rax
mov    %edi,%edx
mov    %edi,0x4(%rsp)
lea    0xed2(%rip),%rdi
mov    %edx,%esi
call   1030 <printf@plt>
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
call   1040 <showbyte@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [20 x i8] c"int a=%d\09// Hex:%x\0A\00"
define void @showint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = bitcast i32* %2 to i8*
%7 = call i32 @showbyte(i8* %6, i32 4)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"int a=%d\09// Hex:%x\0A\00"
define void @showint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %0)
%4 = bitcast i32* %2 to i8*
%5 = call i32 @showbyte(i8* %4, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ do_console_tx_string(char const *);
void __console_tx_string(int loglevel, const char *str) {
  if (8 > loglevel) {
    do_console_tx_string(str);
  }
}


x86 assembly (clang, -O0):
<__console_tx_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x8,%eax
cmp    -0x4(%rbp),%eax
jle    1136 <__console_tx_string+0x26>
mov    -0x10(%rbp),%rdi
call   1030 <do_console_tx_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__console_tx_string>:
cmp    $0x7,%edi
jg     111d <__console_tx_string+0xd>
mov    %rsi,%rdi
jmp    1030 <do_console_tx_string@plt>
ret

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

LLVM IR (-O2):
define void @__console_tx_string(i32 %0, i8* %1) {
%3 = icmp slt i32 %0, 8
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @do_console_tx_string(i8* %1)
br label %6
6: ; preds = %4, %2
ret void
}
/* Variables and functions */
double ceil(double);
double by_weight(double rate, double weight, double concentration) {
  return ceil(rate * weight * (1 / concentration));
}


x86 assembly (clang, -O0):
<by_weight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xec7(%rip),%xmm1
divsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <ceil@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<by_weight>:
mulsd  %xmm1,%xmm0
movsd  0xee4(%rip),%xmm1
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
jmp    1030 <ceil@plt>

LLVM IR (-O0):
define double @by_weight(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fmul double %7, %8
%10 = load double, double* %6
%11 = fdiv double 1.000000e+00, %10
%12 = fmul double %9, %11
%13 = call double @llvm.ceil.f64(double %12)
ret double %13
}

LLVM IR (-O2):
define double @by_weight(double %0, double %1, double %2) {
%4 = fmul double %0, %1
%5 = fdiv double 1.000000e+00, %2
%6 = fmul double %4, %5
%7 = tail call double @llvm.ceil.f64(double %6)
ret double %7
}
/* Type definitions */
struct arreader {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void die(struct arreader *a, const char *m) {
  printf("%s\n", m);
  exit(22);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x16,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
mov    $0x16,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
%struct.arreader = type { i32 }
@.str = [4 x i8] c"%s\0A\00"
define void @die(%struct.arreader* %0, i8* %1) {
%3 = alloca %struct.arreader*
%4 = alloca i8*
store %struct.arreader* %0, %struct.arreader** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i32 @exit(i32 22)
unreachable
}

LLVM IR (-O2):
%struct.arreader = type { i32 }
@.str = [4 x i8] c"%s\0A\00"
define void @die(%struct.arreader* nocapture readnone %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = tail call i32 @exit(i32 22)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char *);
int main(int argc, char *argv[]) {
  int i;
  for (i = 0; i < argc; i++) {
    printf("%d:%s\n", i, argv[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1162 <main+0x52>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1147 <main+0x37>
mov    %rsi,%r14
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d:%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = trunc i64 %7 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %9)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DRV_FREE(void *);
void internal_free(void *p) { DRV_FREE(p); }


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

x86 assembly (clang, -O2):
<internal_free>:
jmp    1030 <DRV_FREE@plt>

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

LLVM IR (-O2):
define void @internal_free(i8* %0) {
%2 = tail call i32 @DRV_FREE(i8* %0)
ret void
}
/* Variables and functions */
unsigned int __sw32(int);
void out_le32(volatile unsigned *addr, int val) { *addr = __sw32(val); }


x86 assembly (clang, -O0):
<out_le32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <__sw32@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<out_le32>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <__sw32@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @out_le32(i32* %0, i32 %1) {
%3 = tail call i32 @__sw32(i32 %1)
store volatile i32 %3, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void jv_mem_free(void *p) { free(p); }


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

x86 assembly (clang, -O2):
<jv_mem_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @jv_mem_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GJerror(char const *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void error(const char *str, int flag) {
  GJerror(str);
  if (flag)
    exit(0);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <GJerror@plt>
cmpl   $0x0,-0xc(%rbp)
je     1149 <error+0x29>
xor    %edi,%edi
call   1030 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error>:
push   %rbx
mov    %esi,%ebx
call   1040 <GJerror@plt>
test   %ebx,%ebx
jne    112e <error+0xe>
pop    %rbx
ret
xor    %edi,%edi
call   1030 <exit@plt>

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

LLVM IR (-O2):
define void @error(i8* %0, i32 %1) {
%3 = tail call i32 @GJerror(i8* %0)
%4 = icmp eq i32 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lirerr(int);
void expand_rawdat(void) { lirerr(999997); }


x86 assembly (clang, -O0):
<expand_rawdat>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf423d,%edi
call   1030 <lirerr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<expand_rawdat>:
mov    $0xf423d,%edi
jmp    1030 <lirerr@plt>

LLVM IR (-O0):
define void @expand_rawdat() {
%1 = call i32 @lirerr(i32 999997)
ret void
}

LLVM IR (-O2):
define void @expand_rawdat() {
%1 = tail call i32 @lirerr(i32 999997)
ret void
}
int test3(int a, int b, int c) { return a = b = c; }


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

x86 assembly (clang, -O2):
<test3>:
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @test3(i32 %0, i32 %1, i32 returned %2) {
ret i32 %2
}