xunge/DecIR huggingface dataset:
/* Variables and functions */
int calculateCharacterValue(char);
int hash(char *key) {
  int hashIndex = calculateCharacterValue(key[0]);
  for (int i = 1; i < 3; i++) {
    hashIndex *= calculateCharacterValue(key[i]);
  }
  return hashIndex % 256;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <calculateCharacterValue@plt>
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    1162 <hash+0x52>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <calculateCharacterValue@plt>
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1132 <hash+0x22>
mov    -0xc(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <calculateCharacterValue@plt>
mov    %eax,%r14d
movsbl 0x1(%rbx),%edi
call   1030 <calculateCharacterValue@plt>
mov    %eax,%ebp
imul   %r14d,%ebp
movsbl 0x2(%rbx),%edi
call   1030 <calculateCharacterValue@plt>
imul   %ebp,%eax
lea    0xff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffff00,%ecx
sub    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @calculateCharacterValue(i8 signext %2)
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = tail call i32 @calculateCharacterValue(i8 signext %5)
%7 = mul nsw i32 %6, %3
%8 = getelementptr inbounds i8, i8* %0, i64 2
%9 = load i8, i8* %8
%10 = tail call i32 @calculateCharacterValue(i8 signext %9)
%11 = mul nsw i32 %10, %7
%12 = srem i32 %11, 256
ret i32 %12
}
/* Variables and functions */
int __jiqnnt(long double);
int intr_wrap_401(long double p1) { return __jiqnnt(p1); }


x86 assembly (clang, -O0):
<intr_wrap_401>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <__jiqnnt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intr_wrap_401>:
jmp    1030 <__jiqnnt@plt>

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

LLVM IR (-O2):
define i32 @intr_wrap_401(x86_fp80 %0) {
%2 = tail call i32 @__jiqnnt(x86_fp80 %0)
ret i32 %2
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct sched_param {
  int dummy;
};
struct TYPE_3__ {
  int /*<<< orphan*/ __sp;
};
typedef TYPE_1__ posix_spawnattr_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(struct sched_param *, int /*<<< orphan*/ *, int);
int posix_spawnattr_getschedparam(const posix_spawnattr_t *attr,
                                  struct sched_param *schedparam) {
  memcpy(schedparam, &attr->__sp, sizeof(attr->__sp));
  return 0;
}


x86 assembly (clang, -O0):
<posix_spawnattr_getschedparam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<posix_spawnattr_getschedparam>:
push   %rax
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
%struct.sched_param = type { i32 }
define i32 @posix_spawnattr_getschedparam(%struct.TYPE_3__* %0, %struct.sched_param* %1) {
%3 = alloca %struct.TYPE_3__*
%4 = alloca %struct.sched_param*
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %3
store %struct.sched_param* %1, %struct.sched_param** %4
%5 = load %struct.sched_param*, %struct.sched_param** %4
%6 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%7 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i32 0, i32 0
%8 = call i32 @memcpy(%struct.sched_param* %5, i32* %7, i32 4)
ret i32 0
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
%struct.sched_param = type { i32 }
define i32 @posix_spawnattr_getschedparam(%struct.TYPE_3__* %0, %struct.sched_param* %1) {
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%4 = tail call i32 @memcpy(%struct.sched_param* %1, i32* %3, i32 4)
ret i32 0
}
/* Variables and functions */
int StaticTestFunction(int);
int /*<<< orphan*/ TestFunction();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int a = 42;
  int b = StaticTestFunction(a);
  printf("Hello world\n");
  TestFunction();
  printf("From application, %d & %d\n", a, b);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2a,%edi
call   1060 <StaticTestFunction@plt>
mov    %eax,%ebx
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <TestFunction@plt>
lea    0xe99(%rip),%rdi
mov    $0x2a,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world\0A\00"
@.str.1 = [27 x i8] c"From application, %d & %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 42, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @StaticTestFunction(i32 %4)
store i32 %5, i32* %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @TestFunction()
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [27 x i8] c"From application, %d & %d\0A\00"
@str = [12 x i8] c"Hello world\00"
define i32 @main() {
%1 = tail call i32 @StaticTestFunction(i32 42)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @TestFunction()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 42, i32 %1)
ret i32 0
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *vtkstrdup(const char *in) {
  char *res = malloc(strlen(in) + 1);
  strcpy(res, in);
  return res;
}


x86 assembly (clang, -O0):
<vtkstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vtkstrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @vtkstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @vtkstrdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
int dlclose(void *const);
int dylib_close(void *const handle) { return dlclose(handle); }


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

x86 assembly (clang, -O2):
<dylib_close>:
jmp    1030 <dlclose@plt>

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

LLVM IR (-O2):
define i32 @dylib_close(i8* %0) {
%2 = tail call i32 @dlclose(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void smbftpd_help_print() {
  printf("\nsmbftpd (http://www.twbsd.org)\n\n"
         "options:\n"
         "     -D          Running smbftpd as a daemon\n"
         "     -s file     Set the path of smbftpd.conf\n"
         "     -v          Print the version of smbftpd\n"
         "     -h          Print this help message\n\n");
}


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

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

LLVM IR (-O0):
@.str = [222 x i8] c"\0Asmbftpd (http://www.twbsd.org)\0A\0Aoptions:\0A -D Running smbftpd as a daemon\0A -s file Set the path of smbftpd.conf\0A -v Print the version of smbftpd\0A -h Print this help message\0A\0A\00"
define void @smbftpd_help_print() {
%1 = call i32 @printf(i8* getelementptr inbounds ([222 x i8], [222 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [221 x i8] c"\0Asmbftpd (http://www.twbsd.org)\0A\0Aoptions:\0A -D Running smbftpd as a daemon\0A -s file Set the path of smbftpd.conf\0A -v Print the version of smbftpd\0A -h Print this help message\0A\00"
define void @smbftpd_help_print() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([221 x i8], [221 x i8]* @str, i64 0, i64 0))
ret void
}
void av_free_packet() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
size_t fwrite(void *, size_t, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void fwrite_safe(void *ptr, size_t size, size_t count, FILE *fp) {
  if (fwrite(ptr, size, count, fp) != count) {
    fprintf(stderr, "\nError: Couldn't fwrite to file\n\n");
    exit(-1);
  }
  return;
}


x86 assembly (clang, -O0):
<fwrite_safe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1050 <fwrite@plt>
cmp    -0x18(%rbp),%rax
je     1186 <fwrite_safe+0x56>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fwrite_safe>:
push   %rbx
mov    %rdx,%rbx
call   1050 <fwrite@plt>
cmp    %rbx,%rax
jne    1140 <fwrite_safe+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"\0AError: Couldn't fwrite to file\0A\0A\00"
define void @fwrite_safe(i8* %0, i64 %1, i64 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32* %3, i32** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i64, i64* %7
%12 = load i32*, i32** %8
%13 = call i64 @fwrite(i8* %9, i64 %10, i64 %11, i32* %12)
%14 = load i64, i64* %7
%15 = icmp ne i64 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %4
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @exit(i32 -1)
unreachable
20: ; preds = %4
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"\0AError: Couldn't fwrite to file\0A\0A\00"
define void @fwrite_safe(i8* nocapture %0, i64 %1, i64 %2, i32* nocapture %3) {
%5 = tail call i64 @fwrite(i8* %0, i64 %1, i64 %2, i32* %3)
%6 = icmp eq i64 %5, %2
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %4
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ put_asm(int, int *, int);
void put_sta(uint16_t org, int *pos, uint16_t dest) {
  put_asm(org, pos, 0x8d);
  put_asm(org, pos, dest & 255);
  put_asm(org, pos, dest >> 8);
}


x86 assembly (clang, -O0):
<put_sta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x8d,%edx
call   1030 <put_asm@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
and    $0xff,%edx
call   1030 <put_asm@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
sar    $0x8,%edx
call   1030 <put_asm@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_sta>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x8d,%edx
call   1030 <put_asm@plt>
movzbl %bl,%edx
mov    %ebp,%edi
mov    %r14,%rsi
call   1030 <put_asm@plt>
sar    $0x8,%ebx
mov    %ebp,%edi
mov    %r14,%rsi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <put_asm@plt>

LLVM IR (-O0):
define void @put_sta(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32*, i32** %5
%9 = call i32 @put_asm(i32 %7, i32* %8, i32 141)
%10 = load i32, i32* %4
%11 = load i32*, i32** %5
%12 = load i32, i32* %6
%13 = and i32 %12, 255
%14 = call i32 @put_asm(i32 %10, i32* %11, i32 %13)
%15 = load i32, i32* %4
%16 = load i32*, i32** %5
%17 = load i32, i32* %6
%18 = ashr i32 %17, 8
%19 = call i32 @put_asm(i32 %15, i32* %16, i32 %18)
ret void
}

LLVM IR (-O2):
define void @put_sta(i32 %0, i32* %1, i32 %2) {
%4 = tail call i32 @put_asm(i32 %0, i32* %1, i32 141)
%5 = and i32 %2, 255
%6 = tail call i32 @put_asm(i32 %0, i32* %1, i32 %5)
%7 = ashr i32 %2, 8
%8 = tail call i32 @put_asm(i32 %0, i32* %1, i32 %7)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void xfgets(char *str, int size, FILE *in) {
  if (fgets(str, size, in) == NULL)
    fprintf(stderr, "\nError in reading or end of file.\n");
}


x86 assembly (clang, -O0):
<xfgets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <fgets@plt>
cmp    $0x0,%rax
jne    1162 <xfgets+0x42>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
lea    0xea3(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfgets>:
push   %rax
call   1030 <fgets@plt>
test   %rax,%rax
je     112d <xfgets+0xd>
pop    %rax
ret
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
lea    0xec3(%rip),%rsi
pop    %rax
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"\0AError in reading or end of file.\0A\00"
define void @xfgets(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32*, i32** %6
%10 = call i32* @fgets(i8* %7, i32 %8, i32* %9)
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %12, %3
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"\0AError in reading or end of file.\0A\00"
define void @xfgets(i8* %0, i32 %1, i32* nocapture %2) {
%4 = tail call i32* @fgets(i8* %0, i32 %1, i32* %2)
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %6, %3
ret void
}
char *XDefaultString() {}


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

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

LLVM IR (-O0):
define i8* @XDefaultString() {
%1 = alloca i8*
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
define noalias i8* @XDefaultString() {
ret i8* undef
}
int test_imm_28int16_mem(short *val) {
  return ((*val) & (0x28 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_28int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 40
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ RTLD_LAZY;
char *dlerror();
void *dlopen(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *, char *);
int /*<<< orphan*/ stdout;
void *zompLoadLib(const char *name) {
  void *handle = dlopen(name, RTLD_LAZY);
  if (handle == NULL) {
    printf("Could not load dll '%s': %s\n", name, dlerror());
    fflush(stdout);
  }
  return handle;
}


x86 assembly (clang, -O0):
<zompLoadLib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
call   1050 <dlopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    119d <zompLoadLib+0x5d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <dlerror@plt>
mov    -0x18(%rbp),%rsi
mov    %rax,%rdx
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zompLoadLib>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2e8a(%rip),%rax
mov    (%rax),%esi
call   1050 <dlopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1184 <zompLoadLib+0x44>
xor    %eax,%eax
call   1030 <dlerror@plt>
lea    0xe95(%rip),%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@RTLD_LAZY = global i32 0
@.str = [29 x i8] c"Could not load dll '%s': %s\0A\00"
@stdout = global i32 0
define i8* @zompLoadLib(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @RTLD_LAZY
%6 = call i8* @dlopen(i8* %4, i32 %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %15
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i8* (...) @dlerror()
%12 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11)
%13 = load i32, i32* @stdout
%14 = call i32 @fflush(i32 %13)
br label %15
15: ; preds = %9, %1
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@RTLD_LAZY = global i32 0
@.str = [29 x i8] c"Could not load dll '%s': %s\0A\00"
@stdout = global i32 0
define i8* @zompLoadLib(i8* %0) {
%2 = load i32, i32* @RTLD_LAZY
%3 = tail call i8* @dlopen(i8* %0, i32 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = tail call i8* (...) @dlerror()
%7 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %6)
%8 = load i32, i32* @stdout
%9 = tail call i32 @fflush(i32 %8)
br label %10
10: ; preds = %5, %1
ret i8* %3
}
int suma(int n) {
  int i;
  int s = 0;
  for (i = 1; i <= n; ++i) {
    s += i;
  }
  return s;
}


x86 assembly (clang, -O0):
<suma>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1138 <suma+0x38>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <suma+0x15>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<suma>:
test   %edi,%edi
jle    1118 <suma+0x18>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rdi,2),%eax
add    $0xffffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @suma(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = shl nuw i32 %0, 1
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i33
%7 = add nsw i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %4, %11
%13 = add i32 %12, -1
br label %14
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %13, %3 ]
ret i32 %15
}
int v_cube(V, lambda)
float *V, lambda;
{ return 0; }


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

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

LLVM IR (-O0):
define i32 @v_cube(float* %0, double %1) {
%3 = alloca float*
%4 = alloca float
%5 = fptrunc double %1 to float
store float* %0, float** %3
store float %5, float* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @v_cube(float* nocapture readnone %0, double %1) {
ret i32 0
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int S_ISDIR(int /*<<< orphan*/);
scalar_t__ stat(char *, struct stat *);
int stat_is_dir(char *arg) {
  struct stat buf;
  if (0 > stat(arg, &buf)) {
    return -1;
  }
  return S_ISDIR(buf.st_mode);
}


x86 assembly (clang, -O0):
<stat_is_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    1153 <stat_is_dir+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    115e <stat_is_dir+0x3e>
mov    -0x18(%rbp),%edi
call   1030 <S_ISDIR@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stat_is_dir>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
test   %rax,%rax
js     1138 <stat_is_dir+0x18>
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @stat_is_dir(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp sgt i64 0, %6
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %13
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @S_ISDIR(i32 %11)
store i32 %12, i32* %2
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @stat_is_dir(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp slt i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @S_ISDIR(i32 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %9, %6 ], [ -1, %1 ]
ret i32 %11
}
void default_irq(void) {}


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

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

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

LLVM IR (-O2):
define void @default_irq() {
ret void
}
long long gcd(long long a, long long b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cqto
idivq  -0x18(%rbp)
cmp    $0x0,%rdx
jne    1141 <gcd+0x31>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    115b <gcd+0x4b>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
cqto
idivq  -0x18(%rbp)
mov    %rdx,%rsi
call   1030 <gcd@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %rsi,%rdx
mov    %rdi,%rax
jmp    111d <gcd+0x1d>
nopl   0x0(%rax,%rax,1)
cqto
idiv   %rcx
mov    %rcx,%rax
test   %rdx,%rdx
je     1132 <gcd+0x32>
mov    %rdx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1110 <gcd+0x10>
xor    %edx,%edx
div    %ecx
jmp    1115 <gcd+0x15>
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @gcd(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %4
%7 = load i64, i64* %5
%8 = srem i64 %6, %7
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i64, i64* %5
store i64 %11, i64* %3
br label %18
12: ; preds = %2
%13 = load i64, i64* %5
%14 = load i64, i64* %4
%15 = load i64, i64* %5
%16 = srem i64 %14, %15
%17 = call i64 @gcd(i64 %13, i64 %16)
store i64 %17, i64* %3
br label %18
18: ; preds = %12, %10
%19 = load i64, i64* %3
ret i64 %19
}

LLVM IR (-O2):
define i64 @gcd(i64 %0, i64 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %0, %2 ], [ %5, %3 ]
%5 = phi i64 [ %1, %2 ], [ %6, %3 ]
%6 = srem i64 %4, %5
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3
ret i64 %5
}
/* Variables and functions */
double const pow(int, long long const);
double ldexp(const double x, const long long y) { return x * pow(2, y); }


x86 assembly (clang, -O0):
<ldexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldexp>:
push   %rax
mov    %rdi,%rsi
movsd  %xmm0,(%rsp)
mov    $0x2,%edi
call   1030 <pow@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ldexp(double %0, i64 %1) {
%3 = alloca double
%4 = alloca i64
store double %0, double* %3
store i64 %1, i64* %4
%5 = load double, double* %3
%6 = load i64, i64* %4
%7 = call double @pow(i32 2, i64 %6)
%8 = fmul double %5, %7
ret double %8
}

LLVM IR (-O2):
define double @ldexp(double %0, i64 %1) {
%3 = tail call double @pow(i32 2, i64 %1)
%4 = fmul double %3, %0
ret double %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ TIOCSPGRP;
int ioctl(int, int /*<<< orphan*/, int /*<<< orphan*/ *);
int tcsetpgrp(int fildes, pid_t pgrpid) {
  return ioctl(fildes, TIOCSPGRP, &pgrpid);
}


x86 assembly (clang, -O0):
<tcsetpgrp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdx
call   1030 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcsetpgrp>:
push   %rax
mov    %esi,0x4(%rsp)
mov    0x2ec4(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdx
call   1030 <ioctl@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
@TIOCSPGRP = global i32 0
define i32 @tcsetpgrp(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = load i32, i32* @TIOCSPGRP
%5 = call i32 @ioctl(i32 %0, i32 %4, i32* %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char *, int);
int Display_Completion(char *str, int length, int no) {
  printf("match %6d  :<%s> len=%d\n", no, str, length);
  return 1;
}


x86 assembly (clang, -O0):
<Display_Completion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Display_Completion>:
push   %rax
mov    %esi,%ecx
mov    %rdi,%rax
lea    0xee3(%rip),%rdi
mov    %edx,%esi
mov    %rax,%rdx
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"match %6d :<%s> len=%d\0A\00"
define i32 @Display_Completion(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %8, i32 %9)
ret i32 1
}

LLVM IR (-O2):
@.str = [25 x i8] c"match %6d :<%s> len=%d\0A\00"
define i32 @Display_Completion(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %2, i8* %0, i32 %1)
ret i32 1
}
/* Type definitions */
struct hdr_histogram {
  int dummy;
};
typedef scalar_t__ int64_t;

/* Variables and functions */
int hdr_size_of_equivalent_value_range(struct hdr_histogram const *,
                                       scalar_t__);
scalar_t__ lowest_equivalent_value(struct hdr_histogram const *, scalar_t__);
int64_t hdr_median_equivalent_value(const struct hdr_histogram *h,
                                    int64_t value) {
  return lowest_equivalent_value(h, value) +
         (hdr_size_of_equivalent_value_range(h, value) >> 1);
}


x86 assembly (clang, -O0):
<hdr_median_equivalent_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <lowest_equivalent_value@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <hdr_size_of_equivalent_value_range@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sar    $0x1,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdr_median_equivalent_value>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <lowest_equivalent_value@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <hdr_size_of_equivalent_value_range@plt>
sar    %eax
cltq
add    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.hdr_histogram = type { i32 }
define i64 @hdr_median_equivalent_value(%struct.hdr_histogram* %0, i64 %1) {
%3 = alloca %struct.hdr_histogram*
%4 = alloca i64
store %struct.hdr_histogram* %0, %struct.hdr_histogram** %3
store i64 %1, i64* %4
%5 = load %struct.hdr_histogram*, %struct.hdr_histogram** %3
%6 = load i64, i64* %4
%7 = call i64 @lowest_equivalent_value(%struct.hdr_histogram* %5, i64 %6)
%8 = load %struct.hdr_histogram*, %struct.hdr_histogram** %3
%9 = load i64, i64* %4
%10 = call i32 @hdr_size_of_equivalent_value_range(%struct.hdr_histogram* %8, i64 %9)
%11 = ashr i32 %10, 1
%12 = sext i32 %11 to i64
%13 = add nsw i64 %7, %12
ret i64 %13
}

LLVM IR (-O2):
%struct.hdr_histogram = type { i32 }
define i64 @hdr_median_equivalent_value(%struct.hdr_histogram* %0, i64 %1) {
%3 = tail call i64 @lowest_equivalent_value(%struct.hdr_histogram* %0, i64 %1)
%4 = tail call i32 @hdr_size_of_equivalent_value_range(%struct.hdr_histogram* %0, i64 %1)
%5 = ashr i32 %4, 1
%6 = sext i32 %5 to i64
%7 = add nsw i64 %3, %6
ret i64 %7
}
/* Variables and functions */
int omp_get_thread_num();
int /*<<< orphan*/ printf(char *, int);
int main() {
#pragma omp parallel
  {
    int ID = omp_get_thread_num();
    printf("hello(%d)", ID);
    printf(" world(%d)\n", ID);
  }
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
mov    %eax,%ebx
lea    0xecf(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"hello(%d)\00"
@.str.1 = [12 x i8] c" world(%d)\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @omp_get_thread_num()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
struct _Locale_monetary {
  int dummy;
};

/* Variables and functions */
int CHAR_MAX;
int _Locale_n_sign_posn(struct _Locale_monetary *lmon
                        __attribute__((__unused__))) {
  return CHAR_MAX;
}


x86 assembly (clang, -O0):
<_Locale_n_sign_posn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_Locale_n_sign_posn>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct._Locale_monetary = type { i32 }
@CHAR_MAX = global i32 0
define i32 @_Locale_n_sign_posn(%struct._Locale_monetary* %0) {
%2 = alloca %struct._Locale_monetary*
store %struct._Locale_monetary* %0, %struct._Locale_monetary** %2
%3 = load i32, i32* @CHAR_MAX
ret i32 %3
}

LLVM IR (-O2):
%struct._Locale_monetary = type { i32 }
@CHAR_MAX = global i32 0
define i32 @_Locale_n_sign_posn(%struct._Locale_monetary* nocapture readnone %0) {
%2 = load i32, i32* @CHAR_MAX
ret i32 %2
}
int log2x(unsigned n) {
  int i;
  for (i = 0; n > 1; i++, n >>= 1)
    ;
  return i;
}


x86 assembly (clang, -O0):
<log2x>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jbe    1134 <log2x+0x34>
jmp    111d <log2x+0x1d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <log2x+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2x>:
xor    %eax,%eax
cmp    $0x2,%edi
jb     111c <log2x+0x1c>
xor    %eax,%eax
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
shr    %ecx
cmp    $0x3,%edi
mov    %ecx,%edi
ja     1110 <log2x+0x10>
ret

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

LLVM IR (-O2):
define i32 @log2x(i32 %0) {
%2 = icmp ugt i32 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = lshr i32 %5, 1
%8 = icmp ugt i32 %5, 3
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %10
}
void XtAllocateGC() {}


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

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

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

LLVM IR (-O2):
define void @XtAllocateGC() {
ret void
}
/* Variables and functions */
double exponential(int);
int tnext(double intensity) {
  double d;
  d = exponential(1. / (50. * intensity));
  return (int)(d * (double)10000 + .5);
}


x86 assembly (clang, -O0):
<tnext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef3(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xede(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <exponential@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeaf(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeab(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tnext>:
push   %rax
mulsd  0xee7(%rip),%xmm0
movsd  0xee7(%rip),%xmm1
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <exponential@plt>
mulsd  0xeda(%rip),%xmm0
addsd  0xeda(%rip),%xmm0
cvttsd2si %xmm0,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @tnext(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fmul double 5.000000e+01, %4
%6 = fdiv double 1.000000e+00, %5
%7 = fptosi double %6 to i32
%8 = call double @exponential(i32 %7)
store double %8, double* %3
%9 = load double, double* %3
%10 = call double @llvm.fmuladd.f64(double %9, double 1.000000e+04, double 5.000000e-01)
%11 = fptosi double %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @tnext(double %0) {
%2 = fmul double %0, 5.000000e+01
%3 = fdiv double 1.000000e+00, %2
%4 = fptosi double %3 to i32
%5 = tail call double @exponential(i32 %4)
%6 = tail call double @llvm.fmuladd.f64(double %5, double 1.000000e+04, double 5.000000e-01)
%7 = fptosi double %6 to i32
ret i32 %7
}
int getNumOf(int start, int end) {
  if (start == -1 || end == -1)
    return -1;
  return end - start + 1;
}


x86 assembly (clang, -O0):
<getNumOf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
je     111e <getNumOf+0x1e>
cmpl   $0xffffffff,-0xc(%rbp)
jne    112a <getNumOf+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1136 <getNumOf+0x36>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNumOf>:
mov    %esi,%eax
sub    %edi,%eax
add    $0x1,%eax
cmp    $0xffffffff,%esi
cmove  %esi,%eax
cmp    $0xffffffff,%edi
cmove  %edi,%eax
ret

LLVM IR (-O0):
define i32 @getNumOf(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, -1
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %12
11: ; preds = %8, %2
store i32 -1, i32* %3
br label %17
12: ; preds = %8
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = sub nsw i32 %13, %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %17
17: ; preds = %12, %11
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @getNumOf(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, -1
%4 = icmp eq i32 %1, -1
%5 = or i1 %3, %4
%6 = sub i32 1, %0
%7 = add i32 %6, %1
%8 = select i1 %5, i32 -1, i32 %7
ret i32 %8
}
/* Type definitions */
struct usbdevfs_ioctl {
  int ioctl_code;
  int /*<<< orphan*/ *data;
  scalar_t__ ifno;
};

/* Variables and functions */
int /*<<< orphan*/ USBDEVFS_IOCTL;
int ioctl(int, int /*<<< orphan*/, struct usbdevfs_ioctl *);
int send_usb_cmd(int fd, int cmd) {
  struct usbdevfs_ioctl command;
  command.ifno = 0;
  command.ioctl_code = cmd;
  command.data = NULL;
  return ioctl(fd, USBDEVFS_IOCTL, &command);
}


x86 assembly (clang, -O0):
<send_usb_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1030 <ioctl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_usb_cmd>:
sub    $0x18,%rsp
mov    %esi,(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
call   1030 <ioctl@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.usbdevfs_ioctl = type { i32, i32*, i64 }
@USBDEVFS_IOCTL = global i32 0
define i32 @send_usb_cmd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.usbdevfs_ioctl
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds %struct.usbdevfs_ioctl, %struct.usbdevfs_ioctl* %5, i32 0, i32 2
store i64 0, i64* %6
%7 = load i32, i32* %4
%8 = getelementptr inbounds %struct.usbdevfs_ioctl, %struct.usbdevfs_ioctl* %5, i32 0, i32 0
store i32 %7, i32* %8
%9 = getelementptr inbounds %struct.usbdevfs_ioctl, %struct.usbdevfs_ioctl* %5, i32 0, i32 1
store i32* null, i32** %9
%10 = load i32, i32* %3
%11 = load i32, i32* @USBDEVFS_IOCTL
%12 = call i32 @ioctl(i32 %10, i32 %11, %struct.usbdevfs_ioctl* %5)
ret i32 %12
}

LLVM IR (-O2):
%struct.usbdevfs_ioctl = type { i32, i32*, i64 }
@USBDEVFS_IOCTL = global i32 0
define i32 @send_usb_cmd(i32 %0, i32 %1) {
%3 = alloca %struct.usbdevfs_ioctl
%4 = bitcast %struct.usbdevfs_ioctl* %3 to i8*
%5 = getelementptr inbounds %struct.usbdevfs_ioctl, %struct.usbdevfs_ioctl* %3, i64 0, i32 2
store i64 0, i64* %5
%6 = getelementptr inbounds %struct.usbdevfs_ioctl, %struct.usbdevfs_ioctl* %3, i64 0, i32 0
store i32 %1, i32* %6
%7 = getelementptr inbounds %struct.usbdevfs_ioctl, %struct.usbdevfs_ioctl* %3, i64 0, i32 1
store i32* null, i32** %7
%8 = load i32, i32* @USBDEVFS_IOCTL
%9 = call i32 @ioctl(i32 %0, i32 %8, %struct.usbdevfs_ioctl* %3)
ret i32 %9
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t Checksum_step32(uint32_t content, uint32_t state) {
  return state + (content >> 16) + (content & 0xFFFF);
}


x86 assembly (clang, -O0):
<Checksum_step32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x10,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xffff,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Checksum_step32>:
movzwl %di,%eax
sar    $0x10,%edi
add    %esi,%edi
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @Checksum_step32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = ashr i32 %6, 16
%8 = add nsw i32 %5, %7
%9 = load i32, i32* %3
%10 = and i32 %9, 65535
%11 = add nsw i32 %8, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @Checksum_step32(i32 %0, i32 %1) {
%3 = ashr i32 %0, 16
%4 = add nsw i32 %3, %1
%5 = and i32 %0, 65535
%6 = add nsw i32 %4, %5
ret i32 %6
}
/* Variables and functions */
void *realloc(void *, size_t);
void *memory_realloc(void *(*realloc_fct)(void *, size_t), void *ptr,
                     size_t size) {
  return (realloc_fct) ? realloc_fct(ptr, size) : realloc(ptr, size);
}


x86 assembly (clang, -O0):
<memory_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1146 <memory_realloc+0x36>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   *%rax
mov    %rax,-0x20(%rbp)
jmp    1157 <memory_realloc+0x47>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memory_realloc>:
test   %rdi,%rdi
je     1120 <memory_realloc+0x10>
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    *%rax
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1030 <realloc@plt>

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

LLVM IR (-O2):
define i8* @memory_realloc(i8* (i8*, i64)* %0, i8* %1, i64 %2) {
%4 = icmp eq i8* (i8*, i64)* %0, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i8* %0(i8* %1, i64 %2)
br label %9
7: ; preds = %3
%8 = tail call i8* @realloc(i8* %1, i64 %2)
br label %9
9: ; preds = %7, %5
%10 = phi i8* [ %6, %5 ], [ %8, %7 ]
ret i8* %10
}