xunge/DecIR huggingface dataset:
/* Variables and functions */
char *getcwd(char *, unsigned long);
char *get_current_working_directory(char *buf, int bufSize) {
  return getcwd(buf, (unsigned long)bufSize);
}


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

x86 assembly (clang, -O2):
<get_current_working_directory>:
movslq %esi,%rsi
jmp    1030 <getcwd@plt>

LLVM IR (-O0):
define i8* @get_current_working_directory(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = call i8* @getcwd(i8* %5, i64 %7)
ret i8* %8
}

LLVM IR (-O2):
define i8* @get_current_working_directory(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = tail call i8* @getcwd(i8* %0, i64 %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void xyz_old(void) { printf("v1 xyz\n"); }


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

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

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

LLVM IR (-O2):
@str = [7 x i8] c"v1 xyz\00"
define void @xyz_old() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
void print_pthread_info() {}


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

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

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

LLVM IR (-O2):
define void @print_pthread_info() {
ret void
}
int tgetflag(id)
char *id;
{
  switch (((((id)[0]) << 8) + (((id)[1]) & 0xff))) {
  case ((('b') << 8) + (('s') & 0xff)):
    return 1;
  case ((('m') << 8) + (('i') & 0xff)):
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<tgetflag>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%eax
shl    $0x8,%eax
movzbl 0x1(%rcx),%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
sub    $0x6273,%eax
je     113e <tgetflag+0x3e>
jmp    112b <tgetflag+0x2b>
mov    -0x14(%rbp),%eax
sub    $0x6d69,%eax
je     114a <tgetflag+0x4a>
jmp    1156 <tgetflag+0x56>
movl   $0x1,-0x4(%rbp)
jmp    115d <tgetflag+0x5d>
movl   $0x1,-0x4(%rbp)
jmp    115d <tgetflag+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tgetflag>:
movsbl (%rdi),%eax
shl    $0x8,%eax
movzbl 0x1(%rdi),%ecx
or     %eax,%ecx
cmp    $0x6273,%ecx
sete   %al
cmp    $0x6d69,%ecx
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @tgetflag(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = shl i32 %7, 8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = and i32 %12, 255
%14 = add nsw i32 %8, %13
switch i32 %14, label %17 [
i32 25203, label %15
i32 28009, label %16
]
15: ; preds = %1
store i32 1, i32* %2
br label %18
16: ; preds = %1
store i32 1, i32* %2
br label %18
17: ; preds = %1
store i32 0, i32* %2
br label %18
18: ; preds = %17, %16, %15
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @tgetflag(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = shl nsw i32 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = or i32 %4, %7
%9 = icmp eq i32 %8, 25203
%10 = icmp eq i32 %8, 28009
%11 = or i1 %9, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char const *);
int /*<<< orphan*/ stderr;
void err_exit(const char *message) {
  fprintf(stderr, message);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<err_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <fprintf@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<err_exit>:
push   %rax
mov    %rdi,%rsi
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
call   1030 <fprintf@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @err_exit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
define void @err_exit(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
void g_list_first() {}


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

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

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

LLVM IR (-O2):
define void @g_list_first() {
ret void
}
int srint(float f) { return (short)(f + 0.5); }


x86 assembly (clang, -O0):
<srint>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<srint>:
cvtss2sd %xmm0,%xmm0
addsd  0xef4(%rip),%xmm0
cvttsd2si %xmm0,%eax
cwtl
ret

LLVM IR (-O0):
define i32 @srint(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fadd double %4, 5.000000e-01
%6 = fptosi double %5 to i16
%7 = sext i16 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @srint(float %0) {
%2 = fpext float %0 to double
%3 = fadd double %2, 5.000000e-01
%4 = fptosi double %3 to i16
%5 = sext i16 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  for (register int i = 0; i < 50; i++)
    printf("%d\t", 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   $0x32,-0x8(%rbp)
jge    114d <main+0x3d>
mov    -0x8(%rbp),%esi
lea    0xec6(%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
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x32,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\09\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 = %9, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 50
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %3
12: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define i32 @main() {
br label %2
1: ; preds = %2
ret i32 0
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %5, %2 ]
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 50
br i1 %6, label %1, label %2
}
/* Variables and functions */
int /*<<< orphan*/ _writegsbase_u64(unsigned long long);
void write_gs_base64(unsigned long long base) { _writegsbase_u64(base); }


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

x86 assembly (clang, -O2):
<write_gs_base64>:
jmp    1030 <_writegsbase_u64@plt>

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

LLVM IR (-O2):
define void @write_gs_base64(i64 %0) {
%2 = tail call i32 @_writegsbase_u64(i64 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ChiHun_bind();
int /*<<< orphan*/ FenShen_bind();
int /*<<< orphan*/ JiaoHouShi_bind();
int /*<<< orphan*/ ShiPo_bind();
int /*<<< orphan*/ WuMing_bind();
int /*<<< orphan*/ YouMingShi_bind();
int /*<<< orphan*/ ZhuiYingShi_bind();
void CB_Ability_init() {
  ChiHun_bind();
  FenShen_bind();
  JiaoHouShi_bind();
  ShiPo_bind();
  WuMing_bind();
  YouMingShi_bind();
  ZhuiYingShi_bind();
}


x86 assembly (clang, -O0):
<CB_Ability_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1090 <ChiHun_bind@plt>
mov    $0x0,%al
call   1030 <FenShen_bind@plt>
mov    $0x0,%al
call   1050 <JiaoHouShi_bind@plt>
mov    $0x0,%al
call   1070 <ShiPo_bind@plt>
mov    $0x0,%al
call   1080 <WuMing_bind@plt>
mov    $0x0,%al
call   1040 <YouMingShi_bind@plt>
mov    $0x0,%al
call   1060 <ZhuiYingShi_bind@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CB_Ability_init>:
push   %rax
xor    %eax,%eax
call   1090 <ChiHun_bind@plt>
xor    %eax,%eax
call   1030 <FenShen_bind@plt>
xor    %eax,%eax
call   1050 <JiaoHouShi_bind@plt>
xor    %eax,%eax
call   1070 <ShiPo_bind@plt>
xor    %eax,%eax
call   1080 <WuMing_bind@plt>
xor    %eax,%eax
call   1040 <YouMingShi_bind@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <ZhuiYingShi_bind@plt>

LLVM IR (-O0):
define void @CB_Ability_init() {
%1 = call i32 (...) @ChiHun_bind()
%2 = call i32 (...) @FenShen_bind()
%3 = call i32 (...) @JiaoHouShi_bind()
%4 = call i32 (...) @ShiPo_bind()
%5 = call i32 (...) @WuMing_bind()
%6 = call i32 (...) @YouMingShi_bind()
%7 = call i32 (...) @ZhuiYingShi_bind()
ret void
}

LLVM IR (-O2):
define void @CB_Ability_init() {
%1 = tail call i32 (...) @ChiHun_bind()
%2 = tail call i32 (...) @FenShen_bind()
%3 = tail call i32 (...) @JiaoHouShi_bind()
%4 = tail call i32 (...) @ShiPo_bind()
%5 = tail call i32 (...) @WuMing_bind()
%6 = tail call i32 (...) @YouMingShi_bind()
%7 = tail call i32 (...) @ZhuiYingShi_bind()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t VbExKeyboardReadWithFlags(uint32_t *flags_ptr) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @VbExKeyboardReadWithFlags(i32* nocapture readnone %0) {
ret i32 0
}
int q(int x, int y) { return x + y; }


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

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

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

LLVM IR (-O2):
define i32 @q(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
void *Malloc(iSize)
int iSize;
{
  void *vpPtr;
  vpPtr = malloc(iSize);
  return (vpPtr);
}


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

x86 assembly (clang, -O2):
<Malloc>:
movslq %edi,%rdi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @Malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = call i8* @malloc(i64 %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @Malloc(i32 %0) {
%2 = sext i32 %0 to i64
%3 = tail call i8* @malloc(i64 %2)
ret i8* %3
}
int f1(int x, int y) {
  if (x == -0x7fffffff)
    __builtin_unreachable();
  return x % -y;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x80000001,-0x4(%rbp)
jne    1117 <f1+0x17>
mov    -0x4(%rbp),%eax
xor    %ecx,%ecx
sub    -0x8(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
mov    %edi,%eax
neg    %esi
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @f1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, -2147483647
br i1 %6, label %7, label %8
7: ; preds = %2
unreachable
8: ; preds = %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = sub nsw i32 0, %10
%12 = srem i32 %9, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @f1(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, -2147483647
tail call void @llvm.assume(i1 %3)
%4 = sub nsw i32 0, %1
%5 = srem i32 %0, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int i;
  for (i = 0; i <= 255; 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   $0xff,-0x8(%rbp)
jg     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 = [7 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 sle i32 %4, 255
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 ([7 x i8], [7 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 = [7 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 ([7 x i8], [7 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
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_bin(int *number) {
  int i = 0;
  for (i = 0; i < 4; i++) {
    printf("%d", number[i]);
  }
}


x86 assembly (clang, -O0):
<print_bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1159 <print_bin+0x49>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <print_bin+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_bin>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%esi
lea    0xee0(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x4(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x8(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0xc(%rbx),%esi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @print_bin(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds i32, i32* %0, i64 3
%11 = load i32, i32* %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
ret void
}
int security_shm_associate(struct shmid_kernel *shp, int shmid, int shmflg) {
  return 0;
}


x86 assembly (clang, -O0):
<security_shm_associate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.shmid_kernel = type opaque
define i32 @security_shm_associate(%struct.shmid_kernel* %0, i32 %1, i32 %2) {
%4 = alloca %struct.shmid_kernel*
%5 = alloca i32
%6 = alloca i32
store %struct.shmid_kernel* %0, %struct.shmid_kernel** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
%struct.shmid_kernel = type opaque
define i32 @security_shm_associate(%struct.shmid_kernel* nocapture readnone %0, i32 %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
int dlna_get_audio_profile_mp3(int channels, int bitrate, char *profile,
                               char *mimeType) {
  strcpy(mimeType, "audio/mpeg");
  strcpy(profile, "MP3");
  return 0;
}


x86 assembly (clang, -O0):
<dlna_get_audio_profile_mp3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xecf(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
lea    0xeca(%rip),%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlna_get_audio_profile_mp3>:
push   %rbx
mov    %rdx,%rbx
lea    0xee5(%rip),%rsi
mov    %rcx,%rdi
call   1030 <strcpy@plt>
lea    0xee1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"audio/mpeg\00"
@.str.1 = [4 x i8] c"MP3\00"
define i32 @dlna_get_audio_profile_mp3(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
unsigned long long int dsum(unsigned long long int n) {
  unsigned long long int s = 0;
  while (n > 0) {
    s += n % 10;
    n /= 10;
  }
  return s;
}


x86 assembly (clang, -O0):
<dsum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jbe    1148 <dsum+0x48>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
add    -0x10(%rbp),%rdx
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x8(%rbp)
jmp    1110 <dsum+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dsum>:
test   %rdi,%rdi
je     1148 <dsum+0x48>
mov    %rdi,%rsi
xor    %ecx,%ecx
movabs $0xcccccccccccccccd,%r8
cc cc cc
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rsi,%rax
mul    %r8
shr    $0x3,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rsi,%rdi
sub    %rax,%rdi
add    %rdi,%rcx
cmp    $0x9,%rsi
mov    %rdx,%rsi
ja     1120 <dsum+0x20>
mov    %rcx,%rax
ret
xor    %ecx,%ecx
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @dsum(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %7, %3 ], [ 0, %1 ]
%5 = phi i64 [ %8, %3 ], [ %0, %1 ]
%6 = urem i64 %5, 10
%7 = add i64 %4, %6
%8 = udiv i64 %5, 10
%9 = icmp ult i64 %5, 10
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i64 [ 0, %1 ], [ %7, %3 ]
ret i64 %11
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
int strlen(char const *);
char *create_string(const char *str) {
  char *out = (char *)malloc(sizeof(char) * strlen(str) + 1);
  sprintf(out, "%s", str);
  return out;
}


x86 assembly (clang, -O0):
<create_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cltq
shl    $0x0,%rax
add    $0x1,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe97(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_string>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i8* @create_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = sext i32 %5 to i64
%7 = mul i64 1, %6
%8 = add i64 %7, 1
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = load i8*, i8** %2
%14 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
define i8* @create_string(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i8* @strcpy(i8* dereferenceable(1) %5, i8* dereferenceable(1) %0)
ret i8* %5
}
/* Variables and functions */
int accept(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int *calloc(int, int);
int /*<<< orphan*/ free(int *);
int *skaccept(int *sd) {
  int *c_sd = calloc(sizeof(int), 1);
  if (c_sd) {
    if ((*c_sd = accept(*sd, NULL, NULL)) < 0) {
      free(c_sd);
      c_sd = NULL;
    }
  }
  return c_sd;
}


x86 assembly (clang, -O0):
<skaccept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1191 <skaccept+0x61>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1050 <accept@plt>
mov    -0x10(%rbp),%rcx
mov    %eax,(%rcx)
cmp    $0x0,%eax
jge    118c <skaccept+0x5c>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x10(%rbp)
jmp    1191 <skaccept+0x61>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skaccept>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
test   %rax,%rax
je     1168 <skaccept+0x38>
mov    %rax,%rbx
mov    (%r14),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <accept@plt>
mov    %eax,(%rbx)
test   %eax,%eax
jns    116a <skaccept+0x3a>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32* @skaccept(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
store i32* %0, i32** %2
%4 = call i32* @calloc(i32 4, i32 1)
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %17
7: ; preds = %1
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
%10 = call i32 @accept(i32 %9, i32* null, i32* null)
%11 = load i32*, i32** %3
store i32 %10, i32* %11
%12 = icmp slt i32 %10, 0
br i1 %12, label %13, label %16
13: ; preds = %7
%14 = load i32*, i32** %3
%15 = call i32 @free(i32* %14)
store i32* null, i32** %3
br label %16
16: ; preds = %13, %7
br label %17
17: ; preds = %16, %1
%18 = load i32*, i32** %3
ret i32* %18
}

LLVM IR (-O2):
define noalias i32* @skaccept(i32* nocapture %0) {
%2 = tail call i32* @calloc(i32 4, i32 1)
%3 = icmp eq i32* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = load i32, i32* %0
%6 = tail call i32 @accept(i32 %5, i32* null, i32* null)
store i32 %6, i32* %2
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @free(i32* %2)
br label %10
10: ; preds = %4, %8, %1
%11 = phi i32* [ null, %8 ], [ %2, %4 ], [ null, %1 ]
ret i32* %11
}
void check_negative_sized_VLA_9() {
  int x = 1;
  int vla[x];
}


x86 assembly (clang, -O0):
<check_negative_sized_VLA_9>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @check_negative_sized_VLA_9() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
store i32 1, i32* %1
%4 = load i32, i32* %1
%5 = zext i32 %4 to i64
%6 = call i8* @llvm.stacksave()
store i8* %6, i8** %2
%7 = alloca i32, i64 %5
store i64 %5, i64* %3
%8 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @check_negative_sized_VLA_9() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: mesg [y|n]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Usage: mesg [y|n]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Usage: mesg [y|n]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint32_t;

/* Variables and functions */
uint32_t read32_le(const uint8_t buf[4]) {
  return (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | (buf[0]);
}


x86 assembly (clang, -O0):
<read32_le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
or     (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read32_le>:
mov    0xc(%rdi),%ecx
shl    $0x18,%ecx
mov    0x4(%rdi),%eax
mov    0x8(%rdi),%edx
shl    $0x10,%edx
or     %ecx,%edx
shl    $0x8,%eax
or     %edx,%eax
or     (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @read32_le(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 3
%5 = load i32, i32* %4
%6 = shl i32 %5, 24
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 2
%9 = load i32, i32* %8
%10 = shl i32 %9, 16
%11 = or i32 %6, %10
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = shl i32 %14, 8
%16 = or i32 %11, %15
%17 = load i32*, i32** %2
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
%20 = or i32 %16, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @read32_le(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = load i32, i32* %2
%4 = shl i32 %3, 24
%5 = getelementptr inbounds i32, i32* %0, i64 2
%6 = load i32, i32* %5
%7 = shl i32 %6, 16
%8 = or i32 %7, %4
%9 = getelementptr inbounds i32, i32* %0, i64 1
%10 = load i32, i32* %9
%11 = shl i32 %10, 8
%12 = or i32 %8, %11
%13 = load i32, i32* %0
%14 = or i32 %12, %13
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *prog_name) {
  fprintf(stderr,
          "Usage: %s [-cat|-info|-cat_info|-md5|-list] [-direct] "
          "DEVICE DIRECTORY\n",
          prog_name);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [72 x i8] c"Usage: %s [-cat|-info|-cat_info|-md5|-list] [-direct] DEVICE DIRECTORY\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [72 x i8] c"Usage: %s [-cat|-info|-cat_info|-md5|-list] [-direct] DEVICE DIRECTORY\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ _sort(void **, int /*<<< orphan*/, size_t,
                         int (*)(void *, void *));
int /*<<< orphan*/ shuffle(void **, size_t);
void quick_sort3w(void **a, size_t n, int (*comp)(void *, void *)) {
  shuffle(a, n);
  _sort(a, 0, n - 1, comp);
}


x86 assembly (clang, -O0):
<quick_sort3w>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <shuffle@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
sub    $0x1,%rdx
mov    -0x18(%rbp),%rcx
xor    %esi,%esi
call   1040 <_sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick_sort3w>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
call   1030 <shuffle@plt>
add    $0xffffffffffffffff,%rbx
mov    %r15,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <_sort@plt>

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

LLVM IR (-O2):
define void @quick_sort3w(i8** %0, i64 %1, i32 (i8*, i8*)* %2) {
%4 = tail call i32 @shuffle(i8** %0, i64 %1)
%5 = add i64 %1, -1
%6 = tail call i32 @_sort(i8** %0, i32 0, i64 %5, i32 (i8*, i8*)* %2)
ret void
}
void RTSocketWriteNB(void) {}


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

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

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

LLVM IR (-O2):
define void @RTSocketWriteNB() {
ret void
}
int parent(int i) { return (i / 2); }


x86 assembly (clang, -O0):
<parent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<parent>:
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
sar    %eax
ret

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

LLVM IR (-O2):
define i32 @parent(i32 %0) {
%2 = sdiv i32 %0, 2
ret i32 %2
}
int test_imm_E6int16_reg(short val) {
  return ((val) & (0xE6 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_E6int16_reg(i16 signext %0) {
%2 = and i16 %0, 230
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void rop3_31_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D | S;
  stk1 = T & stk2;
  stk1 = ~stk1;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


x86 assembly (clang, -O0):
<rop3_31_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
movzbl -0xb(%rbp),%ecx
movzbl -0xa(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
movzbl -0xa(%rbp),%ecx
movzbl -0x9(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl (%rdx),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_31_0_1>:
mov    (%rdi),%al
mov    %eax,%ecx
or     %sil,%cl
and    %dl,%cl
not    %cl
and    %sil,%cl
not    %sil
and    %dl,%sil
not    %dl
and    %al,%sil
or     %dl,%sil
or     %cl,%sil
mov    %sil,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_31_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %4, %1
%6 = and i8 %5, %2
%7 = xor i8 %6, -1
%8 = and i8 %7, %1
%9 = xor i8 %2, -1
%10 = xor i8 %1, -1
%11 = and i8 %10, %2
%12 = and i8 %11, %4
%13 = or i8 %12, %9
%14 = or i8 %13, %8
store i8 %14, i8* %0
ret void
}
int _close_r(struct _reent *reent, int fd) { return 0; }


x86 assembly (clang, -O0):
<_close_r>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct._reent = type opaque
define i32 @_close_r(%struct._reent* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ENOMEM;
int /*<<< orphan*/ errno;
int _execve(char *name, char **argv, char **env) {
  if (name) {
  }
  if (argv) {
  }
  if (env) {
  }
  errno = ENOMEM;
  return -1;
}


x86 assembly (clang, -O0):
<_execve>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1120 <_execve+0x20>
jmp    1120 <_execve+0x20>
cmpq   $0x0,-0x10(%rbp)
je     1130 <_execve+0x30>
jmp    1130 <_execve+0x30>
cmpq   $0x0,-0x18(%rbp)
je     1140 <_execve+0x40>
jmp    1140 <_execve+0x40>
mov    0x2e99(%rip),%rax
mov    (%rax),%ecx
mov    0x2e88(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_execve>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOMEM = global i32 0
@errno = global i32 0
define i32 @_execve(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %3
br label %10
10: ; preds = %9, %3
%11 = load i8**, i8*** %5
%12 = icmp ne i8** %11, null
br i1 %12, label %13, label %14
13: ; preds = %10
br label %14
14: ; preds = %13, %10
%15 = load i8**, i8*** %6
%16 = icmp ne i8** %15, null
br i1 %16, label %17, label %18
17: ; preds = %14
br label %18
18: ; preds = %17, %14
%19 = load i32, i32* @ENOMEM
store i32 %19, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOMEM = global i32 0
@errno = global i32 0
define i32 @_execve(i8* nocapture readnone %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = load i32, i32* @ENOMEM
store i32 %4, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ dma(void *, int const *, unsigned short, int);
void dmaset32(void *dest, const int val, unsigned short len) {
  dma(dest, &val, len,
      ((1 << 25) | (2 << 6) | (1 << 10) | (2 << 11) | (2 << 13) | (1 << 4) |
       (3 << 16)));
}


x86 assembly (clang, -O0):
<dmaset32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dx,%ax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %ax,-0xe(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x2035490,%ecx
movzwl -0xe(%rbp),%edx
call   1030 <dma@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmaset32>:
push   %rax
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x2035490,%ecx
call   1030 <dma@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @dmaset32(i8* %0, i32 %1, i16 zeroext %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i16
store i8* %0, i8** %4
store i32 %1, i32* %5
store i16 %2, i16* %6
%7 = load i8*, i8** %4
%8 = load i16, i16* %6
%9 = call i32 @dma(i8* %7, i32* %5, i16 zeroext %8, i32 33772688)
ret void
}

LLVM IR (-O2):
define void @dmaset32(i8* %0, i32 %1, i16 zeroext %2) {
%4 = alloca i32
store i32 %1, i32* %4
%5 = call i32 @dma(i8* %0, i32* %4, i16 zeroext %2, i32 33772688)
ret void
}
/* Variables and functions */
int pow(int, int);
float moment_of_inertia(int base, int height) {
  return (base * pow(height, 3)) / 12.0;
}


x86 assembly (clang, -O0):
<moment_of_inertia>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x3,%esi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xebb(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moment_of_inertia>:
push   %rbx
mov    %edi,%ebx
mov    %esi,%edi
mov    $0x3,%esi
call   1030 <pow@plt>
imul   %ebx,%eax
cvtsi2sd %eax,%xmm0
divsd  0xed2(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define float @moment_of_inertia(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @pow(i32 %6, i32 3)
%8 = mul nsw i32 %5, %7
%9 = sitofp i32 %8 to double
%10 = fdiv double %9, 1.200000e+01
%11 = fptrunc double %10 to float
ret float %11
}

LLVM IR (-O2):
define float @moment_of_inertia(i32 %0, i32 %1) {
%3 = tail call i32 @pow(i32 %1, i32 3)
%4 = mul nsw i32 %3, %0
%5 = sitofp i32 %4 to double
%6 = fdiv double %5, 1.200000e+01
%7 = fptrunc double %6 to float
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, int, char *, char *, char *);
void append_response(char buf[1024], int rfc, char host[50], char port[50],
                     char title[50]) {
  sprintf(buf, "%s\r\n%d %s %s %s", buf, rfc, title, host, port);
}


x86 assembly (clang, -O0):
<append_response>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%rax
lea    0xeb7(%rip),%rsi
mov    %rax,(%rsp)
call   1030 <sprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<append_response>:
push   %rax
mov    %rdx,%r9
mov    %esi,%eax
mov    %rcx,(%rsp)
lea    0xedf(%rip),%rsi
mov    %rdi,%rdx
mov    %eax,%ecx
call   1030 <sprintf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%s\0D\0A%d %s %s %s\00"
define void @append_response(i8* %0, i32 %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = load i8*, i8** %6
%12 = load i8*, i8** %6
%13 = load i32, i32* %7
%14 = load i8*, i8** %10
%15 = load i8*, i8** %8
%16 = load i8*, i8** %9
%17 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %13, i8* %14, i8* %15, i8* %16)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"%s\0D\0A%d %s %s %s\00"
define void @append_response(i8* %0, i32 %1, i8* %2, i8* %3, i8* %4) {
%6 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %4, i8* %2, i8* %3)
ret void
}
int do_936() { return 936; }


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

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

LLVM IR (-O0):
define i32 @do_936() {
ret i32 936
}

LLVM IR (-O2):
define i32 @do_936() {
ret i32 936
}
/* Variables and functions */
int /*<<< orphan*/ say(int *, int);
int main() {
  int array[3] = {1, 2, 3};
  int number = 5;
  say(array, number);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xedf(%rip),%eax
mov    %eax,-0x4(%rbp)
movl   $0x5,-0x10(%rbp)
lea    -0xc(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <say@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xeee(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xedb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x5,%esi
call   1030 <say@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@__const.main.array = [3 x i32] [i32 1, i32 2, i32 3]
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32 @say(i32* %3, i32 5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ foo(int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/, int, int);
int main() {
  foo(0, 0, 0, 1, 2);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x2,%r8d
mov    %edx,%edi
mov    %edx,%esi
call   1030 <foo@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x2,%r8d
call   1030 <foo@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i32 0, i32 0, i32 0, i32 1, i32 2)
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 0, i32 0, i32 0, i32 1, i32 2)
%2 = tail call i32 @exit(i32 0)
unreachable
}