xunge/DecIR huggingface dataset:
int md5_self_test(int verbose) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @md5_self_test(i32 %0) {
ret i32 0
}
int isonum_732(char *p) {
  return ((p[3] & 0xff) | ((p[2] & 0xff) << 8) | ((p[1] & 0xff) << 16) |
          ((p[0] & 0xff) << 24));
}


x86 assembly (clang, -O0):
<isonum_732>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%eax
and    $0xff,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x2(%rcx),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @isonum_732(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 8
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 16
%14 = or i32 %9, %13
%15 = load i8, i8* %0
%16 = zext i8 %15 to i32
%17 = shl nuw i32 %16, 24
%18 = or i32 %14, %17
ret i32 %18
}
extern int ReturnNegInt() { return -101; }


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

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

LLVM IR (-O0):
define i32 @ReturnNegInt() {
ret i32 -101
}

LLVM IR (-O2):
define i32 @ReturnNegInt() {
ret i32 -101
}
void mlx5e_dcbnl_init_app(struct mlx5e_priv *priv) {}


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

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

LLVM IR (-O0):
%struct.mlx5e_priv = type opaque
define void @mlx5e_dcbnl_init_app(%struct.mlx5e_priv* %0) {
%2 = alloca %struct.mlx5e_priv*
store %struct.mlx5e_priv* %0, %struct.mlx5e_priv** %2
ret void
}

LLVM IR (-O2):
%struct.mlx5e_priv = type opaque
define void @mlx5e_dcbnl_init_app(%struct.mlx5e_priv* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ import_database();
int /*<<< orphan*/ init_data();
int main() {
  init_data();
  for (;;) {
    import_database();
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <init_data@plt>
mov    $0x0,%al
call   1040 <import_database@plt>
jmp    1136 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <init_data@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <import_database@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @init_data()
br label %3
3: ; preds = %3, %0
%4 = call i32 (...) @import_database()
br label %3
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @init_data()
br label %2
2: ; preds = %2, %0
%3 = tail call i32 (...) @import_database()
br label %2
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t touint64(int fd, int id) {
  uint64_t ret = 0;
  ret |= ((uint64_t)fd) << 32;
  ret |= ((uint64_t)id);
  return ret;
}


x86 assembly (clang, -O0):
<touint64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @touint64(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %3
%7 = shl i32 %6, 32
%8 = load i32, i32* %5
%9 = or i32 %8, %7
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = or i32 %11, %10
store i32 %12, i32* %5
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
define i32 @touint64(i32 %0, i32 %1) {
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ free(unsigned long *);
void C_Utils_free_ulong_ptr(unsigned long *item) { free(item); }


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

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

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

LLVM IR (-O2):
define void @C_Utils_free_ulong_ptr(i64* nocapture %0) {
%2 = tail call i32 @free(i64* %0)
ret void
}
/* Variables and functions */
unsigned char atomic_decrement_val(unsigned char volatile *);
unsigned char atomic_dec_uchar_nv(volatile unsigned char *target) {
  return atomic_decrement_val(target) - 1;
}


x86 assembly (clang, -O0):
<atomic_dec_uchar_nv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <atomic_decrement_val@plt>
movzbl %al,%eax
sub    $0x1,%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atomic_dec_uchar_nv>:
push   %rax
call   1030 <atomic_decrement_val@plt>
add    $0xff,%al
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @atomic_dec_uchar_nv(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call zeroext i8 @atomic_decrement_val(i8* %3)
%5 = zext i8 %4 to i32
%6 = sub nsw i32 %5, 1
%7 = trunc i32 %6 to i8
ret i8 %7
}

LLVM IR (-O2):
define zeroext i8 @atomic_dec_uchar_nv(i8* %0) {
%2 = tail call zeroext i8 @atomic_decrement_val(i8* %0)
%3 = add i8 %2, -1
ret i8 %3
}
void gtk_font_button_get_show_style() {}


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

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

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

LLVM IR (-O2):
define void @gtk_font_button_get_show_style() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ g();
f(int x) {
  if (x < 0)
    g();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    112c <f+0x1c>
mov    $0x0,%al
call   1030 <g@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
test   %edi,%edi
js     1115 <f+0x5>
ret
push   %rax
xor    %eax,%eax
call   1030 <g@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @g()
br label %5
5: ; preds = %3, %1
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ CL_CheckForResend();
int /*<<< orphan*/ CL_FixCvarCheats();
int /*<<< orphan*/ CL_SendCmd();
int /*<<< orphan*/ Cbuf_Execute();
int /*<<< orphan*/ IN_Commands();
int /*<<< orphan*/ Sys_SendKeyEvents();
void CL_SendCommand(void) {
  Sys_SendKeyEvents();
  IN_Commands();
  Cbuf_Execute();
  CL_FixCvarCheats();
  CL_SendCmd();
  CL_CheckForResend();
}


x86 assembly (clang, -O0):
<CL_SendCommand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <Sys_SendKeyEvents@plt>
mov    $0x0,%al
call   1060 <IN_Commands@plt>
mov    $0x0,%al
call   1040 <Cbuf_Execute@plt>
mov    $0x0,%al
call   1070 <CL_FixCvarCheats@plt>
mov    $0x0,%al
call   1030 <CL_SendCmd@plt>
mov    $0x0,%al
call   1080 <CL_CheckForResend@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CL_SendCommand>:
push   %rax
xor    %eax,%eax
call   1050 <Sys_SendKeyEvents@plt>
xor    %eax,%eax
call   1060 <IN_Commands@plt>
xor    %eax,%eax
call   1040 <Cbuf_Execute@plt>
xor    %eax,%eax
call   1070 <CL_FixCvarCheats@plt>
xor    %eax,%eax
call   1030 <CL_SendCmd@plt>
xor    %eax,%eax
pop    %rcx
jmp    1080 <CL_CheckForResend@plt>

LLVM IR (-O0):
define void @CL_SendCommand() {
%1 = call i32 (...) @Sys_SendKeyEvents()
%2 = call i32 (...) @IN_Commands()
%3 = call i32 (...) @Cbuf_Execute()
%4 = call i32 (...) @CL_FixCvarCheats()
%5 = call i32 (...) @CL_SendCmd()
%6 = call i32 (...) @CL_CheckForResend()
ret void
}

LLVM IR (-O2):
define void @CL_SendCommand() {
%1 = tail call i32 (...) @Sys_SendKeyEvents()
%2 = tail call i32 (...) @IN_Commands()
%3 = tail call i32 (...) @Cbuf_Execute()
%4 = tail call i32 (...) @CL_FixCvarCheats()
%5 = tail call i32 (...) @CL_SendCmd()
%6 = tail call i32 (...) @CL_CheckForResend()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ corrupt_frame_outer();
int main() {
  corrupt_frame_outer();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <corrupt_frame_outer@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @corrupt_frame_outer()
ret i32 0
}
const char *pathcon_nm7_name_out(int i) {
  switch (i) {
  case 0:
    return "o0";
  case 1:
    return "o1";
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<pathcon_nm7_name_out>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     112b <pathcon_nm7_name_out+0x2b>
jmp    111a <pathcon_nm7_name_out+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     113b <pathcon_nm7_name_out+0x3b>
jmp    114b <pathcon_nm7_name_out+0x4b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <pathcon_nm7_name_out+0x53>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <pathcon_nm7_name_out+0x53>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathcon_nm7_name_out>:
xor    %ecx,%ecx
cmp    $0x1,%edi
lea    0xef7(%rip),%rax
cmove  %rax,%rcx
test   %edi,%edi
lea    0xee7(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"o0\00"
@.str.1 = [3 x i8] c"o1\00"
define i8* @pathcon_nm7_name_out(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 0, label %5
i32 1, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* null, i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"o0\00"
@.str.1 = [3 x i8] c"o1\00"
define i8* @pathcon_nm7_name_out(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* null
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
float ctof(float cels) { return (9.0 / 5.0) * cels + 32; }


x86 assembly (clang, -O0):
<ctof>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee2(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define float @ctof(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = call double @llvm.fmuladd.f64(double 1.800000e+00, double %4, double 3.200000e+01)
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @ctof(float %0) {
%2 = fpext float %0 to double
%3 = tail call double @llvm.fmuladd.f64(double %2, double 1.800000e+00, double 3.200000e+01)
%4 = fptrunc double %3 to float
ret float %4
}
float Max(float v1, float v2) { return v1 > v2 ? v1 : v2; }


x86 assembly (clang, -O0):
<Max>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    112c <Max+0x2c>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1136 <Max+0x36>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Max>:
maxss  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @Max(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
int rule_Inst(char *str) {}


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

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

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

LLVM IR (-O2):
define i32 @rule_Inst(i8* nocapture readnone %0) {
ret i32 undef
}
/* Variables and functions */
int test_sat_parser_should_fail(char *);
int test13(void) { return test_sat_parser_should_fail("(a or -bc) (-a or c)"); }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"(a or -bc) (-a or c)\00"
define i32 @test13() {
%1 = call i32 @test_sat_parser_should_fail(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [21 x i8] c"(a or -bc) (-a or c)\00"
define i32 @test13() {
%1 = tail call i32 @test_sat_parser_should_fail(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int vsnprintf(char *, size_t, char const *, int /*<<< orphan*/);
int outside_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
  return vsnprintf(str, size, format, ap);
}


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

x86 assembly (clang, -O2):
<outside_vsnprintf>:
jmp    1030 <vsnprintf@plt>

LLVM IR (-O0):
define i32 @outside_vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 @vsnprintf(i8* %9, i64 %10, i8* %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @outside_vsnprintf(i8* nocapture %0, i64 %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 @vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3)
ret i32 %5
}
unsigned char read_bit(unsigned long *bitpointer,
                       const unsigned char *bitstream) {
  unsigned char result =
      (unsigned char)((bitstream[(*bitpointer) >> 3] >> ((*bitpointer) & 0x7)) &
                      1);
  (*bitpointer)++;
  return result;
}


x86 assembly (clang, -O0):
<read_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
shr    $0x3,%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
and    $0x7,%rcx
sar    %cl,%eax
and    $0x1,%eax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
movzbl -0x11(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_bit>:
mov    (%rdi),%rdx
mov    %rdx,%rax
shr    $0x3,%rax
mov    (%rsi,%rax,1),%al
mov    %edx,%ecx
and    $0x7,%cl
shr    %cl,%al
and    $0x1,%al
add    $0x1,%rdx
mov    %rdx,(%rdi)
ret

LLVM IR (-O0):
define zeroext i8 @read_bit(i64* %0, i8* %1) {
%3 = alloca i64*
%4 = alloca i8*
%5 = alloca i8
store i64* %0, i64** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = load i64*, i64** %3
%8 = load i64, i64* %7
%9 = lshr i64 %8, 3
%10 = getelementptr inbounds i8, i8* %6, i64 %9
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = load i64*, i64** %3
%14 = load i64, i64* %13
%15 = and i64 %14, 7
%16 = trunc i64 %15 to i32
%17 = ashr i32 %12, %16
%18 = and i32 %17, 1
%19 = trunc i32 %18 to i8
store i8 %19, i8* %5
%20 = load i64*, i64** %3
%21 = load i64, i64* %20
%22 = add i64 %21, 1
store i64 %22, i64* %20
%23 = load i8, i8* %5
ret i8 %23
}

LLVM IR (-O2):
define zeroext i8 @read_bit(i64* nocapture %0, i8* nocapture %1) {
%3 = load i64, i64* %0
%4 = lshr i64 %3, 3
%5 = getelementptr inbounds i8, i8* %1, i64 %4
%6 = load i8, i8* %5
%7 = trunc i64 %3 to i8
%8 = and i8 %7, 7
%9 = lshr i8 %6, %8
%10 = and i8 %9, 1
%11 = add i64 %3, 1
store i64 %11, i64* %0
ret i8 %10
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int clear_data(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(18, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<clear_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x12,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_data>:
mov    $0x12,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @clear_data() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc4c(i32 18, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @clear_data() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 18, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int closedir(DIR *dirp) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @closedir(i32* nocapture readnone %0) {
ret i32 -1
}
/* Type definitions */
typedef scalar_t__ uint32_t;
typedef scalar_t__ int32_t;

/* Variables and functions */
int nd();
int32_t compute2(uint32_t t[6][2]) {
  int i2 = nd();
  return t[0][1] + t[1][1] + t[5][1];
}


x86 assembly (clang, -O0):
<compute2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <nd@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x8(%rbp),%rcx
add    0x18(%rcx),%rax
mov    -0x8(%rbp),%rcx
add    0x58(%rcx),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute2>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <nd@plt>
mov    0x18(%rbx),%rax
add    0x8(%rbx),%rax
add    0x58(%rbx),%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @compute2([2 x i64]* %0) {
%2 = alloca [2 x i64]*
%3 = alloca i32
store [2 x i64]* %0, [2 x i64]** %2
%4 = call i32 (...) @nd()
store i32 %4, i32* %3
%5 = load [2 x i64]*, [2 x i64]** %2
%6 = getelementptr inbounds [2 x i64], [2 x i64]* %5, i64 0
%7 = getelementptr inbounds [2 x i64], [2 x i64]* %6, i64 0, i64 1
%8 = load i64, i64* %7
%9 = load [2 x i64]*, [2 x i64]** %2
%10 = getelementptr inbounds [2 x i64], [2 x i64]* %9, i64 1
%11 = getelementptr inbounds [2 x i64], [2 x i64]* %10, i64 0, i64 1
%12 = load i64, i64* %11
%13 = add nsw i64 %8, %12
%14 = load [2 x i64]*, [2 x i64]** %2
%15 = getelementptr inbounds [2 x i64], [2 x i64]* %14, i64 5
%16 = getelementptr inbounds [2 x i64], [2 x i64]* %15, i64 0, i64 1
%17 = load i64, i64* %16
%18 = add nsw i64 %13, %17
ret i64 %18
}

LLVM IR (-O2):
define i64 @compute2([2 x i64]* nocapture %0) {
%2 = tail call i32 (...) @nd()
%3 = getelementptr inbounds [2 x i64], [2 x i64]* %0, i64 0, i64 1
%4 = load i64, i64* %3
%5 = getelementptr inbounds [2 x i64], [2 x i64]* %0, i64 1, i64 1
%6 = load i64, i64* %5
%7 = add nsw i64 %6, %4
%8 = getelementptr inbounds [2 x i64], [2 x i64]* %0, i64 5, i64 1
%9 = load i64, i64* %8
%10 = add nsw i64 %7, %9
ret i64 %10
}
void main(int n) {
  int i;
  int j;
  i = 1;
  j = 10;
  while (j >= i) {
    i = i + 2;
    j = -1 + j;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     113a <main+0x3a>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <main+0x15>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @main(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_bitset_get() {
  printf("NOT IMPLEMENTED:"
         "pa_bitset_get"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"NOT IMPLEMENTED:pa_bitset_get\0A\00"
define i32 @pa_bitset_get() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [30 x i8] c"NOT IMPLEMENTED:pa_bitset_get\00"
define i32 @pa_bitset_get() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
int EQ(struct bb *a, struct bb *b) { return (a && a == b); }


x86 assembly (clang, -O0):
<EQ>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     112a <EQ+0x2a>
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<EQ>:
test   %rdi,%rdi
setne  %al
cmp    %rsi,%rdi
sete   %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
%struct.bb = type opaque
define i32 @EQ(%struct.bb* %0, %struct.bb* %1) {
%3 = alloca %struct.bb*
%4 = alloca %struct.bb*
store %struct.bb* %0, %struct.bb** %3
store %struct.bb* %1, %struct.bb** %4
%5 = load %struct.bb*, %struct.bb** %3
%6 = icmp ne %struct.bb* %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load %struct.bb*, %struct.bb** %3
%9 = load %struct.bb*, %struct.bb** %4
%10 = icmp eq %struct.bb* %8, %9
br label %11
11: ; preds = %7, %2
%12 = phi i1 [ false, %2 ], [ %10, %7 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
%struct.bb = type opaque
define i32 @EQ(%struct.bb* readnone %0, %struct.bb* readnone %1) {
%3 = icmp ne %struct.bb* %0, null
%4 = icmp eq %struct.bb* %0, %1
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
void fz_cpudetect(void) {}


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

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

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

LLVM IR (-O2):
define void @fz_cpudetect() {
ret void
}
/* Variables and functions */
double omp_get_wtime();
void dtime(double *t) { *t = omp_get_wtime(); }


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

x86 assembly (clang, -O2):
<dtime>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @dtime(double* nocapture writeonly %0) {
%2 = tail call double (...) @omp_get_wtime()
store double %2, double* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ iscntrl(int);
void t_iscntrl_0x04() {
  Assert_real((iscntrl(4)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_iscntrl.c",
              25, ("iscntrl should be 1 for 0x04"));
}


x86 assembly (clang, -O0):
<t_iscntrl_0x04>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
call   1030 <iscntrl@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x19,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_iscntrl_0x04>:
push   %rax
mov    $0x4,%edi
call   1030 <iscntrl@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x19,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 1 for 0x04\00"
define void @t_iscntrl_0x04() {
%1 = call i32 @iscntrl(i32 4)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 25, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 1 for 0x04\00"
define void @t_iscntrl_0x04() {
%1 = tail call i32 @iscntrl(i32 4)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 25, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned int GPIOPinRead(unsigned int baseAdd, unsigned int pinNumber) {
  return ((*((volatile unsigned int *)(baseAdd + (0x138)))) & (1 << pinNumber));
}


x86 assembly (clang, -O0):
<GPIOPinRead>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x138,%eax
mov    %eax,%eax
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPIOPinRead>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
add    $0x138,%edi
and    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @GPIOPinRead(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 = add i32 %5, 312
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = load i32, i32* %4
%11 = shl i32 1, %10
%12 = and i32 %9, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @GPIOPinRead(i32 %0, i32 %1) {
%3 = add i32 %0, 312
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = shl nuw i32 1, %1
%8 = and i32 %6, %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ IPPROTO_UDP;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ perror(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  if (socket(PF_INET, SOCK_RAW, IPPROTO_UDP) == -1) {
    perror("socket");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
mov    0x2e80(%rip),%rax
mov    (%rax),%edx
call   1040 <socket@plt>
cmp    $0xffffffff,%eax
jne    1170 <main+0x50>
lea    0xea1(%rip),%rdi
call   1030 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1177 <main+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
mov    0x2e8e(%rip),%rax
mov    (%rax),%edx
call   1040 <socket@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
je     114c <main+0x2c>
pop    %rcx
ret
lea    0xead(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@PF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_UDP = global i32 0
@.str = [7 x i8] c"socket\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @PF_INET
%3 = load i32, i32* @SOCK_RAW
%4 = load i32, i32* @IPPROTO_UDP
%5 = call i32 @socket(i32 %2, i32 %3, i32 %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %10
9: ; preds = %0
store i32 0, i32* %1
br label %10
10: ; preds = %9, %7
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@PF_INET = global i32 0
@SOCK_RAW = global i32 0
@IPPROTO_UDP = global i32 0
@.str = [7 x i8] c"socket\00"
define i32 @main() {
%1 = load i32, i32* @PF_INET
%2 = load i32, i32* @SOCK_RAW
%3 = load i32, i32* @IPPROTO_UDP
%4 = tail call i32 @socket(i32 %1, i32 %2, i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %0, %6
%9 = phi i32 [ 1, %6 ], [ 0, %0 ]
ret i32 %9
}
/* Type definitions */
struct standrupformat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ write_srf(struct standrupformat *, char *, int);
void write2srf(struct standrupformat *srf, char *str, int outbin) {
  write_srf(srf, str, outbin);
}


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

x86 assembly (clang, -O2):
<write2srf>:
jmp    1030 <write_srf@plt>

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

LLVM IR (-O2):
%struct.standrupformat = type { i32 }
define void @write2srf(%struct.standrupformat* %0, i8* %1, i32 %2) {
%4 = tail call i32 @write_srf(%struct.standrupformat* %0, i8* %1, i32 %2)
ret void
}
void mem_put_be16_as_int(void *vmem, int val) {
  unsigned char *mem = (unsigned char *)vmem;
  mem[0] = (unsigned char)((val >> 8) & 0xff);
  mem[1] = (unsigned char)((val >> 0) & 0xff);
}


x86 assembly (clang, -O0):
<mem_put_be16_as_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_put_be16_as_int>:
rol    $0x8,%si
mov    %si,(%rdi)
ret

LLVM IR (-O0):
define void @mem_put_be16_as_int(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
%7 = load i32, i32* %4
%8 = ashr i32 %7, 8
%9 = and i32 %8, 255
%10 = trunc i32 %9 to i8
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 0
store i8 %10, i8* %12
%13 = load i32, i32* %4
%14 = ashr i32 %13, 0
%15 = and i32 %14, 255
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i64 1
store i8 %16, i8* %18
ret void
}

LLVM IR (-O2):
define void @mem_put_be16_as_int(i8* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 8
%4 = trunc i32 %3 to i8
store i8 %4, i8* %0
%5 = trunc i32 %1 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glClearColor(double, double, double, int);
void gluiClearColor() { glClearColor(0.8, 0.8, 0.8, 1); }


x86 assembly (clang, -O0):
<gluiClearColor>:
push   %rbp
mov    %rsp,%rbp
movsd  0xee4(%rip),%xmm2
mov    $0x1,%edi
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1030 <glClearColor@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gluiClearColor>:
movsd  0xee8(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
mov    $0x1,%edi
jmp    1030 <glClearColor@plt>

LLVM IR (-O0):
define void @gluiClearColor() {
%1 = call i32 @glClearColor(double 8.000000e-01, double 8.000000e-01, double 8.000000e-01, i32 1)
ret void
}

LLVM IR (-O2):
define void @gluiClearColor() {
%1 = tail call i32 @glClearColor(double 8.000000e-01, double 8.000000e-01, double 8.000000e-01, i32 1)
ret void
}
void RTTestSubDone(void) {}


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

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

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

LLVM IR (-O2):
define void @RTTestSubDone() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ challenge10(char *, int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ challenge11(char *);
int /*<<< orphan*/ challenge9(char *, int);
int /*<<< orphan*/ printf(char *);
void set2() {
  printf("****** Set 2\n");
  challenge9("YELLOW SUBMARINE", 20);
  challenge10("files/10.txt", (uint8_t *)"YELLOW SUBMARINE", 16, 128);
  challenge11(
      "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
}


x86 assembly (clang, -O0):
<set2>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
mov    $0x14,%esi
call   1050 <challenge9@plt>
lea    0xeb7(%rip),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x10,%edx
mov    $0x80,%ecx
call   1040 <challenge10@plt>
lea    0xea7(%rip),%rdi
call   1060 <challenge11@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set2>:
push   %rbx
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rbx
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <challenge9@plt>
lea    0xea9(%rip),%rdi
mov    %rbx,%rsi
mov    $0x10,%edx
mov    $0x80,%ecx
call   1040 <challenge10@plt>
lea    0xe9d(%rip),%rdi
pop    %rbx
jmp    1060 <challenge11@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"****** Set 2\0A\00"
@.str.1 = [17 x i8] c"YELLOW SUBMARINE\00"
@.str.2 = [13 x i8] c"files/10.txt\00"
@.str.3 = [65 x i8] c"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\00"
define void @set2() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @challenge9(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 20)
%3 = call i32 @challenge10(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32* bitcast ([17 x i8]* @.str.1 to i32*), i32 16, i32 128)
%4 = call i32 @challenge11(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"YELLOW SUBMARINE\00"
@.str.2 = [13 x i8] c"files/10.txt\00"
@.str.3 = [65 x i8] c"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\00"
@str = [13 x i8] c"****** Set 2\00"
define void @set2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @challenge9(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 20)
%3 = tail call i32 @challenge10(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32* bitcast ([17 x i8]* @.str.1 to i32*), i32 16, i32 128)
%4 = tail call i32 @challenge11(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0))
ret void
}
double square(int val) { return (double)val * val; }


x86 assembly (clang, -O0):
<square>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<square>:
cvtsi2sd %edi,%xmm0
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @square(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = load i32, i32* %2
%6 = sitofp i32 %5 to double
%7 = fmul double %4, %6
ret double %7
}

LLVM IR (-O2):
define double @square(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fmul double %2, %2
ret double %3
}
void iommu_put_dma_cookie(struct iommu_domain *domain) {}


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

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

LLVM IR (-O0):
%struct.iommu_domain = type opaque
define void @iommu_put_dma_cookie(%struct.iommu_domain* %0) {
%2 = alloca %struct.iommu_domain*
store %struct.iommu_domain* %0, %struct.iommu_domain** %2
ret void
}

LLVM IR (-O2):
%struct.iommu_domain = type opaque
define void @iommu_put_dma_cookie(%struct.iommu_domain* nocapture %0) {
ret void
}
/* Type definitions */
struct group {
  int dummy;
};

/* Variables and functions */
struct group *getgrnam(char *);
int hasttygrp(void) {
  struct group *grp;
  if ((grp = getgrnam("tty")) != NULL)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<hasttygrp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <getgrnam@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     113e <hasttygrp+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1145 <hasttygrp+0x35>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hasttygrp>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <getgrnam@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.group = type { i32 }
@.str = [4 x i8] c"tty\00"
define i32 @hasttygrp() {
%1 = alloca i32
%2 = alloca %struct.group*
%3 = call %struct.group* @getgrnam(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store %struct.group* %3, %struct.group** %2
%4 = icmp ne %struct.group* %3, null
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 1, i32* %1
br label %7
6: ; preds = %0
store i32 0, i32* %1
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
%struct.group = type { i32 }
@.str = [4 x i8] c"tty\00"
define i32 @hasttygrp() {
%1 = tail call %struct.group* @getgrnam(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = icmp ne %struct.group* %1, null
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int);
void __attribute__((regparm(3))) memcpy_12(void *dest, void *src) {
  memcpy(dest, src, 12);
}


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

x86 assembly (clang, -O2):
<memcpy_12>:
mov    $0xc,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @memcpy_12(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 @memcpy(i8* %5, i8* %6, i32 12)
ret void
}

LLVM IR (-O2):
define void @memcpy_12(i8* %0, i8* %1) {
%3 = tail call i32 @memcpy(i8* %0, i8* %1, i32 12)
ret void
}
void f20decl() {}


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

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

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

LLVM IR (-O2):
define void @f20decl() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ handle_request(int);
void handle_fork(int msgsock) {
  if (fork() == 0) {
    handle_request(msgsock);
    exit(0);
  } else {
    close(msgsock);
  }
}


x86 assembly (clang, -O0):
<handle_fork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1060 <fork@plt>
cmp    $0x0,%rax
jne    116b <handle_fork+0x2b>
mov    -0x4(%rbp),%edi
call   1040 <handle_request@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_fork>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1060 <fork@plt>
mov    %ebx,%edi
test   %rax,%rax
je     1157 <handle_fork+0x17>
pop    %rbx
jmp    1030 <close@plt>
call   1040 <handle_request@plt>
xor    %edi,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
define void @handle_fork(i32 %0) {
%2 = tail call i64 (...) @fork()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @handle_request(i32 %0)
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %1
%8 = tail call i32 @close(i32 %0)
ret void
}
unsigned short buf2short(unsigned char *buf) {
  return (unsigned short)(buf[1] << 8 | buf[0]);
}


x86 assembly (clang, -O0):
<buf2short>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<buf2short>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define zeroext i16 @buf2short(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl i32 %6, 8
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = or i32 %7, %11
%13 = trunc i32 %12 to i16
ret i16 %13
}

LLVM IR (-O2):
define zeroext i16 @buf2short(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = zext i8 %3 to i16
%5 = shl nuw i16 %4, 8
%6 = load i8, i8* %0
%7 = zext i8 %6 to i16
%8 = or i16 %5, %7
ret i16 %8
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int getpid();
int get_my_rank(void) {
  pid_t pid = getpid();
  return (pid & 0xFF);
}


x86 assembly (clang, -O0):
<get_my_rank>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_my_rank>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
movzbl %al,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @get_my_rank() {
%1 = alloca i32
%2 = call i32 (...) @getpid()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = and i32 %3, 255
ret i32 %4
}

LLVM IR (-O2):
define i32 @get_my_rank() {
%1 = tail call i32 (...) @getpid()
%2 = and i32 %1, 255
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ p1;
typedef int /*<<< orphan*/ c2;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
void test_base_type_declarator() {
  char *p1, c2;
  assert(sizeof(p1) == sizeof(char *));
  assert(sizeof(c2) == sizeof(char));
}


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

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

LLVM IR (-O0):
define void @test_base_type_declarator() {
%1 = alloca i8*
%2 = alloca i8
%3 = call i32 @assert(i32 1)
%4 = call i32 @assert(i32 1)
ret void
}

LLVM IR (-O2):
define void @test_base_type_declarator() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void disp_clear(void) {
  system("clear");
  return;
}


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
define void @disp_clear() {
%1 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define void @disp_clear() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}