xunge/DecIR huggingface dataset:
void free_argv(char **argv, int argc) {
  for (int i = 0; i < argc; i++)
    free(argv[i]);
  free(argv);
}


x86 assembly (clang, -O0):
<free_argv>:
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 <free_argv+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <free_argv+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_argv>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <free_argv+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_argv+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_argv(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 = %16, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %19
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
br label %16
16: ; preds = %10
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %6
19: ; preds = %6
%20 = load i8**, i8*** %3
%21 = bitcast i8** %20 to i8*
ret void
}

LLVM IR (-O2):
define void @free_argv(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8, %2
%7 = bitcast i8** %0 to i8*
tail call void @free(i8* %7)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %12, %8 ]
%10 = getelementptr inbounds i8*, i8** %0, i64 %9
%11 = load i8*, i8** %10
tail call void @free(i8* %11)
%12 = add nuw nsw i64 %9, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %8
}
void pack(unsigned char *x, unsigned long u) {
  x[0] = u;
  u >>= 8;
  x[1] = u;
  u >>= 8;
  x[2] = u;
  u >>= 8;
  x[3] = u;
}


x86 assembly (clang, -O0):
<pack>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
shr    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x10(%rbp),%rax
shr    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x10(%rbp),%rax
shr    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @pack(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i8
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
store i8 %6, i8* %8
%9 = load i64, i64* %4
%10 = lshr i64 %9, 8
store i64 %10, i64* %4
%11 = load i64, i64* %4
%12 = trunc i64 %11 to i8
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 1
store i8 %12, i8* %14
%15 = load i64, i64* %4
%16 = lshr i64 %15, 8
store i64 %16, i64* %4
%17 = load i64, i64* %4
%18 = trunc i64 %17 to i8
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 2
store i8 %18, i8* %20
%21 = load i64, i64* %4
%22 = lshr i64 %21, 8
store i64 %22, i64* %4
%23 = load i64, i64* %4
%24 = trunc i64 %23 to i8
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 3
store i8 %24, i8* %26
ret void
}

LLVM IR (-O2):
define void @pack(i8* nocapture writeonly %0, i64 %1) {
%3 = trunc i64 %1 to i8
store i8 %3, i8* %0
%4 = lshr i64 %1, 8
%5 = trunc i64 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = lshr i64 %1, 16
%8 = trunc i64 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
%10 = lshr i64 %1, 24
%11 = trunc i64 %10 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
ret void
}
/* Type definitions */
struct sudirription {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct sudirription *);
void destroy_sudirription(struct sudirription *s) { free(s); }


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

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

LLVM IR (-O0):
%struct.sudirription = type { i32 }
define void @destroy_sudirription(%struct.sudirription* %0) {
%2 = alloca %struct.sudirription*
store %struct.sudirription* %0, %struct.sudirription** %2
%3 = load %struct.sudirription*, %struct.sudirription** %2
%4 = call i32 @free(%struct.sudirription* %3)
ret void
}

LLVM IR (-O2):
%struct.sudirription = type { i32 }
define void @destroy_sudirription(%struct.sudirription* nocapture %0) {
%2 = tail call i32 @free(%struct.sudirription* %0)
ret void
}
const char *SkipUntilChar(const char *pSrc, const char nDelim) {
  while (pSrc && (*pSrc)) {
    if (*pSrc == nDelim)
      break;
    pSrc++;
  }
  return pSrc;
}


x86 assembly (clang, -O0):
<SkipUntilChar>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0xa(%rbp)
je     112e <SkipUntilChar+0x2e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    113e <SkipUntilChar+0x3e>
jmp    1167 <SkipUntilChar+0x67>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1156 <SkipUntilChar+0x56>
jmp    1167 <SkipUntilChar+0x67>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110e <SkipUntilChar+0xe>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SkipUntilChar>:
test   %rdi,%rdi
je     1122 <SkipUntilChar+0x22>
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopl   0x0(%rax)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     1121 <SkipUntilChar+0x21>
cmp    %sil,%cl
jne    1110 <SkipUntilChar+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @SkipUntilChar(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
br label %5
5: ; preds = %23, %2
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br label %13
13: ; preds = %8, %5
%14 = phi i1 [ false, %5 ], [ %12, %8 ]
br i1 %14, label %15, label %26
15: ; preds = %13
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = load i8, i8* %4
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %18, %20
br i1 %21, label %22, label %23
22: ; preds = %15
br label %26
23: ; preds = %15
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %3
br label %5
26: ; preds = %22, %13
%27 = load i8*, i8** %3
ret i8* %27
}

LLVM IR (-O2):
define i8* @SkipUntilChar(i8* %0, i8 signext %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i8* [ %10, %4 ], [ %0, %2 ]
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = icmp eq i8 %6, %1
%9 = or i1 %7, %8
%10 = getelementptr inbounds i8, i8* %5, i64 1
br i1 %9, label %11, label %4
11: ; preds = %4, %2
%12 = phi i8* [ null, %2 ], [ %5, %4 ]
ret i8* %12
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
struct sr_strbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ sr_strbuf_append_str(struct sr_strbuf *, char *);
char *sr_vasprintf(char const *, int /*<<< orphan*/);
struct sr_strbuf *sr_strbuf_append_strfv(struct sr_strbuf *strbuf,
                                         const char *format, va_list p) {
  char *string_ptr = sr_vasprintf(format, p);
  sr_strbuf_append_str(strbuf, string_ptr);
  free(string_ptr);
  return strbuf;
}


x86 assembly (clang, -O0):
<sr_strbuf_append_strfv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <sr_vasprintf@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <sr_strbuf_append_str@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sr_strbuf_append_strfv>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %edx,%esi
call   1050 <sr_vasprintf@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <sr_strbuf_append_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sr_strbuf = type { i32 }
define %struct.sr_strbuf* @sr_strbuf_append_strfv(%struct.sr_strbuf* %0, i8* %1, i32 %2) {
%4 = alloca %struct.sr_strbuf*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store %struct.sr_strbuf* %0, %struct.sr_strbuf** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i8* @sr_vasprintf(i8* %8, i32 %9)
store i8* %10, i8** %7
%11 = load %struct.sr_strbuf*, %struct.sr_strbuf** %4
%12 = load i8*, i8** %7
%13 = call i32 @sr_strbuf_append_str(%struct.sr_strbuf* %11, i8* %12)
%14 = load i8*, i8** %7
%15 = call i32 @free(i8* %14)
%16 = load %struct.sr_strbuf*, %struct.sr_strbuf** %4
ret %struct.sr_strbuf* %16
}

LLVM IR (-O2):
%struct.sr_strbuf = type { i32 }
define %struct.sr_strbuf* @sr_strbuf_append_strfv(%struct.sr_strbuf* returned %0, i8* %1, i32 %2) {
%4 = tail call i8* @sr_vasprintf(i8* %1, i32 %2)
%5 = tail call i32 @sr_strbuf_append_str(%struct.sr_strbuf* %0, i8* %4)
%6 = tail call i32 @free(i8* %4)
ret %struct.sr_strbuf* %0
}
/* Variables and functions */
scalar_t__ pow(int, int);
int sqrt(scalar_t__);
double get_answer_plus(int a, int b, int c) {
  return (-b + sqrt(pow(b, 2) - 4 * a * c)) / 2 * a;
}


x86 assembly (clang, -O0):
<get_answer_plus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %rax,%rdi
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
imul   -0xc(%rbp),%eax
cltq
sub    %rax,%rdi
call   1040 <sqrt@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
imul   -0x4(%rbp),%eax
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_answer_plus>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
mov    %esi,%edi
mov    $0x2,%esi
call   1030 <pow@plt>
imul   %r14d,%ebx
shl    $0x2,%ebx
movslq %ebx,%rcx
sub    %rcx,%rax
mov    %rax,%rdi
call   1040 <sqrt@plt>
sub    %ebp,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
imul   %r14d,%ecx
cvtsi2sd %ecx,%xmm0
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @get_answer_plus(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = sub nsw i32 0, %7
%9 = load i32, i32* %5
%10 = call i64 @pow(i32 %9, i32 2)
%11 = load i32, i32* %4
%12 = mul nsw i32 4, %11
%13 = load i32, i32* %6
%14 = mul nsw i32 %12, %13
%15 = sext i32 %14 to i64
%16 = sub nsw i64 %10, %15
%17 = call i32 @sqrt(i64 %16)
%18 = add nsw i32 %8, %17
%19 = sdiv i32 %18, 2
%20 = load i32, i32* %4
%21 = mul nsw i32 %19, %20
%22 = sitofp i32 %21 to double
ret double %22
}

LLVM IR (-O2):
define double @get_answer_plus(i32 %0, i32 %1, i32 %2) {
%4 = tail call i64 @pow(i32 %1, i32 2)
%5 = shl nsw i32 %0, 2
%6 = mul nsw i32 %5, %2
%7 = sext i32 %6 to i64
%8 = sub nsw i64 %4, %7
%9 = tail call i32 @sqrt(i64 %8)
%10 = sub i32 %9, %1
%11 = sdiv i32 %10, 2
%12 = mul nsw i32 %11, %0
%13 = sitofp i32 %12 to double
ret double %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/, int, int);
void print_version() { printf("Cryptcoffee - Skul %d.%d.%d\n", 0, 2, 4); }


x86 assembly (clang, -O0):
<print_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x4,%ecx
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_version>:
lea    0xee9(%rip),%rdi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x4,%ecx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [29 x i8] c"Cryptcoffee - Skul %d.%d.%d\0A\00"
define void @print_version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 0, i32 2, i32 4)
ret void
}
int Problem011(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @Problem011() {
ret i32 1
}

LLVM IR (-O2):
define i32 @Problem011() {
ret i32 1
}
/* Variables and functions */
char *leela_strndup(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
char *leela_strdup(const char *s) { return (leela_strndup(s, strlen(s))); }


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

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

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

LLVM IR (-O2):
define i8* @leela_strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i8* @leela_strndup(i8* %0, i32 %2)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ a();
int /*<<< orphan*/ r();
void good_paired2(void) {
  a();
  r();
  a();
  r();
}


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

x86 assembly (clang, -O2):
<good_paired2>:
push   %rax
xor    %eax,%eax
call   1040 <a@plt>
xor    %eax,%eax
call   1030 <r@plt>
xor    %eax,%eax
call   1040 <a@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <r@plt>

LLVM IR (-O0):
define void @good_paired2() {
%1 = call i32 (...) @a()
%2 = call i32 (...) @r()
%3 = call i32 (...) @a()
%4 = call i32 (...) @r()
ret void
}

LLVM IR (-O2):
define void @good_paired2() {
%1 = tail call i32 (...) @a()
%2 = tail call i32 (...) @r()
%3 = tail call i32 (...) @a()
%4 = tail call i32 (...) @r()
ret void
}
/* Variables and functions */
int errno;
scalar_t__ setxattr(char const *, char const *, char const *, size_t,
                    int /*<<< orphan*/);
size_t strlen(char const *);
int xsets(const char *epath, const char *xname, const char *s) {
  size_t s_len;
  s_len = strlen(s);
  if (setxattr(epath, xname, s, s_len, 0) < 0)
    return -errno;
  return 0;
}


x86 assembly (clang, -O0):
<xsets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
xor    %r8d,%r8d
call   1040 <setxattr@plt>
cmp    $0x0,%rax
jge    1176 <xsets+0x56>
xor    %eax,%eax
mov    0x2e74(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    117d <xsets+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xsets>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
call   1030 <strlen@plt>
xor    %ebp,%ebp
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %r8d,%r8d
call   1040 <setxattr@plt>
mov    0x2e8b(%rip),%rcx
sub    (%rcx),%ebp
sar    $0x3f,%rax
and    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@errno = global i32 0
define i32 @xsets(i8* %0, i8* %1, i8* %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%5 = tail call i64 @setxattr(i8* %0, i8* %1, i8* %2, i64 %4, i32 0)
%6 = icmp slt i64 %5, 0
%7 = load i32, i32* @errno
%8 = sub nsw i32 0, %7
%9 = select i1 %6, i32 %8, i32 0
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ gdtCreate(int /*<<< orphan*/, int, int);
void gdtInstall() {
  extern void gdtCommit();
  gdtCreate(0, 0x00000000, 0);
  gdtCreate(0, 0xFFFFFFFF,
            ((1 << 7) | (1 << 3) | (0 << 5) | (0 << 1) | (1 << 10) | (1 << 11) |
             (1 << 4)));
  gdtCreate(0, 0xFFFFFFFF,
            ((1 << 7) | (0 << 3) | (0 << 5) | (1 << 1) | (1 << 10) | (1 << 11) |
             (1 << 4)));
  gdtCreate(0, 0xFFFFFFFF,
            ((1 << 7) | (1 << 3) | (3 << 5) | (0 << 1) | (1 << 10) | (1 << 11) |
             (1 << 4)));
  gdtCreate(0, 0xFFFFFFFF,
            ((1 << 7) | (0 << 3) | (3 << 5) | (1 << 1) | (1 << 10) | (1 << 11) |
             (1 << 4)));
  gdtCommit();
}


x86 assembly (clang, -O0):
<gdtInstall>:
push   %rbp
mov    %rsp,%rbp
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1040 <gdtCreate@plt>
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    $0xc98,%edx
call   1040 <gdtCreate@plt>
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    $0xc92,%edx
call   1040 <gdtCreate@plt>
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    $0xcf8,%edx
call   1040 <gdtCreate@plt>
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    $0xcf2,%edx
call   1040 <gdtCreate@plt>
mov    $0x0,%al
call   1030 <gdtCommit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdtInstall>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <gdtCreate@plt>
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    $0xc98,%edx
call   1040 <gdtCreate@plt>
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    $0xc92,%edx
call   1040 <gdtCreate@plt>
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    $0xcf8,%edx
call   1040 <gdtCreate@plt>
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    $0xcf2,%edx
call   1040 <gdtCreate@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <gdtCommit@plt>

LLVM IR (-O0):
define void @gdtInstall() {
%1 = call i32 @gdtCreate(i32 0, i32 0, i32 0)
%2 = call i32 @gdtCreate(i32 0, i32 -1, i32 3224)
%3 = call i32 @gdtCreate(i32 0, i32 -1, i32 3218)
%4 = call i32 @gdtCreate(i32 0, i32 -1, i32 3320)
%5 = call i32 @gdtCreate(i32 0, i32 -1, i32 3314)
ret void
}

LLVM IR (-O2):
define void @gdtInstall() {
%1 = tail call i32 @gdtCreate(i32 0, i32 0, i32 0)
%2 = tail call i32 @gdtCreate(i32 0, i32 -1, i32 3224)
%3 = tail call i32 @gdtCreate(i32 0, i32 -1, i32 3218)
%4 = tail call i32 @gdtCreate(i32 0, i32 -1, i32 3320)
%5 = tail call i32 @gdtCreate(i32 0, i32 -1, i32 3314)
tail call void (...) @gdtCommit()
ret void
}
setlinestyle_(n) int *n;
{ setlinestyle(*n); }


x86 assembly (clang, -O0):
<setlinestyle_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    $0x0,%al
call   1030 <setlinestyle@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setlinestyle_>:
mov    (%rdi),%edi
xor    %eax,%eax
jmp    1030 <setlinestyle@plt>

LLVM IR (-O0):
define i32 @setlinestyle_(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
%6 = call i32 (i32, ...) bitcast (i32 (...)* @setlinestyle to i32 (i32, ...)*)(i32 %5)
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
define i32 @setlinestyle_(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @setlinestyle to i32 (i32, ...)*)(i32 %2)
ret i32 undef
}
/* Variables and functions */
scalar_t__ isspace(char const);
const char *skip(const char *buffer) {
  while (isspace(*buffer))
    buffer++;
  return buffer;
}


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

x86 assembly (clang, -O2):
<skip>:
push   %rbx
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1120 <skip+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @skip(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @isspace(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i8* %3
}
int test_imm_2Fuint32_mem(unsigned int *val) {
  return ((*val) & (0x2F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_2Fuint32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 47
%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_2Fuint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 47
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char strlen(char *);
int /*<<< orphan*/ writebyte(char, int /*<<< orphan*/ *);
void writestring(char *mystring, FILE *fp) {
  char p;
  for (p = 0; p < strlen(mystring); p++) {
    writebyte(mystring[p], fp);
  }
}


x86 assembly (clang, -O0):
<writestring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %al,%cl
mov    -0x18(%rbp),%eax
movsbl %cl,%ecx
cmp    %ecx,%eax
jge    1179 <writestring+0x59>
mov    -0x8(%rbp),%rax
movsbq -0x11(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1040 <writebyte@plt>
mov    -0x11(%rbp),%al
add    $0x1,%al
mov    %al,-0x11(%rbp)
jmp    1134 <writestring+0x14>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writestring>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
test   %al,%al
jle    1162 <writestring+0x42>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%edi
mov    %r14,%rsi
call   1040 <writebyte@plt>
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
movsbq %al,%rax
cmp    %rax,%rbx
jl     1140 <writestring+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @writestring(i8* %0, i32* %1) {
%3 = tail call signext i8 @strlen(i8* %0)
%4 = icmp sgt i8 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %2, %5
%6 = phi i64 [ %10, %5 ], [ 0, %2 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = tail call i32 @writebyte(i8 signext %8, i32* %1)
%10 = add nuw nsw i64 %6, 1
%11 = tail call signext i8 @strlen(i8* %0)
%12 = sext i8 %11 to i64
%13 = icmp slt i64 %10, %12
br i1 %13, label %5, label %14
14: ; preds = %5, %2
ret void
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
char getchar();
char out(int16_t arg) {
  if (arg == 0x0) {
    return getchar();
  }
  return 0;
}


x86 assembly (clang, -O0):
<out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1134 <out+0x24>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
jmp    1138 <out+0x28>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<out>:
xor    %eax,%eax
test   %edi,%edi
je     1117 <out+0x7>
ret
jmp    1030 <getchar@plt>

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

LLVM IR (-O2):
define signext i8 @out(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call signext i8 (...) @getchar()
br label %5
5: ; preds = %1, %3
%6 = phi i8 [ %4, %3 ], [ 0, %1 ]
ret i8 %6
}
void init_pyframe3dd() {}


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

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

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

LLVM IR (-O2):
define void @init_pyframe3dd() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *);
char *badblockstxt(char *cmdresult) {
  sprintf(cmdresult, "touch /tmp/badblockinfo.txt 1>/dev/null 2>/dev/null");
  return cmdresult;
}


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

x86 assembly (clang, -O2):
<badblockstxt>:
mov    %rdi,%rax
movups 0xf16(%rip),%xmm0
movups %xmm0,0x20(%rdi)
movups 0xefb(%rip),%xmm0
movups %xmm0,0x10(%rdi)
movups 0xee0(%rip),%xmm0
movups %xmm0,(%rdi)
movl   $0x6c6c75,0x30(%rdi)
ret

LLVM IR (-O0):
@.str = [52 x i8] c"touch /tmp/badblockinfo.txt 1>/dev/null 2>/dev/null\00"
define i8* @badblockstxt(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
@.str = [52 x i8] c"touch /tmp/badblockinfo.txt 1>/dev/null 2>/dev/null\00"
define i8* @badblockstxt(i8* returned writeonly %0) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(52) %0, i8* align 1 dereferenceable(52) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i64 52, i1 false)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ handle_error(char *);
scalar_t__ shm_unlink(char *);
void handle_sigint(int signum) {
  if (shm_unlink("/shm_name") < 0) {
    handle_error("Error calling shm_unlink\n");
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<handle_sigint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1040 <shm_unlink@plt>
cmp    $0x0,%rax
jge    115d <handle_sigint+0x2d>
lea    0xeb2(%rip),%rdi
call   1050 <handle_error@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<handle_sigint>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <shm_unlink@plt>
test   %rax,%rax
jns    114e <handle_sigint+0x1e>
lea    0xec1(%rip),%rdi
call   1050 <handle_error@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"/shm_name\00"
@.str.1 = [26 x i8] c"Error calling shm_unlink\0A\00"
@EXIT_SUCCESS = global i32 0
define void @handle_sigint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 @shm_unlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @handle_error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = load i32, i32* @EXIT_SUCCESS
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@.str = [10 x i8] c"/shm_name\00"
@.str.1 = [26 x i8] c"Error calling shm_unlink\0A\00"
@EXIT_SUCCESS = global i32 0
define void @handle_sigint(i32 %0) {
%2 = tail call i64 @shm_unlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @handle_error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = load i32, i32* @EXIT_SUCCESS
%8 = tail call i32 @exit(i32 %7)
unreachable
}
double calc_percent64(unsigned long long amt, unsigned long long total) {
  if (total <= 0)
    return 0.0;
  return (amt / total) * 100.0;
}


x86 assembly (clang, -O0):
<calc_percent64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
ja     1124 <calc_percent64+0x24>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1169 <calc_percent64+0x69>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
xor    %edx,%edx
div    %rcx
movq   %rax,%xmm0
movaps 0xed3(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xed7(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xea0(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_percent64>:
test   %rsi,%rsi
je     111b <calc_percent64+0x1b>
mov    %rdi,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     111f <calc_percent64+0x1f>
mov    %rdi,%rax
xor    %edx,%edx
div    %rsi
jmp    1125 <calc_percent64+0x25>
xorps  %xmm0,%xmm0
ret
mov    %edi,%eax
xor    %edx,%edx
div    %esi
movq   %rax,%xmm1
punpckldq 0xece(%rip),%xmm1
subpd  0xed6(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xed2(%rip),%xmm0
ret

LLVM IR (-O0):
define double @calc_percent64(i64 %0, i64 %1) {
%3 = alloca double
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %5
%7 = icmp ule i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store double 0.000000e+00, double* %3
br label %15
9: ; preds = %2
%10 = load i64, i64* %4
%11 = load i64, i64* %5
%12 = udiv i64 %10, %11
%13 = uitofp i64 %12 to double
%14 = fmul double %13, 1.000000e+02
store double %14, double* %3
br label %15
15: ; preds = %9, %8
%16 = load double, double* %3
ret double %16
}

LLVM IR (-O2):
define double @calc_percent64(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = udiv i64 %0, %1
%6 = uitofp i64 %5 to double
%7 = fmul double %6, 1.000000e+02
br label %8
8: ; preds = %2, %4
%9 = phi double [ %7, %4 ], [ 0.000000e+00, %2 ]
ret double %9
}
/* Variables and functions */
int ceil(int);
char *malloc(size_t);
int /*<<< orphan*/ sprintf(char *, char *, int);
char *int_to_str(int i) {
  char *i_s = malloc((size_t)(sizeof(char) * ceil(i % 10)));
  sprintf(i_s, "%d", i);
  return i_s;
}


x86 assembly (clang, -O0):
<int_to_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1030 <ceil@plt>
movslq %eax,%rdi
shl    $0x0,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe95(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_to_str>:
push   %r14
push   %rbx
push   %rax
movslq %edi,%r14
imul   $0x66666667,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
mov    %r14d,%edi
sub    %eax,%edi
call   1030 <ceil@plt>
movslq %eax,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xe94(%rip),%rsi
mov    %rax,%rdi
mov    %r14d,%edx
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define noalias i8* @int_to_str(i32 %0) {
%2 = srem i32 %0, 10
%3 = tail call i32 @ceil(i32 %2)
%4 = sext i32 %3 to i64
%5 = tail call i8* @malloc(i64 %4)
%6 = tail call i32 @sprintf(i8* dereferenceable(1) %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i8* %5
}
/* Variables and functions */
int abs(int);
int errno;
int errno_or_else(int fallback) {
  if (errno > 0)
    return -errno;
  return -abs(fallback);
}


x86 assembly (clang, -O0):
<errno_or_else>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    0x2ebe(%rip),%rax
cmpl   $0x0,(%rax)
jle    113e <errno_or_else+0x2e>
xor    %eax,%eax
mov    0x2eac(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    114f <errno_or_else+0x3f>
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errno_or_else>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%ecx
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
test   %ecx,%ecx
cmovg  %ecx,%eax
neg    %eax
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @errno_or_else(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* @errno
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @errno
%8 = sub nsw i32 0, %7
store i32 %8, i32* %2
br label %13
9: ; preds = %1
%10 = load i32, i32* %3
%11 = call i32 @abs(i32 %10)
%12 = sub nsw i32 0, %11
store i32 %12, i32* %2
br label %13
13: ; preds = %9, %6
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @errno_or_else(i32 %0) {
%2 = load i32, i32* @errno
%3 = icmp sgt i32 %2, 0
%4 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%5 = select i1 %3, i32 %2, i32 %4
%6 = sub nsw i32 0, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ dns_packet_copy(char *, unsigned int, int /*<<< orphan*/,
                                   char *, int);
int serverwantstcp(char *buf, unsigned int len) {
  char out[12];
  if (!dns_packet_copy(buf, len, 0, out, 12))
    return 1;
  if (out[2] & 2)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<serverwantstcp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0x20(%rbp),%rcx
xor    %edx,%edx
mov    $0xc,%r8d
call   1030 <dns_packet_copy@plt>
cmp    $0x0,%eax
jne    114c <serverwantstcp+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    116f <serverwantstcp+0x5f>
movsbl -0x1e(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1168 <serverwantstcp+0x58>
movl   $0x1,-0x4(%rbp)
jmp    116f <serverwantstcp+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serverwantstcp>:
sub    $0x18,%rsp
lea    0xc(%rsp),%rcx
xor    %edx,%edx
mov    $0xc,%r8d
call   1030 <dns_packet_copy@plt>
movzbl 0xe(%rsp),%ecx
shr    %ecx
and    $0x1,%ecx
test   %eax,%eax
mov    $0x1,%eax
cmovne %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @serverwantstcp(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [12 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%10 = call i32 @dns_packet_copy(i8* %7, i32 %8, i32 0, i8* %9, i32 12)
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %2
store i32 1, i32* %3
br label %21
13: ; preds = %2
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = and i32 %16, 2
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 1, i32* %3
br label %21
20: ; preds = %13
store i32 0, i32* %3
br label %21
21: ; preds = %20, %19, %12
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @serverwantstcp(i8* %0, i32 %1) {
%3 = alloca [12 x i8]
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%5 = call i32 @dns_packet_copy(i8* %0, i32 %1, i32 0, i8* %4, i32 12)
%6 = icmp eq i32 %5, 0
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 2
%8 = load i8, i8* %7
%9 = lshr i8 %8, 1
%10 = and i8 %9, 1
%11 = zext i8 %10 to i32
%12 = select i1 %6, i32 1, i32 %11
ret i32 %12
}
int sys$numtim(unsigned short int timbuf[7], unsigned long long *timadr) {
  return ({
    unsigned long resultvar;
    register long int _a2 asm("rsi") = (long)(timadr);
    register long int _a1 asm("rdi") = (long)(timbuf);
    asm volatile("movq %1, %%rax\n\t"
                 "int $0x81\n\t"
                 : "=a"(resultvar)
                 : "i"(13), "r"(_a1), "r"(_a2)
                 : "memory", "cc", "r11", "cx");
    (long)resultvar;
  });
}


x86 assembly (clang, -O0):
<sys$numtim>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0xd,%rax
int    $0x81
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys$numtim>:
mov    $0xd,%rax
int    $0x81
ret

LLVM IR (-O0):
define i32 @"sys$numtim"(i16* %0, i64* %1) {
%3 = alloca i16*
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i16* %0, i16** %3
store i64* %1, i64** %4
%9 = load i64*, i64** %4
%10 = ptrtoint i64* %9 to i64
store i64 %10, i64* %6
%11 = load i16*, i16** %3
%12 = ptrtoint i16* %11 to i64
store i64 %12, i64* %7
%13 = load i64, i64* %7
%14 = load i64, i64* %6
%15 = call i64 asm sideeffect "movq $1, %rax\0A\09int $$0x81\0A\09", "={ax},i,{rdi},{rsi},~{memory},~{cc},~{r11},~{cx},~{dirflag},~{fpsr},~{flags}"(i32 13, i64 %13, i64 %14)
store i64 %15, i64* %5
%16 = load i64, i64* %5
store i64 %16, i64* %8
%17 = load i64, i64* %8
%18 = trunc i64 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @"sys$numtim"(i16* %0, i64* %1) {
%3 = ptrtoint i64* %1 to i64
%4 = ptrtoint i16* %0 to i64
%5 = tail call i64 asm sideeffect "movq $1, %rax\0A\09int $$0x81\0A\09", "={ax},i,{rdi},{rsi},~{memory},~{cc},~{r11},~{cx},~{dirflag},~{fpsr},~{flags}"(i32 13, i64 %4, i64 %3)
%6 = trunc i64 %5 to i32
ret i32 %6
}
void RTS3DeleteBucket(void) {}


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

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

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

LLVM IR (-O2):
define void @RTS3DeleteBucket() {
ret void
}
/* Variables and functions */
size_t lh_pos(unsigned long int hash, size_t table_size) {
  return hash % table_size;
}


x86 assembly (clang, -O0):
<lh_pos>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rdx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lh_pos>:
mov    %rdi,%rax
mov    %rdi,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1118 <lh_pos+0x18>
xor    %edx,%edx
div    %rsi
mov    %rdx,%rax
ret
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i64 @lh_pos(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = urem i64 %5, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @lh_pos(i64 %0, i64 %1) {
%3 = urem i64 %0, %1
ret i64 %3
}
int strCmp(const char *s1, const char *s2) {
  while (*s1 && (*s1 == *s2)) {
    s1++;
    s2++;
  }
  return *(const unsigned char *)s1 - *(const unsigned char *)s2;
}


x86 assembly (clang, -O0):
<strCmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1137 <strCmp+0x37>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1147 <strCmp+0x47>
jmp    1164 <strCmp+0x64>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <strCmp+0xc>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strCmp>:
mov    (%rdi),%al
test   %al,%al
je     1123 <strCmp+0x23>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
cmp    (%rsi),%al
jne    1125 <strCmp+0x25>
add    $0x1,%rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <strCmp+0x10>
xor    %eax,%eax
movzbl %al,%eax
movzbl (%rsi),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @strCmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %20, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %13, %16
br label %18
18: ; preds = %10, %5
%19 = phi i1 [ false, %5 ], [ %17, %10 ]
br i1 %19, label %20, label %25
20: ; preds = %18
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %3
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %4
br label %5
25: ; preds = %18
%26 = load i8*, i8** %3
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = load i8*, i8** %4
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = sub nsw i32 %28, %31
ret i32 %32
}

LLVM IR (-O2):
define i32 @strCmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %11
%6 = phi i8 [ %14, %11 ], [ %3, %2 ]
%7 = phi i8* [ %13, %11 ], [ %1, %2 ]
%8 = phi i8* [ %12, %11 ], [ %0, %2 ]
%9 = load i8, i8* %7
%10 = icmp eq i8 %6, %9
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %12
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %11, %2
%17 = phi i8* [ %1, %2 ], [ %13, %11 ], [ %7, %5 ]
%18 = phi i8 [ 0, %2 ], [ 0, %11 ], [ %6, %5 ]
%19 = zext i8 %18 to i32
%20 = load i8, i8* %17
%21 = zext i8 %20 to i32
%22 = sub nsw i32 %19, %21
ret i32 %22
}
/* Variables and functions */
int f();
int /*<<< orphan*/ printf(char *, int, int (*)());
int main(void) {
  printf("%d %p\n", f(), f);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <f@plt>
mov    0x2ec1(%rip),%rdx
lea    0xeda(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d %p\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1, i32 (...)* @f)
ret i32 0
}
/* Variables and functions */
int ip_compare(const void *ip1, const size_t l1, const void *ip2,
               const size_t l2) {
  return ip1 == ip2;
}


x86 assembly (clang, -O0):
<ip_compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ip_compare>:
xor    %eax,%eax
cmp    %rdx,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @ip_compare(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %7
%11 = icmp eq i8* %9, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @ip_compare(i8* readnone %0, i64 %1, i8* readnone %2, i64 %3) {
%5 = icmp eq i8* %0, %2
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int dlink_size();
int size() { return dlink_size(); }


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

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

LLVM IR (-O0):
define i32 @size() {
%1 = call i32 (...) @dlink_size()
ret i32 %1
}

LLVM IR (-O2):
define i32 @size() {
%1 = tail call i32 (...) @dlink_size()
ret i32 %1
}