xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ str;

/* Variables and functions */
int /*<<< orphan*/ emsSetc(char const *, char *);
int /*<<< orphan*/ vsnprintf(char *, int, char const *, int /*<<< orphan*/);
void emsSetv(const char *token, const char *format, va_list args) {
  char str[200 + 1];
  vsnprintf(str, sizeof(str), format, args);
  emsSetc(token, str);
}


x86 assembly (clang, -O0):
<emsSetv>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0xe0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    $0xc9,%esi
call   1030 <vsnprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1040 <emsSetc@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emsSetv>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0xc9,%esi
call   1030 <vsnprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <emsSetc@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @emsSetv(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [201 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = getelementptr inbounds [201 x i8], [201 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @vsnprintf(i8* %8, i32 201, i8* %9, i32 %10)
%12 = load i8*, i8** %4
%13 = getelementptr inbounds [201 x i8], [201 x i8]* %7, i64 0, i64 0
%14 = call i32 @emsSetc(i8* %12, i8* %13)
ret void
}

LLVM IR (-O2):
define void @emsSetv(i8* %0, i8* nocapture %1, i32 %2) {
%4 = alloca [201 x i8]
%5 = getelementptr inbounds [201 x i8], [201 x i8]* %4, i64 0, i64 0
%6 = call i32 @vsnprintf(i8* %5, i32 201, i8* %1, i32 %2)
%7 = call i32 @emsSetc(i8* %0, i8* %5)
ret void
}
unsigned long rdfsbase(void) {
  unsigned long fsbase;
  asm volatile("rdfsbase %0" : "=r"(fsbase)::"memory");
  return fsbase;
}


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

x86 assembly (clang, -O2):
<rdfsbase>:
rdfsbase %rax
ret

LLVM IR (-O0):
define i64 @rdfsbase() {
%1 = alloca i64
%2 = call i64 asm sideeffect "rdfsbase $0", "=r,~{memory},~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @rdfsbase() {
%1 = tail call i64 asm sideeffect "rdfsbase $0", "=r,~{memory},~{dirflag},~{fpsr},~{flags}"()
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int chdir(char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
char *strerror(int /*<<< orphan*/);
void chdir_target() {
  int ret = chdir("target");
  if (ret != 0) {
    printf("chdir failed: %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<chdir_target>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <chdir@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     118c <chdir_target+0x4c>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    %rax,%rsi
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chdir_target>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <chdir@plt>
test   %eax,%eax
jne    1153 <chdir_target+0x13>
pop    %rax
ret
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe9f(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"target\00"
@.str.1 = [18 x i8] c"chdir failed: %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @chdir_target() {
%1 = alloca i32
%2 = call i32 @chdir(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %0
%6 = load i32, i32* @errno
%7 = call i8* @strerror(i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %0
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"target\00"
@.str.1 = [18 x i8] c"chdir failed: %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @chdir_target() {
%1 = tail call i32 @chdir(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = load i32, i32* @errno
%5 = tail call i8* @strerror(i32 %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %0
ret void
}
int divTwo(int n) { return n >> 1; }


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

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

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

LLVM IR (-O2):
define i32 @divTwo(i32 %0) {
%2 = ashr i32 %0, 1
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ fb_realpath(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(int argc, char **argv) {
  char resolved_path[10];
  char path[100];
  FILE *f;
  if (0)
    printf("MAXPATHLEN=%d\n", 10);
  assert(argc == 2);
  strcpy(path, argv[1]);
  if (0)
    printf("Input path = %s, strlen(path) = %d\n", path, strlen(path));
  if (0)
    printf("MAXPATHLEN = %d\n", 10);
  fb_realpath(path, resolved_path);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
lea    -0x1a(%rbp),%rsi
call   1050 <fb_realpath@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
mov    %rsi,%rbx
xor    %eax,%eax
cmp    $0x2,%edi
sete   %al
mov    %eax,%edi
call   1040 <assert@plt>
mov    0x8(%rbx),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0x6(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <fb_realpath@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i8]
%7 = alloca [100 x i8]
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 2
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strcpy(i8* %13, i8* %16)
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%20 = call i32 @fb_realpath(i8* %18, i8* %19)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10 x i8]
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 2
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @strcpy(i8* %6, i8* %11)
%13 = call i32 @fb_realpath(i8* %6, i8* %5)
ret i32 0
}
/* Type definitions */
struct activity {
  int dummy;
};

/* Variables and functions */
int get_freq_nr();
int wrap_get_freq_nr(struct activity *a) {
  int n = 0;
  if ((n = get_freq_nr()) > 0)
    return n + 0;
  return 0;
}


x86 assembly (clang, -O0):
<wrap_get_freq_nr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <get_freq_nr@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jle    1144 <wrap_get_freq_nr+0x34>
mov    -0x14(%rbp),%eax
add    $0x0,%eax
mov    %eax,-0x4(%rbp)
jmp    114b <wrap_get_freq_nr+0x3b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrap_get_freq_nr>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <get_freq_nr@plt>
test   %eax,%eax
cmovs  %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.activity = type { i32 }
define i32 @wrap_get_freq_nr(%struct.activity* %0) {
%2 = alloca i32
%3 = alloca %struct.activity*
%4 = alloca i32
store %struct.activity* %0, %struct.activity** %3
store i32 0, i32* %4
%5 = call i32 (...) @get_freq_nr()
store i32 %5, i32* %4
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 0
store i32 %9, i32* %2
br label %11
10: ; preds = %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %7
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
%struct.activity = type { i32 }
define i32 @wrap_get_freq_nr(%struct.activity* nocapture readnone %0) {
%2 = tail call i32 (...) @get_freq_nr()
%3 = icmp sgt i32 %2, 0
%4 = select i1 %3, i32 %2, i32 0
ret i32 %4
}
char meat_string_is_whitespace(unsigned char const c_buf) {
  return (char)(((unsigned char)(' ') == c_buf) ||
                ((unsigned char)('\r') == c_buf) ||
                ((unsigned char)('\t') == c_buf) ||
                ((unsigned char)('\n') == c_buf));
}


x86 assembly (clang, -O0):
<meat_string_is_whitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
mov    $0x1,%al
mov    $0x20,%ecx
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
je     115d <meat_string_is_whitespace+0x5d>
movzbl -0x1(%rbp),%edx
mov    $0x1,%al
mov    $0xd,%ecx
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
je     115d <meat_string_is_whitespace+0x5d>
movzbl -0x1(%rbp),%edx
mov    $0x1,%al
mov    $0x9,%ecx
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
je     115d <meat_string_is_whitespace+0x5d>
movzbl -0x1(%rbp),%ecx
mov    $0xa,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<meat_string_is_whitespace>:
cmp    $0x20,%dil
ja     111b <meat_string_is_whitespace+0x1b>
mov    $0x1,%al
mov    %edi,%ecx
movabs $0x100002200,%rdx
bt     %rcx,%rdx
jae    111b <meat_string_is_whitespace+0x1b>
ret
cmp    $0xa,%dil
sete   %al
ret

LLVM IR (-O0):
define signext i8 @meat_string_is_whitespace(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp eq i32 32, %4
br i1 %5, label %18, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = icmp eq i32 13, %8
br i1 %9, label %18, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = icmp eq i32 9, %12
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = zext i8 %15 to i32
%17 = icmp eq i32 10, %16
br label %18
18: ; preds = %14, %10, %6, %1
%19 = phi i1 [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %17, %14 ]
%20 = zext i1 %19 to i32
%21 = trunc i32 %20 to i8
ret i8 %21
}

LLVM IR (-O2):
define signext i8 @meat_string_is_whitespace(i8 zeroext %0) {
switch i8 %0, label %2 [
i8 32, label %5
i8 13, label %5
i8 9, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 10
%4 = zext i1 %3 to i8
br label %5
5: ; preds = %1, %1, %1, %2
%6 = phi i8 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ], [ 1, %1 ]
ret i8 %6
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
size_t minipack_sizeof_array(uint32_t count) {
  if (count <= 15) {
    return 1;
  } else if (count <= 65535) {
    return 3;
  }
  return 5;
}


x86 assembly (clang, -O0):
<minipack_sizeof_array>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0xf,-0xc(%rbp)
jg     111e <minipack_sizeof_array+0x1e>
movq   $0x1,-0x8(%rbp)
jmp    1145 <minipack_sizeof_array+0x45>
cmpl   $0xffff,-0xc(%rbp)
jg     1138 <minipack_sizeof_array+0x38>
movq   $0x3,-0x8(%rbp)
jmp    1145 <minipack_sizeof_array+0x45>
jmp    113d <minipack_sizeof_array+0x3d>
movq   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<minipack_sizeof_array>:
xor    %eax,%eax
cmp    $0x10000,%edi
setge  %al
cmp    $0x10,%edi
lea    0x3(%rax,%rax,1),%rcx
mov    $0x1,%eax
cmovge %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @minipack_sizeof_array(i32 %0) {
%2 = icmp slt i32 %0, 16
%3 = icmp slt i32 %0, 65536
%4 = select i1 %3, i64 3, i64 5
%5 = select i1 %2, i64 1, i64 %4
ret i64 %5
}
/* Variables and functions */
int floor(double);
float NormalizarPI(float ang) {
  return (float)(ang + (2 * 3.14159265358979323846) *
                           floor((3.14159265358979323846 - ang) /
                                 (2 * 3.14159265358979323846)));
}


x86 assembly (clang, -O0):
<NormalizarPI>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xecc(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  0xeb8(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <floor@plt>
movsd  -0x10(%rbp),%xmm1
cvtsi2sd %eax,%xmm0
movsd  0xe9e(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NormalizarPI>:
push   %rax
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0xede(%rip),%xmm0
subsd  %xmm1,%xmm0
divsd  0xeda(%rip),%xmm0
call   1030 <floor@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xec6(%rip),%xmm0
addsd  (%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @NormalizarPI(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fsub double 0x400921FB54442D18, %6
%8 = fdiv double %7, 0x401921FB54442D18
%9 = call i32 @floor(double %8)
%10 = sitofp i32 %9 to double
%11 = call double @llvm.fmuladd.f64(double 0x401921FB54442D18, double %10, double %4)
%12 = fptrunc double %11 to float
ret float %12
}

LLVM IR (-O2):
define float @NormalizarPI(float %0) {
%2 = fpext float %0 to double
%3 = fsub double 0x400921FB54442D18, %2
%4 = fdiv double %3, 0x401921FB54442D18
%5 = tail call i32 @floor(double %4)
%6 = sitofp i32 %5 to double
%7 = tail call double @llvm.fmuladd.f64(double %6, double 0x401921FB54442D18, double %2)
%8 = fptrunc double %7 to float
ret float %8
}
/* Variables and functions */
double lgamma(double);
double lgamma_(double *x) { return lgamma(*x); }


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

x86 assembly (clang, -O2):
<lgamma_>:
movsd  (%rdi),%xmm0
jmp    1030 <lgamma@plt>

LLVM IR (-O0):
define double @lgamma_(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = load double, double* %3
%5 = call double @lgamma(double %4)
ret double %5
}

LLVM IR (-O2):
define double @lgamma_(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call double @lgamma(double %2)
ret double %3
}
/* Variables and functions */
int fact(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int n = 10;
  printf("%d! = %d\n", n, fact(n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <fact@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1040 <fact@plt>
lea    0xece(%rip),%rdi
mov    $0xa,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"%d! = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @fact(i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 10, i32 %1)
ret i32 0
}
void absmin(int n, double *a, int *amin) {}


x86 assembly (clang, -O0):
<absmin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @absmin(i32 %0, double* nocapture %1, i32* nocapture %2) {
ret void
}
int _kt_is_emacs_ctrl(const char *string) {
  return *string++ == 'C' && *string++ == '-' && *string;
}


x86 assembly (clang, -O0):
<_kt_is_emacs_ctrl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x43,%ecx
mov    %al,-0x9(%rbp)
jne    1158 <_kt_is_emacs_ctrl+0x58>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2d,%ecx
mov    %al,-0x9(%rbp)
jne    1158 <_kt_is_emacs_ctrl+0x58>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_kt_is_emacs_ctrl>:
xor    %eax,%eax
cmpb   $0x43,(%rdi)
jne    1116 <_kt_is_emacs_ctrl+0x16>
cmpb   $0x2d,0x1(%rdi)
jne    1116 <_kt_is_emacs_ctrl+0x16>
xor    %eax,%eax
cmpb   $0x0,0x2(%rdi)
setne  %al
ret

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

LLVM IR (-O2):
define i32 @_kt_is_emacs_ctrl(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 67
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 45
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %8, %4, %1
%14 = phi i32 [ 0, %4 ], [ 0, %1 ], [ %12, %8 ]
ret i32 %14
}
void Quadrature1_Handler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<Quadrature1_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <Quadrature1_Handler+0x9>
jmp    1109 <Quadrature1_Handler+0x9>

x86 assembly (clang, -O2):
<Quadrature1_Handler>:
jmp    1100 <Quadrature1_Handler>

LLVM IR (-O0):
define void @Quadrature1_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @Quadrature1_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
void __attribute__((weak)) can1_rx0_isr() { debug_handler(__FUNCTION__); }


x86 assembly (clang, -O0):
<can1_rx0_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):
<can1_rx0_isr>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <debug_handler@plt>

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

LLVM IR (-O2):
@__FUNCTION__.can1_rx0_isr = [13 x i8] c"can1_rx0_isr\00"
define weak void @can1_rx0_isr() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @debug_handler to i32 (i8*, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__FUNCTION__.can1_rx0_isr, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ isDigit(int /*<<< orphan*/);
int countCharDigits(const char *str) {
  for (int digits = 0;; digits++)
    if (isDigit(*str++) == 0)
      return digits;
}


x86 assembly (clang, -O0):
<countCharDigits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <isDigit@plt>
cmp    $0x0,%rax
jne    114d <countCharDigits+0x3d>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    1152 <countCharDigits+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <countCharDigits+0x13>

x86 assembly (clang, -O2):
<countCharDigits>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movsbl (%rdi),%edi
call   1030 <isDigit@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1144 <countCharDigits+0x34>
cs nopw 0x0(%rax,%rax,1)
movsbl 0x1(%r14,%rbx,1),%edi
call   1030 <isDigit@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1130 <countCharDigits+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @countCharDigits(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = tail call i64 @isDigit(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %8, %1
%7 = phi i32 [ 0, %1 ], [ %12, %8 ]
ret i32 %7
8: ; preds = %1, %8
%9 = phi i32 [ %12, %8 ], [ 0, %1 ]
%10 = phi i8* [ %11, %8 ], [ %0, %1 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = add nuw nsw i32 %9, 1
%13 = load i8, i8* %11
%14 = sext i8 %13 to i32
%15 = tail call i64 @isDigit(i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %6, label %8
}
/* Variables and functions */
int /*<<< orphan*/ test5_g();
void test5_h(void) { test5_g(); }


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

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

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

LLVM IR (-O2):
define void @test5_h() {
%1 = tail call i32 (...) @test5_g()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errno;
char const *strerror(int /*<<< orphan*/);
const char *serial_errmsg(void) { return strerror(errno); }


x86 assembly (clang, -O0):
<serial_errmsg>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <strerror@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_errmsg>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <strerror@plt>

LLVM IR (-O0):
@errno = global i32 0
define i8* @serial_errmsg() {
%1 = load i32, i32* @errno
%2 = call i8* @strerror(i32 %1)
ret i8* %2
}

LLVM IR (-O2):
@errno = global i32 0
define i8* @serial_errmsg() {
%1 = load i32, i32* @errno
%2 = tail call i8* @strerror(i32 %1)
ret i8* %2
}
void log_warn(const char *type, int code, const char *msg) {
  (void)type;
  (void)code;
  (void)msg;
}


x86 assembly (clang, -O0):
<log_warn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @log_warn(i8* nocapture %0, i32 %1, i8* nocapture %2) {
ret void
}
void process_arp(struct Seaper *seap, struct NetFrame *frame,
                 const unsigned char *px, unsigned length) {
  seap;
  frame;
  px;
  length;
  ;
}


x86 assembly (clang, -O0):
<process_arp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.Seaper = type opaque
%struct.NetFrame = type opaque
define void @process_arp(%struct.Seaper* %0, %struct.NetFrame* %1, i8* %2, i32 %3) {
%5 = alloca %struct.Seaper*
%6 = alloca %struct.NetFrame*
%7 = alloca i8*
%8 = alloca i32
store %struct.Seaper* %0, %struct.Seaper** %5
store %struct.NetFrame* %1, %struct.NetFrame** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load %struct.Seaper*, %struct.Seaper** %5
%10 = load %struct.NetFrame*, %struct.NetFrame** %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
ret void
}

LLVM IR (-O2):
%struct.Seaper = type opaque
%struct.NetFrame = type opaque
define void @process_arp(%struct.Seaper* nocapture %0, %struct.NetFrame* nocapture %1, i8* nocapture %2, i32 %3) {
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int32_t pmsafe(int32_t addr) { return addr & 0x100 - 1; }


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

x86 assembly (clang, -O2):
<pmsafe>:
movzbl %dil,%eax
ret

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

LLVM IR (-O2):
define i32 @pmsafe(i32 %0) {
%2 = and i32 %0, 255
ret i32 %2
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
void *fa_malloc(int size) {
  void *ptr = NULL;
  ptr = malloc(size);
  if (ptr)
    memset(ptr, 0, size);
  return ptr;
}


x86 assembly (clang, -O0):
<fa_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1158 <fa_malloc+0x38>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fa_malloc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     113e <fa_malloc+0x1e>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @fa_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @memset(i8* %2, i32 0, i32 %0)
br label %6
6: ; preds = %4, %1
ret i8* %2
}
unsigned long ccNextPOT(unsigned long x) {
  x = x - 1;
  x = x | (x >> 1);
  x = x | (x >> 2);
  x = x | (x >> 4);
  x = x | (x >> 8);
  x = x | (x >> 16);
  return x + 1;
}


x86 assembly (clang, -O0):
<ccNextPOT>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x1,%rcx
or     %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x2,%rcx
or     %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x4,%rcx
or     %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x8,%rcx
or     %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x10,%rcx
or     %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccNextPOT>:
lea    -0x1(%rdi),%rax
mov    %rax,%rcx
shr    %rcx
or     %rax,%rcx
mov    %rcx,%rax
shr    $0x2,%rax
or     %rcx,%rax
mov    %rax,%rcx
shr    $0x4,%rcx
or     %rax,%rcx
mov    %rcx,%rdx
shr    $0x8,%rdx
or     %rcx,%rdx
mov    %rdx,%rax
shr    $0x10,%rax
or     %rdx,%rax
add    $0x1,%rax
ret

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

LLVM IR (-O2):
define i64 @ccNextPOT(i64 %0) {
%2 = add i64 %0, -1
%3 = lshr i64 %2, 1
%4 = or i64 %3, %2
%5 = lshr i64 %4, 2
%6 = or i64 %5, %4
%7 = lshr i64 %6, 4
%8 = or i64 %7, %6
%9 = lshr i64 %8, 8
%10 = or i64 %9, %8
%11 = lshr i64 %10, 16
%12 = or i64 %11, %10
%13 = add i64 %12, 1
ret i64 %13
}
int test_imm_55int64_lowword_reg(long long val) {
  return ((val) & (0x55 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_55int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 85
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void GENERAL_NAME_free(void) {}


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

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

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

LLVM IR (-O2):
define void @GENERAL_NAME_free() {
ret void
}
/* Variables and functions */
unsigned long estrtoul(char const *, int /*<<< orphan*/);
unsigned long eatoul(const char *s) { return estrtoul(s, 0); }


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

x86 assembly (clang, -O2):
<eatoul>:
xor    %esi,%esi
jmp    1030 <estrtoul@plt>

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

LLVM IR (-O2):
define i64 @eatoul(i8* %0) {
%2 = tail call i64 @estrtoul(i8* %0, i32 0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  if (n % 4 == 0)
    printf("It is a leap year");
  else
    printf("It is not a leap year");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1164 <main+0x44>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    1170 <main+0x50>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
testb  $0x3,0x4(%rsp)
lea    0xec5(%rip),%rax
lea    0xed0(%rip),%rdi
cmove  %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [18 x i8] c"It is a leap year\00"
@.str.2 = [22 x i8] c"It is not a leap year\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = srem i32 %4, 4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [18 x i8] c"It is a leap year\00"
@.str.2 = [22 x i8] c"It is not a leap year\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = and i32 %4, 3
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0)
%8 = call i32 @printf(i8* dereferenceable(1) %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EMLINK;
int /*<<< orphan*/ errno;
int _link(char *old, char *new) {
  if (old) {
  }
  if (new) {
  }
  errno = EMLINK;
  return -1;
}


x86 assembly (clang, -O0):
<_link>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     111c <_link+0x1c>
jmp    111c <_link+0x1c>
cmpq   $0x0,-0x10(%rbp)
je     112c <_link+0x2c>
jmp    112c <_link+0x2c>
mov    0x2ebd(%rip),%rax
mov    (%rax),%ecx
mov    0x2e9c(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@EMLINK = global i32 0
@errno = global i32 0
define i32 @_link(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 = icmp ne i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %2
br label %8
8: ; preds = %7, %2
%9 = load i8*, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %12
11: ; preds = %8
br label %12
12: ; preds = %11, %8
%13 = load i32, i32* @EMLINK
store i32 %13, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EMLINK = global i32 0
@errno = global i32 0
define i32 @_link(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @EMLINK
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_char_image(char **image, int yres) {
  int j;
  for (j = 0; j < yres; j++)
    free((char *)image[j]);
  free((char *)image);
}


x86 assembly (clang, -O0):
<free_char_image>:
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_char_image+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_char_image+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_char_image>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <free_char_image+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_char_image+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_char_image(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @free(i8* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = bitcast i8** %0 to i8*
%15 = tail call i32 @free(i8* %14)
ret void
}
/* Variables and functions */
long double __infer_nondet_long_double();
long double hypotl(long double x, long double y) {
  return __infer_nondet_long_double();
}


x86 assembly (clang, -O0):
<hypotl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
xor    %eax,%eax
call   1030 <__infer_nondet_long_double@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define x86_fp80 @hypotl(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
%5 = call x86_fp80 (...) @__infer_nondet_long_double()
ret x86_fp80 %5
}

LLVM IR (-O2):
define x86_fp80 @hypotl(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call x86_fp80 (...) @__infer_nondet_long_double()
ret x86_fp80 %3
}
/* Variables and functions */
int strcmp(char const *, char const *);
int strlen(char const *);
int sortcmp(const void *p1, const void *p2) {
  const char *s1 = *(char *const *)p1;
  const char *s2 = *(char *const *)p2;
  int rval = strlen(s1) - strlen(s2);
  if (rval == 0)
    rval = strcmp(s1, s2);
  return rval;
}


x86 assembly (clang, -O0):
<sortcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    117f <sortcmp+0x5f>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sortcmp>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%rbx
mov    (%rsi),%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
sub    %eax,%ebp
je     1147 <sortcmp+0x27>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %rbx,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <strcmp@plt>

LLVM IR (-O0):
define i32 @sortcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
store i8* %10, i8** %5
%11 = load i8*, i8** %4
%12 = bitcast i8* %11 to i8**
%13 = load i8*, i8** %12
store i8* %13, i8** %6
%14 = load i8*, i8** %5
%15 = call i32 @strlen(i8* %14)
%16 = load i8*, i8** %6
%17 = call i32 @strlen(i8* %16)
%18 = sub nsw i32 %15, %17
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %2
%22 = load i8*, i8** %5
%23 = load i8*, i8** %6
%24 = call i32 @strcmp(i8* %22, i8* %23)
store i32 %24, i32* %7
br label %25
25: ; preds = %21, %2
%26 = load i32, i32* %7
ret i32 %26
}

LLVM IR (-O2):
define i32 @sortcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strlen(i8* %4)
%8 = tail call i32 @strlen(i8* %6)
%9 = sub nsw i32 %7, %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
br label %13
13: ; preds = %11, %2
%14 = phi i32 [ %12, %11 ], [ %9, %2 ]
ret i32 %14
}
/* Variables and functions */
char *df_strndup(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
char *df_strdup(const char *string) {
  return df_strndup(string, strlen(string));
}


x86 assembly (clang, -O0):
<df_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 <df_strndup@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @df_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* @df_strndup(i8* %3, i32 %5)
ret i8* %6
}

LLVM IR (-O2):
define i8* @df_strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i8* @df_strndup(i8* %0, i32 %2)
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int available(FILE *fp, void *p, char *title) {
  if (!p)
    (void)fprintf(fp, "not available: %s\n", title);
  return (p != NULL);
}


x86 assembly (clang, -O0):
<available>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <available+0x33>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xec2(%rip),%rsi
call   1030 <fprintf@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<available>:
push   %rbx
mov    %rsi,%rbx
test   %rsi,%rsi
jne    1125 <available+0x15>
lea    0xee0(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
test   %rbx,%rbx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"not available: %s\0A\00"
define i32 @available(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 i8*, i8** %5
%8 = icmp ne i8* %7, null
br i1 %8, label %13, label %9
9: ; preds = %3
%10 = load i32*, i32** %4
%11 = load i8*, i8** %6
%12 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %9, %3
%14 = load i8*, i8** %5
%15 = icmp ne i8* %14, null
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
@.str = [19 x i8] c"not available: %s\0A\00"
define i32 @available(i32* nocapture %0, i8* readnone %1, i8* %2) {
%4 = icmp ne i8* %1, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %7
7: ; preds = %5, %3
%8 = zext i1 %4 to i32
ret i32 %8
}
/* Type definitions */
struct firewireDevice {
  int dummy;
};
struct device {
  int dummy;
};

/* Variables and functions */
int compareDevice(struct device *, struct device *);
int firewireCompareDevice(struct firewireDevice *dev1,
                          struct firewireDevice *dev2) {
  return compareDevice((struct device *)dev1, (struct device *)dev2);
}


x86 assembly (clang, -O0):
<firewireCompareDevice>:
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 <compareDevice@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<firewireCompareDevice>:
jmp    1030 <compareDevice@plt>

LLVM IR (-O0):
%struct.firewireDevice = type { i32 }
%struct.device = type { i32 }
define i32 @firewireCompareDevice(%struct.firewireDevice* %0, %struct.firewireDevice* %1) {
%3 = alloca %struct.firewireDevice*
%4 = alloca %struct.firewireDevice*
store %struct.firewireDevice* %0, %struct.firewireDevice** %3
store %struct.firewireDevice* %1, %struct.firewireDevice** %4
%5 = load %struct.firewireDevice*, %struct.firewireDevice** %3
%6 = bitcast %struct.firewireDevice* %5 to %struct.device*
%7 = load %struct.firewireDevice*, %struct.firewireDevice** %4
%8 = bitcast %struct.firewireDevice* %7 to %struct.device*
%9 = call i32 @compareDevice(%struct.device* %6, %struct.device* %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.firewireDevice = type { i32 }
%struct.device = type { i32 }
define i32 @firewireCompareDevice(%struct.firewireDevice* %0, %struct.firewireDevice* %1) {
%3 = bitcast %struct.firewireDevice* %0 to %struct.device*
%4 = bitcast %struct.firewireDevice* %1 to %struct.device*
%5 = tail call i32 @compareDevice(%struct.device* %3, %struct.device* %4)
ret i32 %5
}