xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ drv_GU311_send_char(char);
void drv_GU311_send_string(char *str, int size) {
  int i;
  for (i = 0; i < size; i++)
    drv_GU311_send_char(str[i]);
}


x86 assembly (clang, -O0):
<drv_GU311_send_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <drv_GU311_send_string+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <drv_GU311_send_char@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <drv_GU311_send_string+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_GU311_send_string>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1143 <drv_GU311_send_string+0x33>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1030 <drv_GU311_send_char@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <drv_GU311_send_string+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @drv_GU311_send_string(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call i32 @drv_GU311_send_char(i8 signext %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
void box_init(struct box *box) {}


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

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

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

LLVM IR (-O2):
%struct.box = type opaque
define void @box_init(%struct.box* nocapture %0) {
ret void
}
void g_object_get_data() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ vswscanf(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                            int /*<<< orphan*/);
void uninitvar_vswscanf(void) {
  wchar_t *s;
  wchar_t *format;
  va_list arg;
  (void)vswscanf(s, format, arg);
}


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

x86 assembly (clang, -O2):
<uninitvar_vswscanf>:
jmp    1030 <vswscanf@plt>

LLVM IR (-O0):
define void @uninitvar_vswscanf() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = load i32*, i32** %1
%5 = load i32*, i32** %2
%6 = load i32, i32* %3
%7 = call i32 @vswscanf(i32* %4, i32* %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @uninitvar_vswscanf() {
%1 = tail call i32 @vswscanf(i32* undef, i32* undef, i32 undef)
ret void
}
int (*return_2d_array())[] {
  int x[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
  int(*r)[] = x;
  return r;
}


x86 assembly (clang, -O0):
<return_2d_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xedd(%rip),%rsi
mov    $0x24,%edx
call   1030 <memcpy@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<return_2d_array>:
lea    -0x28(%rsp),%rax
ret

LLVM IR (-O0):
@__const.return_2d_array.x = [3 x [3 x i32]] [[3 x i32] [i32 1, i32 2, i32 3], [3 x i32] [i32 4, i32 5, i32 6], [3 x i32] [i32 7, i32 8, i32 9]]
define [0 x i32]* @return_2d_array() {
%1 = alloca [3 x [3 x i32]]
%2 = alloca [0 x i32]*
%3 = bitcast [3 x [3 x i32]]* %1 to i8*
%4 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %1, i64 0, i64 0
%5 = bitcast [3 x i32]* %4 to [0 x i32]*
store [0 x i32]* %5, [0 x i32]** %2
%6 = load [0 x i32]*, [0 x i32]** %2
ret [0 x i32]* %6
}

LLVM IR (-O2):
define noalias [0 x i32]* @return_2d_array() {
%1 = alloca [3 x [3 x i32]]
%2 = bitcast [3 x [3 x i32]]* %1 to i8*
%3 = bitcast [3 x [3 x i32]]* %1 to [0 x i32]*
ret [0 x i32]* %3
}
/* Variables and functions */
int write(int, void *, int);
int writeTTY(int fd, void *buf, int N) { return write(fd, buf, N); }


x86 assembly (clang, -O0):
<writeTTY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeTTY>:
jmp    1030 <write@plt>

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

LLVM IR (-O2):
define i32 @writeTTY(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
int test_imm_7Cuint16_mem(unsigned short *val) {
  return ((*val) & (0x7C << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_7Cuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 124
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fprintf(int /*<<< orphan*/ *, char *, char *);
int zomp_writeCString(void *file, char *val) {
  return fprintf((FILE *)file, "%s", val);
}


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

x86 assembly (clang, -O2):
<zomp_writeCString>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @zomp_writeCString(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 i32*
%7 = load i8*, i8** %4
%8 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 %8
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @zomp_writeCString(i8* nocapture %0, i8* %1) {
%3 = bitcast i8* %0 to i32*
%4 = tail call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int os_daemon_return(int, int);
int os_daemon(int nochdir, int noclose) {
  int ret = -1;
  ret = os_daemon_return(nochdir, noclose);
  if (ret <= 0)
    return ret;
  _exit(0);
}


x86 assembly (clang, -O0):
<os_daemon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <os_daemon_return@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     1156 <os_daemon+0x36>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret
xor    %edi,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<os_daemon>:
push   %rax
call   1040 <os_daemon_return@plt>
test   %eax,%eax
jg     112c <os_daemon+0xc>
pop    %rcx
ret
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define i32 @os_daemon(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 -1, i32* %5
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @os_daemon_return(i32 %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp sle i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i32, i32* %5
ret i32 %12
13: ; preds = %2
%14 = call i32 @_exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @os_daemon(i32 %0, i32 %1) {
%3 = tail call i32 @os_daemon_return(i32 %0, i32 %1)
%4 = icmp slt i32 %3, 1
br i1 %4, label %5, label %6
5: ; preds = %2
ret i32 %3
6: ; preds = %2
%7 = tail call i32 @_exit(i32 0)
unreachable
}
void lstat_set(unsigned int addr, int cnt, int cpuahbm, int event) {
  volatile unsigned int *ctrl = (unsigned int *)(addr + 0x100);
  ctrl[cnt] = (1 << 12) | (event << 4) | cpuahbm;
}


x86 assembly (clang, -O0):
<lstat_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x100,%eax
mov    %eax,%eax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%edx
shl    $0x4,%edx
or     $0x1000,%edx
or     -0xc(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<lstat_set>:
add    $0x100,%edi
shl    $0x4,%ecx
or     %edx,%ecx
or     $0x1000,%ecx
movslq %esi,%rax
mov    %ecx,(%rdi,%rax,4)
ret

LLVM IR (-O0):
define void @lstat_set(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = add i32 %10, 256
%12 = zext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %9
%14 = load i32, i32* %8
%15 = shl i32 %14, 4
%16 = or i32 4096, %15
%17 = load i32, i32* %7
%18 = or i32 %16, %17
%19 = load i32*, i32** %9
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
store volatile i32 %18, i32* %22
ret void
}

LLVM IR (-O2):
define void @lstat_set(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add i32 %0, 256
%6 = zext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = shl i32 %3, 4
%9 = or i32 %8, %2
%10 = or i32 %9, 4096
%11 = sext i32 %1 to i64
%12 = getelementptr inbounds i32, i32* %7, i64 %11
store volatile i32 %10, i32* %12
ret void
}
double p4(double x) { return 24.0 + x * (-24.0 + x * (12.0 + x * (-4.0 + x))); }


x86 assembly (clang, -O0):
<p4>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  0xef8(%rip),%xmm3
addsd  -0x8(%rbp),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xedf(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xec7(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeaf(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<p4>:
movsd  0xef8(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xef0(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xeec(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  0xee8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @p4(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = load double, double* %2
%6 = load double, double* %2
%7 = fadd double -4.000000e+00, %6
%8 = call double @llvm.fmuladd.f64(double %5, double %7, double 1.200000e+01)
%9 = call double @llvm.fmuladd.f64(double %4, double %8, double -2.400000e+01)
%10 = call double @llvm.fmuladd.f64(double %3, double %9, double 2.400000e+01)
ret double %10
}

LLVM IR (-O2):
define double @p4(double %0) {
%2 = fadd double %0, -4.000000e+00
%3 = tail call double @llvm.fmuladd.f64(double %0, double %2, double 1.200000e+01)
%4 = tail call double @llvm.fmuladd.f64(double %0, double %3, double -2.400000e+01)
%5 = tail call double @llvm.fmuladd.f64(double %0, double %4, double 2.400000e+01)
ret double %5
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn7() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn7");
  return result;
}


x86 assembly (clang, -O0):
<fn7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn7>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"fn7\00"
define i8* @fn7() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [4 x i8] c"fn7\00"
define i8* @fn7() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int, int);
int /*<<< orphan*/ sscanf(char *, char *, char *, int *, int *);
int main() {
  char array[] = "AA 2";
  int n, a, b;
  char str[1000];
  sscanf(array, "%s %n %d", str, &n, &b);
  printf("%s %d %d\n", str, n, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xec3(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x9(%rbp),%rdi
lea    -0x400(%rbp),%rdx
lea    0xeaf(%rip),%rsi
lea    -0x10(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1040 <sscanf@plt>
lea    -0x400(%rbp),%rsi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
movb   $0x0,0x4(%rsp)
movl   $0x32204141,(%rsp)
lea    0xeca(%rip),%rsi
mov    %rsp,%rdi
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %rbx,%rdx
call   1040 <sscanf@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0xeaa(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [5 x i8] c"AA 2\00"
@.str = [9 x i8] c"%s %n %d\00"
@.str.1 = [10 x i8] c"%s %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1000 x i8]
store i32 0, i32* %1
%7 = bitcast [5 x i8]* %2 to i8*
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%10 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %9, i32* %3, i32* %5)
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%12 = load i32, i32* %3
%13 = load i32, i32* %5
%14 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 %12, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [5 x i8] c"AA 2\00"
@.str = [9 x i8] c"%s %n %d\00"
@.str.1 = [10 x i8] c"%s %d %d\0A\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1000 x i8]
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%9 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8, i32* %2, i32* %3)
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %8, i32 %10, i32 %11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ quit();
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int bye(int sock_fd) {
  send(sock_fd, "BYE", 3, 0);
  close(sock_fd);
  quit();
  return 0;
}


x86 assembly (clang, -O0):
<bye>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xebb(%rip),%rsi
mov    $0x3,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    -0x4(%rbp),%edi
call   1050 <close@plt>
mov    $0x0,%al
call   1040 <quit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bye>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rsi
mov    $0x3,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    %ebx,%edi
call   1050 <close@plt>
xor    %eax,%eax
call   1040 <quit@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"BYE\00"
define i32 @bye(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @send(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3, i32 0)
%5 = load i32, i32* %2
%6 = call i32 @close(i32 %5)
%7 = call i32 (...) @quit()
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"BYE\00"
define i32 @bye(i32 %0) {
%2 = tail call i32 @send(i32 %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3, i32 0)
%3 = tail call i32 @close(i32 %0)
%4 = tail call i32 (...) @quit()
ret i32 0
}
int check_val_MAIL_STREAMint(int v) { return v; }


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

x86 assembly (clang, -O2):
<check_val_MAIL_STREAMint>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @check_val_MAIL_STREAMint(i32 returned %0) {
ret i32 %0
}
void gdk_visual_get_best_depth() {}


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

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

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

LLVM IR (-O2):
define void @gdk_visual_get_best_depth() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("hello Github\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"hello Github\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"hello Github\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
unsigned long long nextCollatz(unsigned long long);
unsigned int collatzLen(unsigned long long n) {
  unsigned int len = 1;
  while (n > 1) {
    n = nextCollatz(n);
    ++len;
  }
  return len;
}


x86 assembly (clang, -O0):
<collatzLen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpq   $0x1,-0x8(%rbp)
jbe    1149 <collatzLen+0x39>
mov    -0x8(%rbp),%rdi
call   1030 <nextCollatz@plt>
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <collatzLen+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<collatzLen>:
push   %rbx
mov    $0x1,%ebx
cmp    $0x2,%rdi
jb     1141 <collatzLen+0x31>
mov    %rdi,%rax
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,%rdi
call   1030 <nextCollatz@plt>
add    $0x1,%ebx
cmp    $0x1,%rax
ja     1130 <collatzLen+0x20>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @collatzLen(i64 %0) {
%2 = icmp ugt i64 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 1, %1 ]
%5 = phi i64 [ %6, %3 ], [ %0, %1 ]
%6 = tail call i64 @nextCollatz(i64 %5)
%7 = add i32 %4, 1
%8 = icmp ugt i64 %6, 1
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 1, %1 ], [ %7, %3 ]
ret i32 %10
}
int mdm6600_init_modemctl_device(struct modem_ctl *mc,
                                 struct modem_data *pdata) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.modem_ctl = type opaque
%struct.modem_data = type opaque
define i32 @mdm6600_init_modemctl_device(%struct.modem_ctl* %0, %struct.modem_data* %1) {
%3 = alloca %struct.modem_ctl*
%4 = alloca %struct.modem_data*
store %struct.modem_ctl* %0, %struct.modem_ctl** %3
store %struct.modem_data* %1, %struct.modem_data** %4
ret i32 0
}

LLVM IR (-O2):
%struct.modem_ctl = type opaque
%struct.modem_data = type opaque
define i32 @mdm6600_init_modemctl_device(%struct.modem_ctl* nocapture readnone %0, %struct.modem_data* nocapture readnone %1) {
ret i32 0
}
int grid_xpair_ispeer(int socktype) { return socktype == (1 * 16 + 0) ? 1 : 0; }


x86 assembly (clang, -O0):
<grid_xpair_ispeer>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x10,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<grid_xpair_ispeer>:
xor    %eax,%eax
cmp    $0x10,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @grid_xpair_ispeer(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 16
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 1, i32 0
ret i32 %6
}

LLVM IR (-O2):
define i32 @grid_xpair_ispeer(i32 %0) {
%2 = icmp eq i32 %0, 16
%3 = zext i1 %2 to i32
ret i32 %3
}
void foo() {
#pragma omp ordered
  { return; }
}


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

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

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

LLVM IR (-O2):
define void @foo() {
ret void
}
void CrashLog_Init(void) {}


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

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

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

LLVM IR (-O2):
define void @CrashLog_Init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int i;
  for (i = 0; i < 256; i++) {
    printf("%d ---> %c\n", i, i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    1153 <main+0x43>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"%d ---> %c\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 256
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
bool AUXTDCCounterDisable(uint32_t ui32Base) {
  ;
  if (!(((*((volatile unsigned long *)(ui32Base + 0x00000004))) & 0x0000003F) ==
        0x00000006)) {
    return false;
  }
  (*((volatile unsigned long *)(ui32Base + 0x0000001C))) = 0;
  return true;
}


x86 assembly (clang, -O0):
<AUXTDCCounterDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%rax
and    $0x3f,%rax
cmp    $0x6,%rax
je     112a <AUXTDCCounterDisable+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    113d <AUXTDCCounterDisable+0x3d>
mov    -0x10(%rbp),%rax
movq   $0x0,0x1c(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AUXTDCCounterDisable>:
mov    0x4(%rdi),%rcx
and    $0x3f,%ecx
xor    %eax,%eax
cmp    $0x6,%ecx
jne    111b <AUXTDCCounterDisable+0x1b>
movq   $0x0,0x1c(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @AUXTDCCounterDisable(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = add nsw i64 %4, 4
%6 = inttoptr i64 %5 to i64*
%7 = load volatile i64, i64* %6
%8 = and i64 %7, 63
%9 = icmp eq i64 %8, 6
br i1 %9, label %11, label %10
10: ; preds = %1
store i32 0, i32* %2
br label %15
11: ; preds = %1
%12 = load i64, i64* %3
%13 = add nsw i64 %12, 28
%14 = inttoptr i64 %13 to i64*
store volatile i64 0, i64* %14
store i32 1, i32* %2
br label %15
15: ; preds = %11, %10
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @AUXTDCCounterDisable(i64 %0) {
%2 = add nsw i64 %0, 4
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = and i64 %4, 63
%6 = icmp eq i64 %5, 6
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = add nsw i64 %0, 28
%9 = inttoptr i64 %8 to i64*
store volatile i64 0, i64* %9
br label %10
10: ; preds = %1, %7
%11 = phi i32 [ 1, %7 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void write_lines(char *pointer_array[], int lines_count) {
  while (lines_count-- > 0)
    printf("%s\n", *pointer_array++);
}


x86 assembly (clang, -O0):
<write_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
jle    1158 <write_lines+0x48>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%rax
mov    %eax,%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
jmp    111f <write_lines+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_lines>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    1146 <write_lines+0x36>
mov    %esi,%ebp
mov    %rdi,%rbx
add    $0x1,%ebp
lea    0xed9(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%esi
add    $0x8,%rbx
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1130 <write_lines+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @write_lines(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i8** [ %8, %4 ], [ %0, %2 ]
%7 = add nsw i32 %5, -1
%8 = getelementptr inbounds i8*, i8** %6, i64 1
%9 = load i8*, i8** %6
%10 = ptrtoint i8* %9 to i64
%11 = trunc i64 %10 to i32
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = icmp ugt i32 %5, 1
br i1 %13, label %4, label %14
14: ; preds = %4, %2
ret void
}
/* Variables and functions */
int uintGreaterThan(void const *, void const *);
int uintLessThan(const void *a, const void *b) { return uintGreaterThan(b, a); }


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

x86 assembly (clang, -O2):
<uintLessThan>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <uintGreaterThan@plt>

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

LLVM IR (-O2):
define i32 @uintLessThan(i8* %0, i8* %1) {
%3 = tail call i32 @uintGreaterThan(i8* %1, i8* %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fmax(float, float);
float fmin(int /*<<< orphan*/, float);
float clampf(float value, float max, float min) {
  return fmin(fmax(min, value), max);
}


x86 assembly (clang, -O0):
<clampf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
call   1040 <fmax@plt>
mov    %eax,%edi
movss  -0x8(%rbp),%xmm0
call   1030 <fmin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clampf>:
push   %rax
movss  %xmm1,0x4(%rsp)
movaps %xmm0,%xmm1
movaps %xmm2,%xmm0
call   1040 <fmax@plt>
mov    %eax,%edi
movss  0x4(%rsp),%xmm0
pop    %rax
jmp    1030 <fmin@plt>

LLVM IR (-O0):
define float @clampf(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %6
%8 = load float, float* %4
%9 = call i32 @fmax(float %7, float %8)
%10 = load float, float* %5
%11 = call float @fmin(i32 %9, float %10)
ret float %11
}

LLVM IR (-O2):
define float @clampf(float %0, float %1, float %2) {
%4 = tail call i32 @fmax(float %2, float %0)
%5 = tail call float @fmin(i32 %4, float %1)
ret float %5
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int);
void print2i(__m64 v) {
  unsigned *p = (unsigned *)&v;
  printf("[%08x %08x]", p[0], p[1]);
}


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"[%08x %08x]\00"
define void @print2i(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %0, i32 poison)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(void) {
  puts("CTF{wow__much_data__such_return}");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"CTF{wow__much_data__such_return}\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"CTF{wow__much_data__such_return}\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int xstatnoWeak(int i) { return i * 64; }


x86 assembly (clang, -O0):
<xstatnoWeak>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x6,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstatnoWeak>:
mov    %edi,%eax
shl    $0x6,%eax
ret

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

LLVM IR (-O2):
define i32 @xstatnoWeak(i32 %0) {
%2 = shl nsw i32 %0, 6
ret i32 %2
}
/* Variables and functions */
int recv(int, char *, int, int /*<<< orphan*/);
int x_recvbytes(int fd, char *buf, int len) {
  int bytes = -1;
  bytes = recv(fd, buf, len, 0);
  return bytes;
}


x86 assembly (clang, -O0):
<x_recvbytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0xffffffff,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_recvbytes>:
xor    %ecx,%ecx
jmp    1030 <recv@plt>

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

LLVM IR (-O2):
define i32 @x_recvbytes(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @recv(i32 %0, i8* %1, i32 %2, i32 0)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ _io_hlt();
void HariMain(void) {
fin:
  _io_hlt();
  goto fin;
}


x86 assembly (clang, -O0):
<HariMain>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <HariMain+0x9>
mov    $0x0,%al
call   1030 <_io_hlt@plt>
jmp    1119 <HariMain+0x9>

x86 assembly (clang, -O2):
<HariMain>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <_io_hlt@plt>
jmp    1120 <HariMain+0x10>

LLVM IR (-O0):
define void @HariMain() {
br label %1
1: ; preds = %1, %0
%2 = call i32 (...) @_io_hlt()
br label %1
}

LLVM IR (-O2):
define void @HariMain() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @_io_hlt()
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ mtcr(char *, int /*<<< orphan*/);
void init_fpu(void) { mtcr("cr<1, 2>", 0); }


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

x86 assembly (clang, -O2):
<init_fpu>:
lea    0xee9(%rip),%rdi
xor    %esi,%esi
jmp    1030 <mtcr@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"cr<1, 2>\00"
define void @init_fpu() {
%1 = call i32 @mtcr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"cr<1, 2>\00"
define void @init_fpu() {
%1 = tail call i32 @mtcr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 0)
ret void
}
double get(double *a, int idx) { return a[idx]; }


x86 assembly (clang, -O0):
<get>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get>:
movslq %esi,%rax
movsd  (%rdi,%rax,8),%xmm0
ret

LLVM IR (-O0):
define double @get(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%5 = load double*, double** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds double, double* %5, i64 %7
%9 = load double, double* %8
ret double %9
}

LLVM IR (-O2):
define double @get(double* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds double, double* %0, i64 %3
%5 = load double, double* %4
ret double %5
}
unsigned xrop3_90_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;
  stk1 = D ^ T;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_90_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
xor    -0x10(%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_90_0_1>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
xor    $0xff,%ecx
and    %eax,%ecx
not    %eax
and    %esi,%eax
xor    $0xff,%esi
or     %esi,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_90_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
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 8
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = or i32 %11, %13
store i32 %14, i32* %6
%15 = load i8, i8* %4
%16 = zext i8 %15 to i32
%17 = shl i32 %16, 8
%18 = load i8, i8* %4
%19 = zext i8 %18 to i32
%20 = or i32 %17, %19
store i32 %20, i32* %7
%21 = load i32, i32* %5
%22 = load i32, i32* %7
%23 = xor i32 %21, %22
store i32 %23, i32* %8
%24 = load i32, i32* %8
%25 = load i32, i32* %6
%26 = and i32 %24, %25
%27 = load i32, i32* %8
%28 = load i32, i32* %7
%29 = xor i32 %28, -1
%30 = and i32 %27, %29
%31 = or i32 %26, %30
%32 = load i32, i32* %7
%33 = load i32, i32* %6
%34 = xor i32 %33, -1
%35 = and i32 %32, %34
%36 = load i32, i32* %5
%37 = and i32 %35, %36
%38 = or i32 %31, %37
ret i32 %38
}

LLVM IR (-O2):
define i32 @xrop3_90_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 %6, 255
%8 = and i32 %7, %4
%9 = xor i32 %5, 255
%10 = xor i32 %4, -1
%11 = and i32 %10, %5
%12 = or i32 %11, %9
%13 = or i32 %12, %8
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ assert(int);
void *malloc(size_t);
int /*<<< orphan*/ perror(char *);
void *utils_malloc(size_t size) {
  void *ptr;
  assert(size > 0);
  if (!(ptr = malloc(size))) {
    perror("malloc()");
    abort();
  }
  return ptr;
}


x86 assembly (clang, -O0):
<utils_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1188 <utils_malloc+0x48>
lea    0xe84(%rip),%rdi
call   1060 <perror@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utils_malloc>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     1161 <utils_malloc+0x21>
pop    %rbx
ret
lea    0xe98(%rip),%rdi
call   1060 <perror@plt>
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"malloc()\00"
define noalias i8* @utils_malloc(i64 %0) {
%2 = icmp ne i64 %0, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i8* @malloc(i64 %0)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %1
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void json_after() { printf("]\n"); }


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

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

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

LLVM IR (-O2):
@str = [2 x i8] c"]\00"
define void @json_after() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ endian_rev16(int /*<<< orphan*/);
uint16_t endian_ntohs(uint16_t data) { return endian_rev16(data); }


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

x86 assembly (clang, -O2):
<endian_ntohs>:
jmp    1030 <endian_rev16@plt>

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

LLVM IR (-O2):
define i32 @endian_ntohs(i32 %0) {
%2 = tail call i32 @endian_rev16(i32 %0)
ret i32 %2
}
int xmlUCSIsLatinExtendedAdditional(int code) {
  return (((code >= 0x1E00) && (code <= 0x1EFF)));
}


x86 assembly (clang, -O0):
<xmlUCSIsLatinExtendedAdditional>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x1e00,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1126 <xmlUCSIsLatinExtendedAdditional+0x26>
cmpl   $0x1eff,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmlUCSIsLatinExtendedAdditional>:
and    $0xffffff00,%edi
xor    %eax,%eax
cmp    $0x1e00,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @xmlUCSIsLatinExtendedAdditional(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 7680
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 7935
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @xmlUCSIsLatinExtendedAdditional(i32 %0) {
%2 = and i32 %0, -256
%3 = icmp eq i32 %2, 7680
%4 = zext i1 %3 to i32
ret i32 %4
}