xunge/DecIR huggingface dataset:
void testClosureDrV(void (*closure)(double), double a1) { (*closure)(a1); }


x86 assembly (clang, -O0):
<testClosureDrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureDrV>:
jmp    *%rdi

LLVM IR (-O0):
define void @testClosureDrV(void (double)* %0, double %1) {
%3 = alloca void (double)*
%4 = alloca double
store void (double)* %0, void (double)** %3
store double %1, double* %4
%5 = load void (double)*, void (double)** %3
%6 = load double, double* %4
ret void
}

LLVM IR (-O2):
define void @testClosureDrV(void (double)* nocapture %0, double %1) {
tail call void %0(double %1)
ret void
}
double mkPosInf(void) { return 1.0 / 0.0; }


x86 assembly (clang, -O0):
<mkPosInf>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkPosInf>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @mkPosInf() {
ret double 0x7FF0000000000000
}

LLVM IR (-O2):
define double @mkPosInf() {
ret double 0x7FF0000000000000
}
void gtk_scrolled_window_get_placement() {}


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

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

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

LLVM IR (-O2):
define void @gtk_scrolled_window_get_placement() {
ret void
}
/* Variables and functions */
int strcmp(void const *, void const *);
int strcmp_void(const void *s1, const void *s2) { return strcmp(s1, s2); }


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

x86 assembly (clang, -O2):
<strcmp_void>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @strcmp_void(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ KVM_HC_MIPS_CONSOLE_OUTPUT;
int /*<<< orphan*/ kvm_hypercall3(int /*<<< orphan*/, int /*<<< orphan*/,
                                  unsigned long, int);
void prom_putchar(char c) {
  kvm_hypercall3(KVM_HC_MIPS_CONSOLE_OUTPUT, 0, (unsigned long)&c, 1);
}


x86 assembly (clang, -O0):
<prom_putchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    0x2ec3(%rip),%rax
mov    (%rax),%edi
lea    -0x1(%rbp),%rdx
xor    %esi,%esi
mov    $0x1,%ecx
call   1030 <kvm_hypercall3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prom_putchar>:
push   %rax
mov    %dil,0x7(%rsp)
mov    0x2ecb(%rip),%rax
mov    (%rax),%edi
lea    0x7(%rsp),%rdx
xor    %esi,%esi
mov    $0x1,%ecx
call   1030 <kvm_hypercall3@plt>
pop    %rax
ret

LLVM IR (-O0):
@KVM_HC_MIPS_CONSOLE_OUTPUT = global i32 0
define void @prom_putchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i32, i32* @KVM_HC_MIPS_CONSOLE_OUTPUT
%4 = ptrtoint i8* %2 to i64
%5 = call i32 @kvm_hypercall3(i32 %3, i32 0, i64 %4, i32 1)
ret void
}

LLVM IR (-O2):
@KVM_HC_MIPS_CONSOLE_OUTPUT = global i32 0
define void @prom_putchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i32, i32* @KVM_HC_MIPS_CONSOLE_OUTPUT
%4 = ptrtoint i8* %2 to i64
%5 = call i32 @kvm_hypercall3(i32 %3, i32 0, i64 %4, i32 1)
ret void
}
/* Variables and functions */
int *my_malloc3(int);
void naf1() {
  int *p = my_malloc3(12);
  return;
}


x86 assembly (clang, -O0):
<naf1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc,%edi
call   1030 <my_malloc3@plt>
mov    %rax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<naf1>:
mov    $0xc,%edi
jmp    1030 <my_malloc3@plt>

LLVM IR (-O0):
define void @naf1() {
%1 = alloca i32*
%2 = call i32* @my_malloc3(i32 12)
store i32* %2, i32** %1
ret void
}

LLVM IR (-O2):
define void @naf1() {
%1 = tail call i32* @my_malloc3(i32 12)
ret void
}
/* Variables and functions */
int strcspn(char const *, char *);
int /*<<< orphan*/ strspn(char const *, char *);
char *next_field(const char *line) {
  const char *rest;
  rest = line + strcspn(line, " ");
  rest += strspn(rest, " ");
  return (char *)rest;
}


x86 assembly (clang, -O0):
<next_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1040 <strcspn@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1030 <strspn@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_field>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xed1(%rip),%r14
mov    %r14,%rsi
call   1040 <strcspn@plt>
movslq %eax,%rbx
add    %r15,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strspn@plt>
cltq
add    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define i8* @next_field(i8* %0) {
%2 = tail call i32 @strcspn(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = tail call i32 @strspn(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
ret i8* %7
}
int isAlpha(char c) {
  return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
}


x86 assembly (clang, -O0):
<isAlpha>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1129 <isAlpha+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7a,%ecx
mov    %al,-0x2(%rbp)
jle    114e <isAlpha+0x4e>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x3(%rbp)
jl     1148 <isAlpha+0x48>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isAlpha>:
and    $0xdf,%dil
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @isAlpha(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 122
br i1 %9, label %20, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 65
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 90
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br label %20
20: ; preds = %18, %6
%21 = phi i1 [ true, %6 ], [ %19, %18 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @isAlpha(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};
typedef int int64_t;

/* Variables and functions */
int64_t calcdiff_ns(struct timespec t1, struct timespec t2) {
  int64_t diff;
  diff = 1000000000 * (int64_t)((int)t1.tv_sec - (int)t2.tv_sec);
  diff += ((int)t1.tv_nsec - (int)t2.tv_nsec);
  return diff;
}


x86 assembly (clang, -O0):
<calcdiff_ns>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x8(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %ecx,%eax
imul   $0x3b9aca00,%eax,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %ecx,%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcdiff_ns>:
sub    %ecx,%esi
imul   $0x3b9aca00,%esi,%eax
sub    %edx,%edi
add    %edi,%eax
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define i32 @calcdiff_ns(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca %struct.timespec
%6 = alloca %struct.timespec
%7 = alloca i32
%8 = bitcast %struct.timespec* %5 to { i64, i64 }*
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 0
store i64 %0, i64* %9
%10 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 1
store i64 %1, i64* %10
%11 = bitcast %struct.timespec* %6 to { i64, i64 }*
%12 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %11, i32 0, i32 0
store i64 %2, i64* %12
%13 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %11, i32 0, i32 1
store i64 %3, i64* %13
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 1
%15 = load i64, i64* %14
%16 = trunc i64 %15 to i32
%17 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 1
%18 = load i64, i64* %17
%19 = trunc i64 %18 to i32
%20 = sub nsw i32 %16, %19
%21 = mul nsw i32 1000000000, %20
store i32 %21, i32* %7
%22 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
%23 = load i64, i64* %22
%24 = trunc i64 %23 to i32
%25 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 0
%26 = load i64, i64* %25
%27 = trunc i64 %26 to i32
%28 = sub nsw i32 %24, %27
%29 = load i32, i32* %7
%30 = add nsw i32 %29, %28
store i32 %30, i32* %7
%31 = load i32, i32* %7
ret i32 %31
}

LLVM IR (-O2):
define i32 @calcdiff_ns(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = trunc i64 %1 to i32
%6 = trunc i64 %3 to i32
%7 = sub nsw i32 %5, %6
%8 = mul nsw i32 %7, 1000000000
%9 = trunc i64 %0 to i32
%10 = trunc i64 %2 to i32
%11 = sub i32 %9, %10
%12 = add nsw i32 %11, %8
ret i32 %12
}
unsigned GetRed(const unsigned int color) {
  return ((color & 0x00FF0000) >> 16);
}


x86 assembly (clang, -O0):
<GetRed>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff0000,%eax
shr    $0x10,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetRed>:
shr    $0x10,%edi
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @GetRed(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 16711680
%5 = lshr i32 %4, 16
ret i32 %5
}

LLVM IR (-O2):
define i32 @GetRed(i32 %0) {
%2 = lshr i32 %0, 16
%3 = and i32 %2, 255
ret i32 %3
}
void foo_1_1_2_1_1_1_2_1_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_1_2_1_1_1_2_1_2() {
ret void
}
unsigned hash(char *str) {
  unsigned hash_value;
  for (hash_value = 0; *str != '\0'; ++str) {
    hash_value = *str + 31 * hash_value;
  }
  return hash_value % 101;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1140 <hash+0x40>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
imul   $0x1f,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
mov    $0x65,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1147 <hash+0x47>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
mov    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
mov    %eax,%ecx
imul   $0x446f8657,%rcx,%rcx
shr    $0x20,%rcx
mov    %eax,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x6,%edx
imul   $0x65,%edx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul i32 %6, 31
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = urem i32 %10, 101
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Variables and functions */
int strlen(char *);
int StrLen(char *s) { return (s == 0 ? 0 : strlen(s)); }


x86 assembly (clang, -O0):
<StrLen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1131 <StrLen+0x21>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <StrLen+0x2d>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StrLen>:
test   %rdi,%rdi
je     111a <StrLen+0xa>
jmp    1030 <strlen@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @StrLen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
void Targ_End(void) {}


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

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

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

LLVM IR (-O2):
define void @Targ_End() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fatal_error(int);
scalar_t__ trasmetti_opzione(int, char);
void *r_program_exit(void *id_c) {
  int id_connessione = *((int *)id_c);
  if (trasmetti_opzione(id_connessione, 'g'))
    fatal_error(id_connessione);
  return NULL;
}


x86 assembly (clang, -O0):
<r_program_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x67,%esi
call   1030 <trasmetti_opzione@plt>
cmp    $0x0,%rax
je     1154 <r_program_exit+0x34>
mov    -0xc(%rbp),%edi
call   1040 <fatal_error@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_program_exit>:
push   %rbx
mov    (%rdi),%ebx
mov    %ebx,%edi
mov    $0x67,%esi
call   1030 <trasmetti_opzione@plt>
test   %rax,%rax
je     113b <r_program_exit+0x1b>
mov    %ebx,%edi
call   1040 <fatal_error@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @r_program_exit(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i64 @trasmetti_opzione(i32 %7, i8 signext 103)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i32, i32* %3
%12 = call i32 @fatal_error(i32 %11)
br label %13
13: ; preds = %10, %1
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @r_program_exit(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i64 @trasmetti_opzione(i32 %3, i8 signext 103)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @fatal_error(i32 %3)
br label %8
8: ; preds = %6, %1
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void sig_handler(int signum) { printf("Receive signal. %d\n", signum); }


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"Receive signal. %d\0A\00"
define void @sig_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Receive signal. %d\0A\00"
define void @sig_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
unsigned int **FreeMap(unsigned int **map) {
  free(*map);
  free(map);
  return map;
}


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

x86 assembly (clang, -O2):
<FreeMap>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32** @FreeMap(i32** returned %0) {
%2 = bitcast i32** %0 to i8**
%3 = load i8*, i8** %2
tail call void @free(i8* %3)
%4 = bitcast i32** %0 to i8*
tail call void @free(i8* %4)
ret i32** %0
}
double sigmoid_fp(double x) { return x * (1 - x); }


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

x86 assembly (clang, -O2):
<sigmoid_fp>:
movsd  0xef8(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @sigmoid_fp(double %0) {
%2 = fsub double 1.000000e+00, %0
%3 = fmul double %2, %0
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ jtrace_log_int(int);
void jtrace_common(int len, int type, int time, int task) {
  jtrace_log_int(len + 3 * 4);
  jtrace_log_int(type);
  jtrace_log_int(time);
  jtrace_log_int(task);
}


x86 assembly (clang, -O0):
<jtrace_common>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
add    $0xc,%edi
call   1030 <jtrace_log_int@plt>
mov    -0x8(%rbp),%edi
call   1030 <jtrace_log_int@plt>
mov    -0xc(%rbp),%edi
call   1030 <jtrace_log_int@plt>
mov    -0x10(%rbp),%edi
call   1030 <jtrace_log_int@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jtrace_common>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%ebx
add    $0xc,%edi
call   1030 <jtrace_log_int@plt>
mov    %ebx,%edi
call   1030 <jtrace_log_int@plt>
mov    %ebp,%edi
call   1030 <jtrace_log_int@plt>
mov    %r14d,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <jtrace_log_int@plt>

LLVM IR (-O0):
define void @jtrace_common(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 12
%11 = call i32 @jtrace_log_int(i32 %10)
%12 = load i32, i32* %6
%13 = call i32 @jtrace_log_int(i32 %12)
%14 = load i32, i32* %7
%15 = call i32 @jtrace_log_int(i32 %14)
%16 = load i32, i32* %8
%17 = call i32 @jtrace_log_int(i32 %16)
ret void
}

LLVM IR (-O2):
define void @jtrace_common(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add nsw i32 %0, 12
%6 = tail call i32 @jtrace_log_int(i32 %5)
%7 = tail call i32 @jtrace_log_int(i32 %1)
%8 = tail call i32 @jtrace_log_int(i32 %2)
%9 = tail call i32 @jtrace_log_int(i32 %3)
ret void
}
/* Type definitions */
struct darr {
  int dummy;
};

/* Variables and functions */
void *darr_element(struct darr *, scalar_t__);
scalar_t__ darr_size(struct darr *);
void *darr_last(struct darr *d) { return darr_element(d, darr_size(d) - 1); }


x86 assembly (clang, -O0):
<darr_last>:
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   1040 <darr_size@plt>
mov    -0x10(%rbp),%rdi
mov    %rax,%rsi
sub    $0x1,%rsi
call   1030 <darr_element@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<darr_last>:
push   %rbx
mov    %rdi,%rbx
call   1040 <darr_size@plt>
lea    -0x1(%rax),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <darr_element@plt>

LLVM IR (-O0):
%struct.darr = type { i32 }
define i8* @darr_last(%struct.darr* %0) {
%2 = alloca %struct.darr*
store %struct.darr* %0, %struct.darr** %2
%3 = load %struct.darr*, %struct.darr** %2
%4 = load %struct.darr*, %struct.darr** %2
%5 = call i64 @darr_size(%struct.darr* %4)
%6 = sub nsw i64 %5, 1
%7 = call i8* @darr_element(%struct.darr* %3, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
%struct.darr = type { i32 }
define i8* @darr_last(%struct.darr* %0) {
%2 = tail call i64 @darr_size(%struct.darr* %0)
%3 = add nsw i64 %2, -1
%4 = tail call i8* @darr_element(%struct.darr* %0, i64 %3)
ret i8* %4
}
void __attribute__((weak)) tim6_isr() { debug_handler(__FUNCTION__); }


x86 assembly (clang, -O0):
<tim6_isr>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <debug_handler@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tim6_isr>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <debug_handler@plt>

LLVM IR (-O0):
@__FUNCTION__.tim6_isr = [9 x i8] c"tim6_isr\00"
define weak void @tim6_isr() {
%1 = call i32 (i8*, ...) bitcast (i32 (...)* @debug_handler to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__FUNCTION__.tim6_isr, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__FUNCTION__.tim6_isr = [9 x i8] c"tim6_isr\00"
define weak void @tim6_isr() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @debug_handler to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__FUNCTION__.tim6_isr, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
int I2CSlaveBaseValid(unsigned long);
int /*<<< orphan*/ I2CSlaveEnable(unsigned long);
void I2CSlaveInit(unsigned long ulBase, unsigned char ucSlaveAddr) {
  DEBUG_ASSERT(I2CSlaveBaseValid(ulBase));
  DEBUG_ASSERT(!(ucSlaveAddr & 0x80));
  I2CSlaveEnable(ulBase);
  (*((volatile unsigned long *)(ulBase + 0x00000000))) = ucSlaveAddr;
}


x86 assembly (clang, -O0):
<I2CSlaveInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <I2CSlaveBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
movzbl -0x9(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rdi
call   1040 <I2CSlaveEnable@plt>
movzbl -0x9(%rbp),%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CSlaveInit>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1050 <I2CSlaveBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    %ebp,%eax
not    %al
shr    $0x7,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    %rbx,%rdi
call   1040 <I2CSlaveEnable@plt>
mov    %ebp,%eax
mov    %rax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @I2CSlaveInit(i64 %0, i8 zeroext %1) {
%3 = alloca i64
%4 = alloca i8
store i64 %0, i64* %3
store i8 %1, i8* %4
%5 = load i64, i64* %3
%6 = call i32 @I2CSlaveBaseValid(i64 %5)
%7 = call i32 @DEBUG_ASSERT(i32 %6)
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = and i32 %9, 128
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
%14 = call i32 @DEBUG_ASSERT(i32 %13)
%15 = load i64, i64* %3
%16 = call i32 @I2CSlaveEnable(i64 %15)
%17 = load i8, i8* %4
%18 = zext i8 %17 to i64
%19 = load i64, i64* %3
%20 = add i64 %19, 0
%21 = inttoptr i64 %20 to i64*
store volatile i64 %18, i64* %21
ret void
}

LLVM IR (-O2):
define void @I2CSlaveInit(i64 %0, i8 zeroext %1) {
%3 = tail call i32 @I2CSlaveBaseValid(i64 %0)
%4 = tail call i32 @DEBUG_ASSERT(i32 %3)
%5 = xor i8 %1, -1
%6 = lshr i8 %5, 7
%7 = zext i8 %6 to i32
%8 = tail call i32 @DEBUG_ASSERT(i32 %7)
%9 = tail call i32 @I2CSlaveEnable(i64 %0)
%10 = zext i8 %1 to i64
%11 = inttoptr i64 %0 to i64*
store volatile i64 %10, i64* %11
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int unique_elements(int *, int);
int main() {
  int arr[15] = {6, 2, 2, 4, 5, 4, 1, 1, 7, 1, 7, 6, 2, 5, 3};
  printf("%d", unique_elements(arr, 15));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x3c,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0xf,%esi
call   1050 <unique_elements@plt>
mov    %eax,%esi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movups 0xf01(%rip),%xmm0
movups %xmm0,0x2c(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xf,%esi
call   1040 <unique_elements@plt>
lea    0xed5(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [15 x i32] [i32 6, i32 2, i32 2, i32 4, i32 5, i32 4, i32 1, i32 1, i32 7, i32 1, i32 7, i32 6, i32 2, i32 5, i32 3]
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i32]
store i32 0, i32* %1
%3 = bitcast [15 x i32]* %2 to i8*
%4 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 0
%5 = call i32 @unique_elements(i32* %4, i32 15)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [15 x i32] [i32 6, i32 2, i32 2, i32 4, i32 5, i32 4, i32 1, i32 1, i32 7, i32 1, i32 7, i32 6, i32 2, i32 5, i32 3]
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [15 x i32]
%2 = bitcast [15 x i32]* %1 to i8*
%3 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 0
%4 = call i32 @unique_elements(i32* %3, i32 15)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Type definitions */
struct list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ failure(char *, size_t);
size_t list_size(struct list *);
void test_size(struct list *list, size_t size) {
  if (list_size(list) != size)
    failure("size should have been %lu", size);
}


x86 assembly (clang, -O0):
<test_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <list_size@plt>
cmp    -0x10(%rbp),%rax
je     1153 <test_size+0x33>
mov    -0x10(%rbp),%rsi
lea    0xeb2(%rip),%rdi
call   1040 <failure@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_size>:
push   %rbx
mov    %rsi,%rbx
call   1030 <list_size@plt>
cmp    %rbx,%rax
jne    1130 <test_size+0x10>
pop    %rbx
ret
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <failure@plt>

LLVM IR (-O0):
%struct.list = type { i32 }
@.str = [26 x i8] c"size should have been %lu\00"
define void @test_size(%struct.list* %0, i64 %1) {
%3 = alloca %struct.list*
%4 = alloca i64
store %struct.list* %0, %struct.list** %3
store i64 %1, i64* %4
%5 = load %struct.list*, %struct.list** %3
%6 = call i64 @list_size(%struct.list* %5)
%7 = load i64, i64* %4
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i64, i64* %4
%11 = call i32 @failure(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 %10)
br label %12
12: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
%struct.list = type { i32 }
@.str = [26 x i8] c"size should have been %lu\00"
define void @test_size(%struct.list* %0, i64 %1) {
%3 = tail call i64 @list_size(%struct.list* %0)
%4 = icmp eq i64 %3, %1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @failure(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 %1)
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
int main(void) {
  assert(0);
  puts("here");
  return EXIT_SUCCESS;
}


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"here\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @assert(i32 0)
%3 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}

LLVM IR (-O2):
@.str = [5 x i8] c"here\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @assert(i32 0)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ mkdir(char *, int);
int main(void) {
  if (0 > mkdir("see.emily.play", 0644))
    return EXIT_FAILURE;
  else
    return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x1a4,%esi
call   1030 <mkdir@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    114f <main+0x3f>
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    115b <main+0x4b>
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x1a4,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
jns    1130 <main+0x20>
mov    0x2eb2(%rip),%rax
jmp    1137 <main+0x27>
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"see.emily.play\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @mkdir(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 420)
%3 = icmp sgt i64 0, %2
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = load i32, i32* @EXIT_FAILURE
store i32 %5, i32* %1
br label %8
6: ; preds = %0
%7 = load i32, i32* @EXIT_SUCCESS
store i32 %7, i32* %1
br label %8
8: ; preds = %6, %4
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@.str = [15 x i8] c"see.emily.play\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i64 @mkdir(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 420)
%2 = icmp slt i64 %1, 0
%3 = load i32, i32* @EXIT_FAILURE
%4 = load i32, i32* @EXIT_SUCCESS
%5 = select i1 %2, i32 %3, i32 %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ sleep(unsigned int);
void zleep(int t) {
  unsigned secs = (unsigned)(t / 1000);
  if (secs == 0)
    secs = 1;
  sleep(secs);
}


x86 assembly (clang, -O0):
<zleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113a <zleep+0x2a>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zleep>:
mov    %edi,%eax
lea    0x3e7(%rax),%ecx
mov    $0x1,%edi
cmp    $0x7cf,%ecx
jb     113b <zleep+0x2b>
cltq
imul   $0x10624dd3,%rax,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x26,%rdi
add    %eax,%edi
jmp    1030 <sleep@plt>

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

LLVM IR (-O2):
define void @zleep(i32 %0) {
%2 = sdiv i32 %0, 1000
%3 = add i32 %0, 999
%4 = icmp ult i32 %3, 1999
%5 = select i1 %4, i32 1, i32 %2
%6 = tail call i32 @sleep(i32 %5)
ret void
}
int test_imm_DDint16_reg(short val) {
  return ((val) & (0xDD << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_DDint16_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, 221
%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_DDint16_reg(i16 signext %0) {
%2 = and i16 %0, 221
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ glutSolidTetrahedron();
void drawSolidTetrahedron(void) { glutSolidTetrahedron(); }


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

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

LLVM IR (-O0):
define void @drawSolidTetrahedron() {
%1 = call i32 (...) @glutSolidTetrahedron()
ret void
}

LLVM IR (-O2):
define void @drawSolidTetrahedron() {
%1 = tail call i32 (...) @glutSolidTetrahedron()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *runner(void *p) {
  printf("Esta é a execucao da Thread %d\n", (int)(size_t)p);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<runner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runner>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"Esta \C3\A9 a execucao da Thread %d\0A\00"
define i8* @runner(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = ptrtoint i8* %4 to i64
%6 = trunc i64 %5 to i32
%7 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @pthread_exit(i32* null)
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [33 x i8] c"Esta \C3\A9 a execucao da Thread %d\0A\00"
define noalias i8* @runner(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
char up2low(char car) {
  if (car >= 'A' && car <= 'Z')
    return car - 'A' + 'a';
  else if (car >= 'a' && car <= 'z')
    return car;
  else
    return -1;
}


x86 assembly (clang, -O0):
<up2low>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     1136 <up2low+0x36>
movsbl -0x2(%rbp),%eax
cmp    $0x5a,%eax
jg     1136 <up2low+0x36>
movsbl -0x2(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %al,-0x1(%rbp)
jmp    115f <up2low+0x5f>
movsbl -0x2(%rbp),%eax
cmp    $0x61,%eax
jl     115b <up2low+0x5b>
movsbl -0x2(%rbp),%eax
cmp    $0x7a,%eax
jg     115b <up2low+0x5b>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    115f <up2low+0x5f>
movb   $0xff,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<up2low>:
lea    -0x41(%rdi),%eax
lea    0x20(%rdi),%ecx
lea    -0x61(%rdi),%edx
cmp    $0x1a,%dl
mov    $0xff,%edx
cmovb  %edi,%edx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edx,%eax
ret

LLVM IR (-O0):
define signext i8 @up2low(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 65
br i1 %6, label %7, label %17
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 90
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 65
%15 = add nsw i32 %14, 97
%16 = trunc i32 %15 to i8
store i8 %16, i8* %2
br label %28
17: ; preds = %7, %1
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = icmp sge i32 %19, 97
br i1 %20, label %21, label %27
21: ; preds = %17
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp sle i32 %23, 122
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load i8, i8* %3
store i8 %26, i8* %2
br label %28
27: ; preds = %21, %17
store i8 -1, i8* %2
br label %28
28: ; preds = %27, %25, %11
%29 = load i8, i8* %2
ret i8 %29
}

LLVM IR (-O2):
define signext i8 @up2low(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, 32
%5 = add i8 %0, -97
%6 = icmp ult i8 %5, 26
%7 = select i1 %6, i8 %0, i8 -1
%8 = select i1 %3, i8 %4, i8 %7
ret i8 %8
}
void CFGMR3QueryS16(void) {}


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

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

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

LLVM IR (-O2):
define void @CFGMR3QueryS16() {
ret void
}
/* Variables and functions */
scalar_t__ EBADF;
int /*<<< orphan*/ F_GETFL;
scalar_t__ errno;
int fcntl(int, int /*<<< orphan*/);
int valid_fd(int fd) { return fcntl(fd, F_GETFL) != -1 || errno != EBADF; }


x86 assembly (clang, -O0):
<valid_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
call   1030 <fcntl@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0xffffffff,%ecx
mov    %al,-0x5(%rbp)
jne    1156 <valid_fd+0x46>
mov    0x2e9d(%rip),%rax
mov    (%rax),%rax
mov    0x2e83(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_fd>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
call   1030 <fcntl@plt>
cmp    $0xffffffff,%eax
setne  %al
mov    0x2eb4(%rip),%rcx
mov    (%rcx),%rcx
mov    0x2e9a(%rip),%rdx
cmp    (%rdx),%rcx
setne  %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rcx
ret

LLVM IR (-O0):
@F_GETFL = global i32 0
@errno = global i64 0
@EBADF = global i64 0
define i32 @valid_fd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_GETFL
%5 = call i32 @fcntl(i32 %3, i32 %4)
%6 = icmp ne i32 %5, -1
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i64, i64* @errno
%9 = load i64, i64* @EBADF
%10 = icmp ne i64 %8, %9
br label %11
11: ; preds = %7, %1
%12 = phi i1 [ true, %1 ], [ %10, %7 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
@F_GETFL = global i32 0
@errno = global i64 0
@EBADF = global i64 0
define i32 @valid_fd(i32 %0) {
%2 = load i32, i32* @F_GETFL
%3 = tail call i32 @fcntl(i32 %0, i32 %2)
%4 = icmp ne i32 %3, -1
%5 = load i64, i64* @errno
%6 = load i64, i64* @EBADF
%7 = icmp ne i64 %5, %6
%8 = select i1 %4, i1 true, i1 %7
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOPNOTSUPP;
int print_qrcode(FILE *out, const char *header, const char *string) {
  return -EOPNOTSUPP;
}


x86 assembly (clang, -O0):
<print_qrcode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
mov    0x2ec7(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_qrcode>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EOPNOTSUPP = global i32 0
define i32 @print_qrcode(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* @EOPNOTSUPP
%8 = sub nsw i32 0, %7
ret i32 %8
}

LLVM IR (-O2):
@EOPNOTSUPP = global i32 0
define i32 @print_qrcode(i32* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = load i32, i32* @EOPNOTSUPP
%5 = sub nsw i32 0, %4
ret i32 %5
}
void GP_break02(void) {}


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

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

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

LLVM IR (-O2):
define void @GP_break02() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M373_f(char *s) {
  debug("M373_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M373_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M373_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M373_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M373_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M373_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M373_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
int16_t return_int16() { return 42; }


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

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

LLVM IR (-O0):
define i32 @return_int16() {
ret i32 42
}

LLVM IR (-O2):
define i32 @return_int16() {
ret i32 42
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "usage: strings [-] [-o] [-num] file ...\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 = [41 x i8] c"usage: strings [-] [-o] [-num] file ...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"usage: strings [-] [-o] [-num] file ...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
struct Utmp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ deleteUtmp(struct Utmp *);
void destroyUtmpHashEntry(void *arg, char *key, char *value) {
  do {
    (void)(arg);
  } while (0);
  do {
    (void)(key);
  } while (0);
  deleteUtmp((struct Utmp *)value);
}


x86 assembly (clang, -O0):
<destroyUtmpHashEntry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
jmp    1129 <destroyUtmpHashEntry+0x19>
mov    -0x18(%rbp),%rdi
call   1030 <deleteUtmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<destroyUtmpHashEntry>:
mov    %rdx,%rdi
jmp    1030 <deleteUtmp@plt>

LLVM IR (-O0):
%struct.Utmp = type { i32 }
define void @destroyUtmpHashEntry(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
br label %7
7: ; preds = %3
%8 = load i8*, i8** %4
br label %9
9: ; preds = %7
br label %10
10: ; preds = %9
%11 = load i8*, i8** %5
br label %12
12: ; preds = %10
%13 = load i8*, i8** %6
%14 = bitcast i8* %13 to %struct.Utmp*
%15 = call i32 @deleteUtmp(%struct.Utmp* %14)
ret void
}

LLVM IR (-O2):
%struct.Utmp = type { i32 }
define void @destroyUtmpHashEntry(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* %2) {
%4 = bitcast i8* %2 to %struct.Utmp*
%5 = tail call i32 @deleteUtmp(%struct.Utmp* %4)
ret void
}