xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint_fast64_t;
typedef int uint_fast32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
uint_fast32_t mod_mac(uint_fast32_t sum, uint_fast32_t a, uint_fast32_t b) {
  assert(sum <= 0x7FFFFFFE);
  assert(a <= 0x7FFFFFFE);
  assert(b <= 0x7FFFFFFE);
  return (uint_fast32_t)(((uint_fast64_t)a * b + sum) % 0x7FFFFFFF);
}


x86 assembly (clang, -O0):
<mod_mac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x7ffffffe,-0x4(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x7ffffffe,-0x8(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x7ffffffe,-0xc(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
add    -0x4(%rbp),%eax
mov    $0x7fffffff,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod_mac>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
xor    %edi,%edi
cmp    $0x7fffffff,%r14d
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmp    $0x7fffffff,%ebp
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmp    $0x7fffffff,%ebx
setne  %dil
call   1030 <assert@plt>
imul   %ebp,%ebx
add    %r14d,%ebx
movslq %ebx,%rax
mov    %rax,%rcx
shl    $0x1e,%rcx
add    %rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x3d,%rcx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x1f,%edx
sub    %edx,%ecx
add    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mod_mac(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* %4
%8 = icmp sle i32 %7, 2147483646
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %5
%12 = icmp sle i32 %11, 2147483646
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i32, i32* %6
%16 = icmp sle i32 %15, 2147483646
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = mul nsw i32 %19, %20
%22 = load i32, i32* %4
%23 = add nsw i32 %21, %22
%24 = srem i32 %23, 2147483647
ret i32 %24
}

LLVM IR (-O2):
define i32 @mod_mac(i32 %0, i32 %1, i32 %2) {
%4 = icmp ne i32 %0, 2147483647
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp ne i32 %1, 2147483647
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = icmp ne i32 %2, 2147483647
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = mul nsw i32 %2, %1
%14 = add nsw i32 %13, %0
%15 = srem i32 %14, 2147483647
ret i32 %15
}
void prune_alias_not_Ok(int x) {
  int a[1];
  if (!(x == x)) {
    a[1] = 0;
  }
  if (!(x <= x)) {
    a[1] = 0;
  }
  if (!(x >= x)) {
    a[1] = 0;
  }
}


x86 assembly (clang, -O0):
<prune_alias_not_Ok>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x4(%rbp),%eax
je     111a <prune_alias_not_Ok+0x1a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    112d <prune_alias_not_Ok+0x2d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1140 <prune_alias_not_Ok+0x40>
movl   $0x0,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @prune_alias_not_Ok(i32 %0) {
%2 = alloca i32
%3 = alloca [1 x i32]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %4, %5
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 1
store i32 0, i32* %8
br label %9
9: ; preds = %7, %1
%10 = load i32, i32* %2
%11 = load i32, i32* %2
%12 = icmp sle i32 %10, %11
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 1
store i32 0, i32* %14
br label %15
15: ; preds = %13, %9
%16 = load i32, i32* %2
%17 = load i32, i32* %2
%18 = icmp sge i32 %16, %17
br i1 %18, label %21, label %19
19: ; preds = %15
%20 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 1
store i32 0, i32* %20
br label %21
21: ; preds = %19, %15
ret void
}

LLVM IR (-O2):
define void @prune_alias_not_Ok(i32 %0) {
ret void
}
/* Variables and functions */
char *GetFolder(const char *pszFullPath) { return "."; }


x86 assembly (clang, -O0):
<GetFolder>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    0xef1(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
define i8* @GetFolder(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
define i8* @GetFolder(i8* nocapture readnone %0) {
ret i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
}
void XkbFreeGeomOverlays() {}


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

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

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

LLVM IR (-O2):
define void @XkbFreeGeomOverlays() {
ret void
}
void foo232(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo232(i32 %0) {
ret void
}
/* Variables and functions */
scalar_t__ COND_VC();
int /*<<< orphan*/ EA_AY_AI_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_svc_8_ai(void) {
  m68ki_write_8(EA_AY_AI_8(), COND_VC() ? 0xff : 0);
}


x86 assembly (clang, -O0):
<m68k_op_svc_8_ai>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <EA_AY_AI_8@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <COND_VC@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
xor    %esi,%esi
mov    $0xff,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
call   1050 <m68ki_write_8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_svc_8_ai>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <EA_AY_AI_8@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <COND_VC@plt>
test   %rax,%rax
mov    $0xff,%esi
cmove  %ebp,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_svc_8_ai() {
%1 = call i32 (...) @EA_AY_AI_8()
%2 = call i64 (...) @COND_VC()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 255, i32 0
%6 = call i32 @m68ki_write_8(i32 %1, i32 %5)
ret void
}

LLVM IR (-O2):
define void @m68k_op_svc_8_ai() {
%1 = tail call i32 (...) @EA_AY_AI_8()
%2 = tail call i64 (...) @COND_VC()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
int compare_strings(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
}


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

x86 assembly (clang, -O2):
<compare_strings>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @compare_strings(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 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
%11 = call i32 @strcmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @compare_strings(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
unsigned xrop3_247_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = D & S;
  stk2 = ~stk2;
  stk1 = T | stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_247_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_247_0_1>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
mov    %esi,%edx
shl    $0x8,%edx
or     %esi,%edx
not    %edi
mov    %esi,%eax
or     %edi,%eax
not    %edx
and    %edi,%edx
xor    %esi,%eax
and    %ecx,%eax
xor    %esi,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_247_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = and i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %9
%26 = xor i32 %25, -1
store i32 %26, i32* %9
%27 = load i32, i32* %7
%28 = load i32, i32* %9
%29 = or i32 %27, %28
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = load i32, i32* %6
%32 = and i32 %30, %31
%33 = load i32, i32* %8
%34 = load i32, i32* %7
%35 = xor i32 %34, -1
%36 = and i32 %33, %35
%37 = or i32 %32, %36
%38 = load i32, i32* %7
%39 = load i32, i32* %6
%40 = xor i32 %39, -1
%41 = and i32 %38, %40
%42 = load i32, i32* %5
%43 = and i32 %41, %42
%44 = or i32 %37, %43
ret i32 %44
}

LLVM IR (-O2):
define i32 @xrop3_247_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %3, -1
%8 = or i32 %5, %7
%9 = and i32 %8, %4
%10 = xor i32 %6, -1
%11 = and i32 %10, %7
%12 = xor i32 %4, -1
%13 = and i32 %12, %5
%14 = or i32 %13, %9
%15 = or i32 %14, %11
ret i32 %15
}
void Timer1_Callback(void const *arg) {}


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

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

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

LLVM IR (-O2):
define void @Timer1_Callback(i8* nocapture %0) {
ret void
}
int foo(void) {
  int a = 2, __attribute__((__unused__)) b = 1;
  int f = a / b;
  return f;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movl   $0x2,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @foo() {
ret i32 2
}
int main() {
  int n = 0;
  char a[][6] = {"zero", "one", "two",   "three", "four",
                 "five", "six", "seven", "eight", "nine"};
  scanf("%d", &n);
  puts(a[n]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x3c,%edx
call   1040 <memcpy@plt>
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movslq -0x8(%rbp),%rax
lea    -0x50(%rbp),%rdi
imul   $0x6,%rax,%rax
add    %rax,%rdi
mov    $0x0,%al
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
movl   $0x0,0xc(%rsp)
movups 0xef9(%rip),%xmm0
movups %xmm0,0x3c(%rsp)
movaps 0xee1(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xea9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xed9(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rax
lea    (%rax,%rax,2),%rax
lea    (%rsp,%rax,2),%rdi
add    $0x10,%rdi
xor    %eax,%eax
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [10 x [6 x i8]] [[6 x i8] c"zero\00\00", [6 x i8] c"one\00\00\00", [6 x i8] c"two\00\00\00", [6 x i8] c"three\00", [6 x i8] c"four\00\00", [6 x i8] c"five\00\00", [6 x i8] c"six\00\00\00", [6 x i8] c"seven\00", [6 x i8] c"eight\00", [6 x i8] c"nine\00\00"]
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x [6 x i8]]
store i32 0, i32* %1
store i32 0, i32* %2
%4 = bitcast [10 x [6 x i8]]* %3 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [10 x [6 x i8]], [10 x [6 x i8]]* %3, i64 0, i64 %7
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [10 x [6 x i8]] [[6 x i8] c"zero\00\00", [6 x i8] c"one\00\00\00", [6 x i8] c"two\00\00\00", [6 x i8] c"three\00", [6 x i8] c"four\00\00", [6 x i8] c"five\00\00", [6 x i8] c"six\00\00\00", [6 x i8] c"seven\00", [6 x i8] c"eight\00", [6 x i8] c"nine\00\00"]
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [6 x i8]]
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = getelementptr inbounds [10 x [6 x i8]], [10 x [6 x i8]]* %2, i64 0, i64 0, i64 0
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [10 x [6 x i8]], [10 x [6 x i8]]* %2, i64 0, i64 %7, i64 0
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %8)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int);
void nocrash_getc() {
  FILE *f;
  int i;
  f = fopen("this_file_doesnt_exists", "r");
  if (f) {
    i = getc(f);
    printf("i =%i\n", i);
    fclose(f);
  }
}


x86 assembly (clang, -O0):
<nocrash_getc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     118e <nocrash_getc+0x4e>
mov    -0x8(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nocrash_getc>:
push   %rbx
lea    0xeb8(%rip),%rdi
lea    0xec9(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     117b <nocrash_getc+0x3b>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <getc@plt>
lea    0xeaf(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"this_file_doesnt_exists\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"i =%i\0A\00"
define void @nocrash_getc() {
%1 = alloca i32*
%2 = alloca i32
%3 = call i32* @fopen(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %13
6: ; preds = %0
%7 = load i32*, i32** %1
%8 = call i32 @getc(i32* %7)
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = load i32*, i32** %1
%12 = call i32 @fclose(i32* %11)
br label %13
13: ; preds = %6, %0
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"this_file_doesnt_exists\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"i =%i\0A\00"
define void @nocrash_getc() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call i32 @getc(i32* %1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%6 = tail call i32 @fclose(i32* %1)
br label %7
7: ; preds = %3, %0
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ y_root;
};
typedef TYPE_1__ XLeaveWindowEvent;

/* Variables and functions */
int get_XLeaveWindowEvent_y_root(void *_p) {
  return (int)((XLeaveWindowEvent *)_p)->y_root;
}


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

x86 assembly (clang, -O2):
<get_XLeaveWindowEvent_y_root>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XLeaveWindowEvent_y_root(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XLeaveWindowEvent_y_root(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
short rotateR_fun_short(short x, int i) {
  if ((i %= 16) == 0)
    return x;
  return (x << (16 - i)) | ((0x7fff >> (i - 1)) & (x >> i));
}


x86 assembly (clang, -O0):
<rotateR_fun_short>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmp    $0x0,%edx
jne    1132 <rotateR_fun_short+0x32>
mov    -0x4(%rbp),%ax
mov    %ax,-0x2(%rbp)
jmp    1164 <rotateR_fun_short+0x64>
movswl -0x4(%rbp),%eax
mov    $0x10,%ecx
sub    -0x8(%rbp),%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x7fff,%edx
sar    %cl,%edx
mov    %edx,-0xc(%rbp)
movswl -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    -0xc(%rbp),%ecx
and    %edx,%ecx
or     %ecx,%eax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotateR_fun_short>:
mov    %edi,%eax
lea    0xf(%rsi),%ecx
test   %esi,%esi
cmovns %esi,%ecx
and    $0xfffffff0,%ecx
sub    %ecx,%esi
je     112d <rotateR_fun_short+0x2d>
cwtl
mov    $0x10,%cl
sub    %sil,%cl
mov    %eax,%edx
shl    %cl,%edx
lea    -0x1(%rsi),%ecx
mov    $0x7fff,%edi
shr    %cl,%edi
mov    %esi,%ecx
sar    %cl,%eax
and    %edi,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define signext i16 @rotateR_fun_short(i16 signext %0, i32 %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca i32
store i16 %0, i16* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = srem i32 %6, 16
store i32 %7, i32* %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i16, i16* %4
store i16 %10, i16* %3
br label %27
11: ; preds = %2
%12 = load i16, i16* %4
%13 = sext i16 %12 to i32
%14 = load i32, i32* %5
%15 = sub nsw i32 16, %14
%16 = shl i32 %13, %15
%17 = load i32, i32* %5
%18 = sub nsw i32 %17, 1
%19 = ashr i32 32767, %18
%20 = load i16, i16* %4
%21 = sext i16 %20 to i32
%22 = load i32, i32* %5
%23 = ashr i32 %21, %22
%24 = and i32 %19, %23
%25 = or i32 %16, %24
%26 = trunc i32 %25 to i16
store i16 %26, i16* %3
br label %27
27: ; preds = %11, %9
%28 = load i16, i16* %3
ret i16 %28
}

LLVM IR (-O2):
define signext i16 @rotateR_fun_short(i16 signext %0, i32 %1) {
%3 = srem i32 %1, 16
%4 = icmp eq i32 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2
%6 = sext i16 %0 to i32
%7 = sub nsw i32 16, %3
%8 = shl i32 %6, %7
%9 = add nsw i32 %3, -1
%10 = lshr i32 32767, %9
%11 = ashr i32 %6, %3
%12 = and i32 %10, %11
%13 = or i32 %12, %8
%14 = trunc i32 %13 to i16
br label %15
15: ; preds = %2, %5
%16 = phi i16 [ %14, %5 ], [ %0, %2 ]
ret i16 %16
}
/* Variables and functions */
int /*<<< orphan*/ kputch(int /*<<< orphan*/);
void kputs(char *text) {
  while (*text != 0)
    kputch(*(text++));
}


x86 assembly (clang, -O0):
<kputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1148 <kputs+0x38>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <kputch@plt>
jmp    111c <kputs+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kputs>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <kputs+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <kputch@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <kputs+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @kputs(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %8, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = call i32 @kputch(i32 %12)
br label %3
14: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @kputs(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = sext i8 %5 to i32
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = tail call i32 @kputch(i32 %7)
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void gopanic(char *message) {
  printf("Runtime gopanic: %s\n", message);
  exit(1);
}


x86 assembly (clang, -O0):
<gopanic>:
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    $0x1,%edi
call   1040 <exit@plt>

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

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

LLVM IR (-O2):
@.str = [21 x i8] c"Runtime gopanic: %s\0A\00"
define void @gopanic(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void showEmptyInput() {
  printf("Empty Input. Need at least one command\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [40 x i8] c"Empty Input. Need at least one command\0A\00"
define void @showEmptyInput() {
%1 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [39 x i8] c"Empty Input. Need at least one command\00"
define void @showEmptyInput() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
subtract(int a, int b) {
  int c;
  c = a - b;
  printf("the result is %d", c);
}


x86 assembly (clang, -O0):
<subtract>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subtract>:
mov    %edi,%eax
sub    %esi,%eax
lea    0xee5(%rip),%rdi
mov    %eax,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"the result is %d\00"
define i32 @subtract(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = sub nsw i32 %7, %8
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@.str = [17 x i8] c"the result is %d\00"
define i32 @subtract(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 undef
}
/* Variables and functions */
void basic_null_dereference() {
  int *p = NULL;
  *p = 42;
}


x86 assembly (clang, -O0):
<basic_null_dereference>:
push   %rbp
mov    %rsp,%rbp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x2a,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @basic_null_dereference() {
%1 = alloca i32*
store i32* null, i32** %1
%2 = load i32*, i32** %1
store i32 42, i32* %2
ret void
}

LLVM IR (-O2):
/* Variables and functions */
int __builtin_nyuzi_read_control_reg(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int);
void tlb_miss_handler() {
  printf("FAULT %d %08x\n", __builtin_nyuzi_read_control_reg(3),
         __builtin_nyuzi_read_control_reg(5));
  exit(0);
}


x86 assembly (clang, -O0):
<tlb_miss_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
mov    %eax,-0x4(%rbp)
mov    $0x5,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
mov    -0x4(%rbp),%esi
mov    %eax,%edx
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<tlb_miss_handler>:
push   %rbx
mov    $0x3,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
mov    %eax,%ebx
mov    $0x5,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
lea    0xeb2(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"FAULT %d %08x\0A\00"
define void @tlb_miss_handler() {
%1 = call i32 @__builtin_nyuzi_read_control_reg(i32 3)
%2 = call i32 @__builtin_nyuzi_read_control_reg(i32 5)
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [15 x i8] c"FAULT %d %08x\0A\00"
define void @tlb_miss_handler() {
%1 = tail call i32 @__builtin_nyuzi_read_control_reg(i32 3)
%2 = tail call i32 @__builtin_nyuzi_read_control_reg(i32 5)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%4 = tail call i32 @exit(i32 0)
unreachable
}
double perimetar(double radius) { return 2 * radius * 3.14; }


x86 assembly (clang, -O0):
<perimetar>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<perimetar>:
addsd  %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @perimetar(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double 2.000000e+00, %3
%5 = fmul double %4, 3.140000e+00
ret double %5
}

LLVM IR (-O2):
define double @perimetar(double %0) {
%2 = fmul double %0, 2.000000e+00
%3 = fmul double %2, 3.140000e+00
ret double %3
}
void fill_string(char *string, int size, char fill_char) {
  int i;
  for (i = 0; i < size; i++)
    string[i] = fill_char;
}


x86 assembly (clang, -O0):
<fill_string>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113f <fill_string+0x3f>
mov    -0xd(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <fill_string+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_string>:
test   %esi,%esi
jle    1126 <fill_string+0x16>
push   %rax
mov    %esi,%eax
movzbl %dl,%esi
mov    %rax,%rdx
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @fill_string(i8* nocapture writeonly %0, i32 %1, i8 signext %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PORTB_DriverIRQHandler();
__attribute__((weak)) void PORTB_IRQHandler(void) { PORTB_DriverIRQHandler(); }


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

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

LLVM IR (-O0):
define weak void @PORTB_IRQHandler() {
%1 = call i32 (...) @PORTB_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @PORTB_IRQHandler() {
%1 = tail call i32 (...) @PORTB_DriverIRQHandler()
ret void
}
int main() {
  int x;
  x = 5555;
  ++x;
  return x;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 5556
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ shutdown(int, int);
void g_tcp_close(int sck) {
  if (sck == 0) {
    return;
  }
  shutdown(sck, 2);
  close(sck);
}


x86 assembly (clang, -O0):
<g_tcp_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113a <g_tcp_close+0x1a>
jmp    114f <g_tcp_close+0x2f>
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <shutdown@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_tcp_close>:
test   %edi,%edi
je     1139 <g_tcp_close+0x19>
push   %rbx
mov    %edi,%ebx
mov    $0x2,%esi
call   1030 <shutdown@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <close@plt>
ret

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

LLVM IR (-O2):
define void @g_tcp_close(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @shutdown(i32 %0, i32 2)
%5 = tail call i32 @close(i32 %0)
br label %6
6: ; preds = %1, %3
ret void
}
int max(int a, int b) { return a + b; }


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

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

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

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
void redisSetProcTitle(void) {
  _serverPanic("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/"
               "heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c",
               103, "Function '%s' is disabled.", __func__);
}


x86 assembly (clang, -O0):
<redisSetProcTitle>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x67,%esi
lea    0xf79(%rip),%rdx
lea    0xf8d(%rip),%rcx
mov    $0x0,%al
call   1030 <_serverPanic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<redisSetProcTitle>:
lea    0xee9(%rip),%rdi
lea    0xf82(%rip),%rdx
lea    0xf96(%rip),%rcx
mov    $0x67,%esi
xor    %eax,%eax
jmp    1030 <_serverPanic@plt>

LLVM IR (-O0):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.redisSetProcTitle = [18 x i8] c"redisSetProcTitle\00"
define void @redisSetProcTitle() {
%1 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 103, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.redisSetProcTitle, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.redisSetProcTitle = [18 x i8] c"redisSetProcTitle\00"
define void @redisSetProcTitle() {
%1 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 103, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.redisSetProcTitle, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(char *, ...);
int main(int argc, char **argv) {
  f("hello %S!\n", "wow");
  f("hello there: %s!\n", "wow");
  f("hello again!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
lea    0xed7(%rip),%rsi
mov    $0x0,%al
call   1030 <f@plt>
lea    0xecd(%rip),%rdi
lea    0xec2(%rip),%rsi
mov    $0x0,%al
call   1030 <f@plt>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <f@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
lea    0xeec(%rip),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <f@plt>
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <f@plt>
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <f@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"hello %S!\0A\00"
@.str.1 = [4 x i8] c"wow\00"
@.str.2 = [18 x i8] c"hello there: %s!\0A\00"
@.str.3 = [14 x i8] c"hello again!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (i8*, ...) @f(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @f(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @f(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"hello %S!\0A\00"
@.str.1 = [4 x i8] c"wow\00"
@.str.2 = [18 x i8] c"hello there: %s!\0A\00"
@.str.3 = [14 x i8] c"hello again!\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @f(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @f(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @f(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
char *strdup(char *);
char *xstrdup(char *inp) {
  char *ret = strdup(inp);
  if (!ret) {
    perror("strdup failed");
    exit(1);
  } else
    return ret;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116a <xstrdup+0x3a>
lea    0xea5(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rax
call   1050 <strdup@plt>
test   %rax,%rax
je     113d <xstrdup+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"strdup failed\00"
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [14 x i8] c"strdup failed\00"
define noalias i8* @xstrdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret i8* %2
}
void *slib_get_func(const char *name) {}


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

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

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

LLVM IR (-O2):
define noalias i8* @slib_get_func(i8* nocapture readnone %0) {
ret i8* undef
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_file;

/* Variables and functions */
int closeUnixFile(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int nolockClose(sqlite3_file *id) {
  fprintf(stderr, "trace: begin nolockClose ...\n");
  return closeUnixFile(id);
}


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

x86 assembly (clang, -O2):
<nolockClose>:
push   %rbx
mov    %rdi,%rbx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <closeUnixFile@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"trace: begin nolockClose ...\0A\00"
define i32 @nolockClose(i32* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @closeUnixFile(i32* %0)
ret i32 %4
}
/* Type definitions */
struct cmd_arg {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ showRmtAccess();
void cmdShowRemoteAccess(int cmdType, struct cmd_arg *pCmdArg) {
  showRmtAccess();
}


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

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

LLVM IR (-O0):
%struct.cmd_arg = type { i32 }
define void @cmdShowRemoteAccess(i32 %0, %struct.cmd_arg* %1) {
%3 = alloca i32
%4 = alloca %struct.cmd_arg*
store i32 %0, i32* %3
store %struct.cmd_arg* %1, %struct.cmd_arg** %4
%5 = call i32 (...) @showRmtAccess()
ret void
}

LLVM IR (-O2):
%struct.cmd_arg = type { i32 }
define void @cmdShowRemoteAccess(i32 %0, %struct.cmd_arg* nocapture readnone %1) {
%3 = tail call i32 (...) @showRmtAccess()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int readxyz_ex(char *, double **, double **, double **, int *,
               int /*<<< orphan*/ *, int);
int readxyz(char *filename, double **x, double **y, double **z, int *n,
            FILE *output) {
  return (readxyz_ex(filename, x, y, z, n, output, 1));
}


x86 assembly (clang, -O0):
<readxyz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
movl   $0x1,(%rsp)
call   1030 <readxyz_ex@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readxyz>:
push   %rax
movl   $0x1,(%rsp)
call   1030 <readxyz_ex@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @readxyz(i8* %0, double** %1, double** %2, double** %3, i32* %4, i32* %5) {
%7 = alloca i8*
%8 = alloca double**
%9 = alloca double**
%10 = alloca double**
%11 = alloca i32*
%12 = alloca i32*
store i8* %0, i8** %7
store double** %1, double*** %8
store double** %2, double*** %9
store double** %3, double*** %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%13 = load i8*, i8** %7
%14 = load double**, double*** %8
%15 = load double**, double*** %9
%16 = load double**, double*** %10
%17 = load i32*, i32** %11
%18 = load i32*, i32** %12
%19 = call i32 @readxyz_ex(i8* %13, double** %14, double** %15, double** %16, i32* %17, i32* %18, i32 1)
ret i32 %19
}

LLVM IR (-O2):
define i32 @readxyz(i8* %0, double** %1, double** %2, double** %3, i32* %4, i32* %5) {
%7 = tail call i32 @readxyz_ex(i8* %0, double** %1, double** %2, double** %3, i32* %4, i32* %5, i32 1)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ bar(int, int /*<<< orphan*/, char *);
void baz(char *x) { bar(1, 0, x); }


x86 assembly (clang, -O0):
<baz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<baz>:
mov    %rdi,%rdx
mov    $0x1,%edi
xor    %esi,%esi
jmp    1030 <bar@plt>

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

LLVM IR (-O2):
define void @baz(i8* %0) {
%2 = tail call i32 @bar(i32 1, i32 0, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CL_AddReliableCommand(int /*<<< orphan*/);
int /*<<< orphan*/ va(char *);
void CL_ResetPureClientAtServer(void) { CL_AddReliableCommand(va("vdr")); }


x86 assembly (clang, -O0):
<CL_ResetPureClientAtServer>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <va@plt>
mov    %eax,%edi
call   1040 <CL_AddReliableCommand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CL_ResetPureClientAtServer>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <va@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <CL_AddReliableCommand@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"vdr\00"
define void @CL_ResetPureClientAtServer() {
%1 = call i32 @va(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @CL_AddReliableCommand(i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"vdr\00"
define void @CL_ResetPureClientAtServer() {
%1 = tail call i32 @va(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @CL_AddReliableCommand(i32 %1)
ret void
}
void ieee80211_debugfs_netdev_init(void) {}


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

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

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

LLVM IR (-O2):
define void @ieee80211_debugfs_netdev_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ trm_str(char *);
void parse_error() { trm_str("I don't understand.\n"); }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"I don't understand.\0A\00"
define void @parse_error() {
%1 = call i32 @trm_str(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"I don't understand.\0A\00"
define void @parse_error() {
%1 = tail call i32 @trm_str(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}