xunge/DecIR huggingface dataset:
/* Type definitions */
struct mx_proc_tree {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int mx_proc_tree(struct mx_proc_tree **);
int /*<<< orphan*/ mx_proc_tree_free(struct mx_proc_tree **);
int /*<<< orphan*/ mx_proc_tree_print_debug(struct mx_proc_tree *);
int main(void) {
  int res;
  struct mx_proc_tree *pt = NULL;
  res = mx_proc_tree(&pt);
  assert(res == 0);
  mx_proc_tree_print_debug(pt);
  mx_proc_tree_free(&pt);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <mx_proc_tree@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1060 <mx_proc_tree_print_debug@plt>
lea    -0x10(%rbp),%rdi
call   1050 <mx_proc_tree_free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <mx_proc_tree@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    0x8(%rsp),%rdi
call   1060 <mx_proc_tree_print_debug@plt>
mov    %rbx,%rdi
call   1050 <mx_proc_tree_free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.mx_proc_tree = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.mx_proc_tree*
store i32 0, i32* %1
store %struct.mx_proc_tree* null, %struct.mx_proc_tree** %3
%4 = call i32 @mx_proc_tree(%struct.mx_proc_tree** %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load %struct.mx_proc_tree*, %struct.mx_proc_tree** %3
%10 = call i32 @mx_proc_tree_print_debug(%struct.mx_proc_tree* %9)
%11 = call i32 @mx_proc_tree_free(%struct.mx_proc_tree** %3)
ret i32 0
}

LLVM IR (-O2):
%struct.mx_proc_tree = type { i32 }
define i32 @main() {
%1 = alloca %struct.mx_proc_tree*
%2 = bitcast %struct.mx_proc_tree** %1 to i8*
store %struct.mx_proc_tree* null, %struct.mx_proc_tree** %1
%3 = call i32 @mx_proc_tree(%struct.mx_proc_tree** %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load %struct.mx_proc_tree*, %struct.mx_proc_tree** %1
%8 = call i32 @mx_proc_tree_print_debug(%struct.mx_proc_tree* %7)
%9 = call i32 @mx_proc_tree_free(%struct.mx_proc_tree** %1)
ret i32 0
}
void genfloor_l_d() {}


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

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

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

LLVM IR (-O2):
define void @genfloor_l_d() {
ret void
}
int ft_strequ(char const *s1, char const *s2) {
  if (s1 == '\0' && s2 == '\0')
    return (0);
  if (s1 && s2 && (ft_strcmp(s1, s2) == 0))
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<ft_strequ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1142 <ft_strequ+0x32>
cmpq   $0x0,-0x18(%rbp)
jne    1142 <ft_strequ+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1183 <ft_strequ+0x73>
cmpq   $0x0,-0x10(%rbp)
je     117c <ft_strequ+0x6c>
cmpq   $0x0,-0x18(%rbp)
je     117c <ft_strequ+0x6c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <ft_strcmp@plt>
cmp    $0x0,%eax
jne    117c <ft_strequ+0x6c>
movl   $0x1,-0x4(%rbp)
jmp    1183 <ft_strequ+0x73>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strequ>:
push   %rbx
xor    %ebx,%ebx
mov    %rdi,%rax
or     %rsi,%rax
je     1135 <ft_strequ+0x25>
test   %rdi,%rdi
je     1135 <ft_strequ+0x25>
test   %rsi,%rsi
je     1135 <ft_strequ+0x25>
xor    %eax,%eax
call   1030 <ft_strcmp@plt>
test   %eax,%eax
jne    1135 <ft_strequ+0x25>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ft_strequ(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %14, label %6
6: ; preds = %2
%7 = icmp ne i8* %0, null
%8 = icmp ne i8* %1, null
%9 = and i1 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @ft_strcmp to i32 (i8*, i8*, ...)*)(i8* %0, i8* %1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %10, %6
br label %14
14: ; preds = %10, %2, %13
%15 = phi i32 [ 0, %13 ], [ 0, %2 ], [ 1, %10 ]
ret i32 %15
}
__attribute__((always_)) int register_trace_mm_page_alloc_extfrag(
    void (*probe)(void *__data, struct page *page, int alloc_order,
                  int fallback_order, int alloc_migratetype,
                  int fallback_migratetype),
    void *data) {
  return -38;
}


x86 assembly (clang, -O0):
<register_trace_mm_page_alloc_extfrag>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffda,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.page = type opaque
define i32 @register_trace_mm_page_alloc_extfrag(void (i8*, %struct.page*, i32, i32, i32, i32)* %0, i8* %1) {
%3 = alloca void (i8*, %struct.page*, i32, i32, i32, i32)*
%4 = alloca i8*
store void (i8*, %struct.page*, i32, i32, i32, i32)* %0, void (i8*, %struct.page*, i32, i32, i32, i32)** %3
store i8* %1, i8** %4
ret i32 -38
}

LLVM IR (-O2):
%struct.page = type opaque
define i32 @register_trace_mm_page_alloc_extfrag(void (i8*, %struct.page*, i32, i32, i32, i32)* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 -38
}
/* Variables and functions */
int /*<<< orphan*/ f(void *);
void bar(void) {
  extern void *alloca(long unsigned int);
  f(alloca(123));
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x80(%rbp),%rdi
call   1030 <f@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
sub    $0x88,%rsp
mov    %rsp,%rdi
call   1030 <f@plt>
add    $0x88,%rsp
ret

LLVM IR (-O0):
define void @bar() {
%1 = alloca i8, i64 123
%2 = call i32 @f(i8* %1)
ret void
}

LLVM IR (-O2):
define void @bar() {
%1 = alloca [123 x i8]
%2 = getelementptr inbounds [123 x i8], [123 x i8]* %1, i64 0, i64 0
%3 = call i32 @f(i8* %2)
ret void
}
/* Variables and functions */
int numa_available();
long long numa_node_size64(int const, int /*<<< orphan*/ *);
long long numanuma__get_mem_size(const int node) {
  if (numa_available() == -1)
    return -1;
  return numa_node_size64(node, NULL);
}


x86 assembly (clang, -O0):
<numanuma__get_mem_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    $0x0,%al
call   1040 <numa_available@plt>
cmp    $0xffffffff,%eax
jne    1148 <numanuma__get_mem_size+0x28>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1158 <numanuma__get_mem_size+0x38>
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <numa_node_size64@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numanuma__get_mem_size>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <numa_available@plt>
cmp    $0xffffffff,%eax
je     1139 <numanuma__get_mem_size+0x19>
mov    %ebx,%edi
xor    %esi,%esi
pop    %rbx
jmp    1030 <numa_node_size64@plt>
mov    $0xffffffffffffffff,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @numanuma__get_mem_size(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (...) @numa_available()
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 -1, i64* %2
br label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = call i64 @numa_node_size64(i32 %8, i32* null)
store i64 %9, i64* %2
br label %10
10: ; preds = %7, %6
%11 = load i64, i64* %2
ret i64 %11
}

LLVM IR (-O2):
define i64 @numanuma__get_mem_size(i32 %0) {
%2 = tail call i32 (...) @numa_available()
%3 = icmp eq i32 %2, -1
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i64 @numa_node_size64(i32 %0, i32* null)
br label %6
6: ; preds = %1, %4
%7 = phi i64 [ %5, %4 ], [ -1, %1 ]
ret i64 %7
}
void uDMAChannelAssign(unsigned long ulMapping) {
  unsigned long ulMapReg;
  unsigned long ulMapShift;
  unsigned long ulChannelNum;
  ;
  ;
  ;
  ;
  ;
  ;
  ulChannelNum = ulMapping & 0xff;
  ulMapping = ulMapping >> 16;
  ulMapReg = 0x400FF510 + ((ulChannelNum / 8) * 4);
  ulMapShift = (ulChannelNum % 8) * 4;
  (*((volatile unsigned long *)(ulMapReg))) =
      ((*((volatile unsigned long *)(ulMapReg))) & ~(0xf << ulMapShift)) |
      ulMapping << ulMapShift;
}


x86 assembly (clang, -O0):
<uDMAChannelAssign>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%rax
shr    $0x3,%rax
shl    $0x2,%rax
add    $0x400ff510,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
and    $0x7,%rax
shl    $0x2,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
mov    $0xf,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
shl    %cl,%rax
mov    -0x28(%rbp),%rcx
or     %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uDMAChannelAssign>:
mov    %rdi,%rax
lea    0x0(,%rdi,4),%ecx
shr    $0x10,%rdi
mov    $0xf,%edx
shl    %cl,%edx
shr    %rax
and    $0x7c,%eax
and    $0x1c,%cl
not    %edx
movslq %edx,%rdx
shl    %cl,%rdi
and    0x400ff510(%rax),%rdx
or     %rdx,%rdi
mov    %rdi,0x400ff510(%rax)
ret

LLVM IR (-O0):
define void @uDMAChannelAssign(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %2
%6 = load i64, i64* %2
%7 = and i64 %6, 255
store i64 %7, i64* %5
%8 = load i64, i64* %2
%9 = lshr i64 %8, 16
store i64 %9, i64* %2
%10 = load i64, i64* %5
%11 = udiv i64 %10, 8
%12 = mul i64 %11, 4
%13 = add i64 1074787600, %12
store i64 %13, i64* %3
%14 = load i64, i64* %5
%15 = urem i64 %14, 8
%16 = mul i64 %15, 4
store i64 %16, i64* %4
%17 = load i64, i64* %3
%18 = inttoptr i64 %17 to i64*
%19 = load volatile i64, i64* %18
%20 = load i64, i64* %4
%21 = trunc i64 %20 to i32
%22 = shl i32 15, %21
%23 = xor i32 %22, -1
%24 = sext i32 %23 to i64
%25 = and i64 %19, %24
%26 = load i64, i64* %2
%27 = load i64, i64* %4
%28 = shl i64 %26, %27
%29 = or i64 %25, %28
%30 = load i64, i64* %3
%31 = inttoptr i64 %30 to i64*
store volatile i64 %29, i64* %31
ret void
}

LLVM IR (-O2):
define void @uDMAChannelAssign(i64 %0) {
%2 = lshr i64 %0, 16
%3 = lshr i64 %0, 1
%4 = and i64 %3, 124
%5 = add nuw nsw i64 %4, 1074787600
%6 = shl i64 %0, 2
%7 = and i64 %6, 28
%8 = inttoptr i64 %5 to i64*
%9 = load volatile i64, i64* %8
%10 = trunc i64 %7 to i32
%11 = shl nuw i32 15, %10
%12 = xor i32 %11, -1
%13 = sext i32 %12 to i64
%14 = and i64 %9, %13
%15 = shl i64 %2, %7
%16 = or i64 %14, %15
store volatile i64 %16, i64* %8
ret void
}
void string_finalize() {}


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

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

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

LLVM IR (-O2):
define void @string_finalize() {
ret void
}
/* Variables and functions */
char *addbits(char *, char *);
char *addbits2(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
void main() {
  char str1[] = "1100101";
  char str2[] = "101";
  printf("res is %s \n", addbits(str1, str2));
  printf("res is %s \n", addbits2(str1, str2));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <addbits@plt>
mov    %rax,%rsi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <addbits2@plt>
mov    %rax,%rsi
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movabs $0x31303130303131,%rax
mov    %rax,0x8(%rsp)
movl   $0x313031,0x4(%rsp)
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <addbits@plt>
lea    0xe94(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <addbits2@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.str1 = [8 x i8] c"1100101\00"
@__const.main.str2 = [4 x i8] c"101\00"
@.str = [12 x i8] c"res is %s \0A\00"
define void @main() {
%1 = alloca [8 x i8]
%2 = alloca [4 x i8]
%3 = bitcast [8 x i8]* %1 to i8*
%4 = bitcast [4 x i8]* %2 to i8*
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%7 = call i8* @addbits(i8* %5, i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%11 = call i8* @addbits2(i8* %9, i8* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"res is %s \0A\00"
define void @main() {
%1 = alloca i64
%2 = alloca i32
%3 = bitcast i64* %1 to i8*
store i64 13845261678817585, i64* %1
%4 = bitcast i32* %2 to i8*
store i32 3223601, i32* %2
%5 = call i8* @addbits(i8* %3, i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i8* @addbits2(i8* %3, i8* %4)
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %7)
ret void
}
/* Variables and functions */
double __nv_dsqrt_rz(double);
double __dsqrt_rz(double __a) { return __nv_dsqrt_rz(__a); }


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

x86 assembly (clang, -O2):
<__dsqrt_rz>:
jmp    1030 <__nv_dsqrt_rz@plt>

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

LLVM IR (-O2):
define double @__dsqrt_rz(double %0) {
%2 = tail call double @__nv_dsqrt_rz(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void invalid_phase(char *s) {
  printf("Invalid phase%s\n", s);
  exit(8);
}


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

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

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

LLVM IR (-O2):
@.str = [17 x i8] c"Invalid phase%s\0A\00"
define void @invalid_phase(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 8)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ force_unwind();
__attribute__((no)) void foo(void *x __attribute__((unused))) {
  force_unwind();
}


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

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

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

LLVM IR (-O2):
define void @foo(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @force_unwind()
ret void
}
unsigned int hash1(const char *str) {
  unsigned int result = 0;
  while (*str)
    result = (result << 2) ^ *str++;
  return result & 0x03FF;
}


x86 assembly (clang, -O0):
<hash1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113e <hash1+0x3e>
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
xor    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <hash1+0xf>
mov    -0xc(%rbp),%eax
and    $0x3ff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash1>:
mov    (%rdi),%cl
test   %cl,%cl
je     112b <hash1+0x2b>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
mov    %eax,%edx
shl    $0x2,%edx
movsbl %cl,%eax
xor    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash1+0x10>
and    $0x3ff,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @hash1(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %4
%9 = load i32, i32* %3
%10 = shl i32 %9, 2
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
%13 = load i8, i8* %11
%14 = sext i8 %13 to i32
%15 = xor i32 %10, %14
store i32 %15, i32* %3
br label %4
16: ; preds = %4
%17 = load i32, i32* %3
%18 = and i32 %17, 1023
ret i32 %18
}

LLVM IR (-O2):
define i32 @hash1(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = shl i32 %6, 2
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i32
%11 = xor i32 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i32 %11, 1023
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Variables and functions */
unsigned int CalculateLog2Max65536(unsigned int);
unsigned int CalculateBitsNeededMax65536(unsigned int n) {
  unsigned int shift = CalculateLog2Max65536(n);
  shift += ((1 << shift) - n) >> 31;
  return shift;
}


x86 assembly (clang, -O0):
<CalculateBitsNeededMax65536>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <CalculateLog2Max65536@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    -0x4(%rbp),%eax
shr    $0x1f,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalculateBitsNeededMax65536>:
push   %rbx
mov    %edi,%ebx
call   1030 <CalculateLog2Max65536@plt>
mov    $0x1,%edx
mov    %eax,%ecx
shl    %cl,%edx
sub    %ebx,%edx
shr    $0x1f,%edx
add    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @CalculateBitsNeededMax65536(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @CalculateLog2Max65536(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = shl i32 1, %6
%8 = load i32, i32* %2
%9 = sub i32 %7, %8
%10 = lshr i32 %9, 31
%11 = load i32, i32* %3
%12 = add i32 %11, %10
store i32 %12, i32* %3
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @CalculateBitsNeededMax65536(i32 %0) {
%2 = tail call i32 @CalculateLog2Max65536(i32 %0)
%3 = shl nuw i32 1, %2
%4 = sub i32 %3, %0
%5 = lshr i32 %4, 31
%6 = add i32 %5, %2
ret i32 %6
}
int test_imm_64uint8_mem(unsigned char *val) {
  return ((*val) & (0x64 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_64uint8_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, 100
%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_64uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 100
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
void foo(void) {
#pragma omp ordered
  bar(0);
#pragma omp ordered
  {
    bar(1);
    bar(2);
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <bar@plt>
mov    $0x1,%edi
call   1030 <bar@plt>
mov    $0x2,%edi
call   1030 <bar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %edi,%edi
call   1030 <bar@plt>
mov    $0x1,%edi
call   1030 <bar@plt>
mov    $0x2,%edi
pop    %rax
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @foo() {
%1 = call i32 @bar(i32 0)
%2 = call i32 @bar(i32 1)
%3 = call i32 @bar(i32 2)
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 @bar(i32 0)
%2 = tail call i32 @bar(i32 1)
%3 = tail call i32 @bar(i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nsc_assert(int);
void m_get_clrd(void) {
  nsc_assert(0 && "This function is unimplemented.");
  ;
}


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

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

LLVM IR (-O0):
define void @m_get_clrd() {
%1 = call i32 @nsc_assert(i32 0)
ret void
}

LLVM IR (-O2):
define void @m_get_clrd() {
%1 = tail call i32 @nsc_assert(i32 0)
ret void
}
long long fib(int n) {
  long long x, y;
  if (n < 2)
    return n;
#pragma omp task untied shared(x) firstprivate(n)
  x = fib(n - 1);
#pragma omp task untied shared(y) firstprivate(n)
  y = fib(n - 2);
#pragma omp taskwait
  return x + y;
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1132 <fib+0x22>
movslq -0xc(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    115c <fib+0x4c>
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
cmp    $0x2,%edi
jl     1135 <fib+0x25>
mov    %edi,%ebx
xchg   %ax,%ax
lea    -0x1(%rbx),%edi
call   1030 <fib@plt>
lea    -0x2(%rbx),%edi
add    %rax,%r14
cmp    $0x4,%ebx
mov    %edi,%ebx
jae    1120 <fib+0x10>
movslq %edi,%rax
add    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fib(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %3, label %8
3: ; preds = %8, %1
%4 = phi i64 [ 0, %1 ], [ %14, %8 ]
%5 = phi i32 [ %0, %1 ], [ %13, %8 ]
%6 = sext i32 %5 to i64
%7 = add nsw i64 %4, %6
ret i64 %7
8: ; preds = %1, %8
%9 = phi i32 [ %13, %8 ], [ %0, %1 ]
%10 = phi i64 [ %14, %8 ], [ 0, %1 ]
%11 = add nsw i32 %9, -1
%12 = tail call i64 @fib(i32 %11)
%13 = add nsw i32 %9, -2
%14 = add nsw i64 %12, %10
%15 = icmp ult i32 %9, 4
br i1 %15, label %3, label %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct hostent {
  scalar_t__ h_addr;
};

/* Variables and functions */
struct hostent *gethostbyname(char const *);
int /*<<< orphan*/ ntohl(int /*<<< orphan*/);
uint32_t get_address4(const char *hostname) {
  struct hostent *host = gethostbyname(hostname);
  if (host)
    return ntohl(*(uint32_t *)host->h_addr);
  else
    return 0;
}


x86 assembly (clang, -O0):
<get_address4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <gethostbyname@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115a <get_address4+0x3a>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%edi
call   1040 <ntohl@plt>
mov    %eax,-0x4(%rbp)
jmp    1161 <get_address4+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_address4>:
push   %rax
call   1030 <gethostbyname@plt>
test   %rax,%rax
je     1136 <get_address4+0x16>
mov    (%rax),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <ntohl@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.hostent = type { i64 }
define i32 @get_address4(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.hostent*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call %struct.hostent* @gethostbyname(i8* %5)
store %struct.hostent* %6, %struct.hostent** %4
%7 = load %struct.hostent*, %struct.hostent** %4
%8 = icmp ne %struct.hostent* %7, null
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = load %struct.hostent*, %struct.hostent** %4
%11 = getelementptr inbounds %struct.hostent, %struct.hostent* %10, i32 0, i32 0
%12 = load i64, i64* %11
%13 = inttoptr i64 %12 to i32*
%14 = load i32, i32* %13
%15 = call i32 @ntohl(i32 %14)
store i32 %15, i32* %2
br label %17
16: ; preds = %1
store i32 0, i32* %2
br label %17
17: ; preds = %16, %9
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
%struct.hostent = type { i64 }
define i32 @get_address4(i8* %0) {
%2 = tail call %struct.hostent* @gethostbyname(i8* %0)
%3 = icmp eq %struct.hostent* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = getelementptr inbounds %struct.hostent, %struct.hostent* %2, i64 0, i32 0
%6 = load i64, i64* %5
%7 = inttoptr i64 %6 to i32*
%8 = load i32, i32* %7
%9 = tail call i32 @ntohl(i32 %8)
br label %10
10: ; preds = %1, %4
%11 = phi i32 [ %9, %4 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
float sqrt(float);
float hypotenuse(float val1, float val2) {
  float val;
  val = sqrt(val1 * val1 + val2 * val2);
  return val;
}


x86 assembly (clang, -O0):
<hypotenuse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hypotenuse>:
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1129 <hypotenuse+0x19>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define float @hypotenuse(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = load float, float* %3
%8 = load float, float* %4
%9 = load float, float* %4
%10 = fmul float %8, %9
%11 = call float @llvm.fmuladd.f32(float %6, float %7, float %10)
%12 = call float @sqrt(float %11)
store float %12, float* %5
%13 = load float, float* %5
ret float %13
}

LLVM IR (-O2):
define float @hypotenuse(float %0, float %1) {
%3 = fmul float %1, %1
%4 = tail call float @llvm.fmuladd.f32(float %0, float %0, float %3)
%5 = tail call float @sqrt(float %4)
ret float %5
}
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;
typedef int /*<<< orphan*/ wctype_t;

/* Variables and functions */
int __istype(int /*<<< orphan*/, int /*<<< orphan*/);
int iswctype(wint_t wc, wctype_t charclass) {
  return (__istype(wc, charclass));
}


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

x86 assembly (clang, -O2):
<iswctype>:
jmp    1030 <__istype@plt>

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

LLVM IR (-O2):
define i32 @iswctype(i32 %0, i32 %1) {
%3 = tail call i32 @__istype(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int add_em_up(int, int, int, int, ...);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%d\n", add_em_up(3, 5, 5, 6));
  printf("%d\n", add_em_up(10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%edi
mov    $0x5,%edx
mov    $0x6,%ecx
mov    %edx,%esi
mov    $0x0,%al
call   1040 <add_em_up@plt>
mov    %eax,%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
mov    $0x5,%r9d
movl   $0x6,(%rsp)
movl   $0x7,0x8(%rsp)
movl   $0x8,0x10(%rsp)
movl   $0x9,0x18(%rsp)
movl   $0xa,0x20(%rsp)
mov    $0x0,%al
call   1040 <add_em_up@plt>
mov    %eax,%esi
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x3,%edi
mov    $0x5,%esi
mov    $0x5,%edx
mov    $0x6,%ecx
xor    %eax,%eax
call   1040 <add_em_up@plt>
lea    0xebd(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
sub    $0x8,%rsp
mov    $0xa,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
mov    $0x5,%r9d
xor    %eax,%eax
push   $0xa
push   $0x9
push   $0x8
push   $0x7
push   $0x6
call   1040 <add_em_up@plt>
add    $0x30,%rsp
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (i32, i32, i32, i32, ...) @add_em_up(i32 3, i32 5, i32 5, i32 6)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (i32, i32, i32, i32, ...) @add_em_up(i32 10, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
int isatty(int fd) { return (fd < 3); }


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

x86 assembly (clang, -O2):
<isatty>:
xor    %eax,%eax
cmp    $0x3,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @isatty(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 3
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @isatty(i32 %0) {
%2 = icmp slt i32 %0, 3
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2) {
  return arg1 > arg2 ? arg1 : arg2;
}


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

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

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

LLVM IR (-O2):
define i32 @dcn_bw_max(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
__attribute__((no, noclone)) void fn_p(int p) { (void)p; }


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

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

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

LLVM IR (-O2):
define void @fn_p(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MultM(double **, double **, double **);
int /*<<< orphan*/ genYRotMatrix(double, double **);
void ViewRotY(double theta, double m[3][3]) {
  double a[3][3];
  genYRotMatrix(theta, a);
  MultM(a, m, m);
}


x86 assembly (clang, -O0):
<ViewRotY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x60(%rbp),%rdi
call   1030 <genYRotMatrix@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <MultM@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ViewRotY>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <genYRotMatrix@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
call   1040 <MultM@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ViewRotY(double %0, [3 x double]* %1) {
%3 = alloca double
%4 = alloca [3 x double]*
%5 = alloca [3 x [3 x double]]
store double %0, double* %3
store [3 x double]* %1, [3 x double]** %4
%6 = load double, double* %3
%7 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0
%8 = bitcast [3 x double]* %7 to double**
%9 = call i32 @genYRotMatrix(double %6, double** %8)
%10 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0
%11 = bitcast [3 x double]* %10 to double**
%12 = load [3 x double]*, [3 x double]** %4
%13 = bitcast [3 x double]* %12 to double**
%14 = load [3 x double]*, [3 x double]** %4
%15 = bitcast [3 x double]* %14 to double**
%16 = call i32 @MultM(double** %11, double** %13, double** %15)
ret void
}

LLVM IR (-O2):
define void @ViewRotY(double %0, [3 x double]* %1) {
%3 = alloca [3 x [3 x double]]
%4 = bitcast [3 x [3 x double]]* %3 to i8*
%5 = bitcast [3 x [3 x double]]* %3 to double**
%6 = call i32 @genYRotMatrix(double %0, double** %5)
%7 = bitcast [3 x double]* %1 to double**
%8 = call i32 @MultM(double** %5, double** %7, double** %7)
ret void
}
/* Variables and functions */
int get_rand(int);
int function_r(void) { return (get_rand(8)); }


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

x86 assembly (clang, -O2):
<function_r>:
mov    $0x8,%edi
jmp    1030 <get_rand@plt>

LLVM IR (-O0):
define i32 @function_r() {
%1 = call i32 @get_rand(i32 8)
ret i32 %1
}

LLVM IR (-O2):
define i32 @function_r() {
%1 = tail call i32 @get_rand(i32 8)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ doupdate();
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ refresh();
void hstr_curses_stop() {
  refresh();
  doupdate();
  endwin();
}


x86 assembly (clang, -O0):
<hstr_curses_stop>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <refresh@plt>
mov    $0x0,%al
call   1050 <doupdate@plt>
mov    $0x0,%al
call   1040 <endwin@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hstr_curses_stop>:
push   %rax
xor    %eax,%eax
call   1030 <refresh@plt>
xor    %eax,%eax
call   1050 <doupdate@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <endwin@plt>

LLVM IR (-O0):
define void @hstr_curses_stop() {
%1 = call i32 (...) @refresh()
%2 = call i32 (...) @doupdate()
%3 = call i32 (...) @endwin()
ret void
}

LLVM IR (-O2):
define void @hstr_curses_stop() {
%1 = tail call i32 (...) @refresh()
%2 = tail call i32 (...) @doupdate()
%3 = tail call i32 (...) @endwin()
ret void
}
void sim_exit(int c) { (*((volatile char *)0x4F)) = (unsigned char)c; }


x86 assembly (clang, -O0):
<sim_exit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    $0x4f,%eax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sim_exit>:
mov    %dil,0x4f
ret

LLVM IR (-O0):
define void @sim_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i8
store volatile i8 %4, i8* inttoptr (i64 79 to i8*)
ret void
}

LLVM IR (-O2):
define void @sim_exit(i32 %0) {
%2 = trunc i32 %0 to i8
store volatile i8 %2, i8* inttoptr (i64 79 to i8*)
ret void
}
void gdk_event_peek() {}


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

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

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

LLVM IR (-O2):
define void @gdk_event_peek() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void check(int condition, int line) {
  if (!condition) {
    printf("%s%s%s", "\x1B[31m", "FAIL", "\x1B[0m");
    printf(" @%d\n", line);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1176 <check+0x56>
lea    0xec1(%rip),%rdi
lea    0xec1(%rip),%rsi
lea    0xec0(%rip),%rdx
lea    0xebe(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
test   %edi,%edi
je     1125 <check+0x5>
ret
push   %rbx
mov    %esi,%ebx
lea    0xed1(%rip),%rdi
lea    0xed1(%rip),%rsi
lea    0xed0(%rip),%rdx
lea    0xece(%rip),%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%s%s%s\00"
@.str.1 = [6 x i8] c"\1B[31m\00"
@.str.2 = [5 x i8] c"FAIL\00"
@.str.3 = [5 x i8] c"\1B[0m\00"
@.str.4 = [6 x i8] c" @%d\0A\00"
define void @check(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 = icmp ne i32 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%9 = load i32, i32* %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s%s%s\00"
@.str.1 = [6 x i8] c"\1B[31m\00"
@.str.2 = [5 x i8] c"FAIL\00"
@.str.3 = [5 x i8] c"\1B[0m\00"
@.str.4 = [6 x i8] c" @%d\0A\00"
define void @check(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %1)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret void
}
unsigned long getDiskSize(void) { return *(((unsigned *)0xF0400000) + 3); }


x86 assembly (clang, -O0):
<getDiskSize>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf0400000,%eax
mov    0xc(%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDiskSize>:
mov    $0xf040000c,%eax
mov    (%rax),%eax
ret

LLVM IR (-O0):
define i64 @getDiskSize() {
%1 = load i32, i32* getelementptr inbounds (i32, i32* inttoptr (i64 4030726144 to i32*), i64 3)
%2 = zext i32 %1 to i64
ret i64 %2
}

LLVM IR (-O2):
define i64 @getDiskSize() {
%1 = load i32, i32* inttoptr (i64 4030726156 to i32*)
%2 = zext i32 %1 to i64
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ add_string(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
void add_c_string(char *s) { add_string(s, strlen(s)); }


x86 assembly (clang, -O0):
<add_c_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1040 <add_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_c_string>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <add_string@plt>

LLVM IR (-O0):
define void @add_c_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @add_string(i8* %3, i32 %5)
ret void
}

LLVM IR (-O2):
define void @add_c_string(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @add_string(i8* %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, void *);
void r(char *str, void *ptr) { printf("%s: %p\n", str, ptr); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"%s: %p\0A\00"
define void @r(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 ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %p\0A\00"
define void @r(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
/* Variables and functions */
scalar_t__ ASRT_Int(int, int);
int /*<<< orphan*/ ASRT_Mark(char *, int, char *);
int test_IntFail() {
  int x = 37;
  int y = 38;
  do {
    ASRT_Mark("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/cohadar/c-learning/refs/heads/master/"
              "src/asrt_tests.c",
              209,
              "x"
              " == "
              "y");
    if (ASRT_Int(x, y)) {
      return 1;
    };
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_IntFail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x25,-0x8(%rbp)
movl   $0x26,-0xc(%rbp)
lea    0xec3(%rip),%rdi
mov    $0xd1,%esi
lea    0xf47(%rip),%rdx
call   1030 <ASRT_Mark@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <ASRT_Int@plt>
cmp    $0x0,%rax
je     116f <test_IntFail+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    117b <test_IntFail+0x5b>
jmp    1174 <test_IntFail+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_IntFail>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xf61(%rip),%rdx
mov    $0xd1,%esi
call   1030 <ASRT_Mark@plt>
mov    $0x25,%edi
mov    $0x26,%esi
call   1040 <ASRT_Int@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cohadar/c-learning/refs/heads/master/src/asrt_tests.c\00"
@.str.1 = [7 x i8] c"x == y\00"
define i32 @test_IntFail() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 37, i32* %2
store i32 38, i32* %3
br label %4
4: ; preds = %0
%5 = call i32 @ASRT_Mark(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 209, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i64 @ASRT_Int(i32 %6, i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %4
store i32 1, i32* %1
br label %13
11: ; preds = %4
br label %12
12: ; preds = %11
store i32 0, i32* %1
br label %13
13: ; preds = %12, %10
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cohadar/c-learning/refs/heads/master/src/asrt_tests.c\00"
@.str.1 = [7 x i8] c"x == y\00"
define i32 @test_IntFail() {
%1 = tail call i32 @ASRT_Mark(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 209, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @ASRT_Int(i32 37, i32 38)
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}