xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
__attribute__((hotpatch(1))) void hp8(void) { printf("hello, world!\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"hello, world!\00"
define void @hp8() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
size_t strlen(const char *s) {
  const char *s2 = s;
  while (*s2++)
    ;
  return s2 - s;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
je     112d <strlen+0x2d>
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0x0,(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %4 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
void SYS_endwin() { endwin(); }


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

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

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

LLVM IR (-O2):
define void @SYS_endwin() {
%1 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mysub();
int /*<<< orphan*/ printf(char *, int);
main() {
  int x;
  x = 5;
  printf("%d\n", x);
  mysub();
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 5)
%2 = tail call i32 (...) @mysub()
ret i32 0
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
void FPUHalfPrecisionModeSet(uint32_t ui32Mode) {
  (*((volatile unsigned long *)(0xE000EF3C))) =
      ((*((volatile unsigned long *)(0xE000EF3C))) & ~(0x04000000)) | ui32Mode;
}


x86 assembly (clang, -O0):
<FPUHalfPrecisionModeSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0xe000ef3c,%eax
mov    (%rax),%rcx
and    $0xfffffffffbffffff,%rcx
mov    -0x8(%rbp),%rax
or     %rax,%rcx
mov    $0xe000ef3c,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<FPUHalfPrecisionModeSet>:
mov    %rdi,-0x8(%rsp)
mov    $0xe000ef3c,%eax
mov    $0xfffffffffbffffff,%rcx
and    (%rax),%rcx
or     -0x8(%rsp),%rcx
mov    %rcx,(%rax)
ret

LLVM IR (-O0):
define void @FPUHalfPrecisionModeSet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* inttoptr (i64 3758157628 to i64*)
%4 = and i64 %3, -67108865
%5 = load volatile i64, i64* %2
%6 = or i64 %4, %5
store volatile i64 %6, i64* inttoptr (i64 3758157628 to i64*)
ret void
}

LLVM IR (-O2):
define void @FPUHalfPrecisionModeSet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* inttoptr (i64 3758157628 to i64*)
%4 = and i64 %3, -67108865
%5 = load volatile i64, i64* %2
%6 = or i64 %4, %5
store volatile i64 %6, i64* inttoptr (i64 3758157628 to i64*)
ret void
}
void SetIOForReceive() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ _mm_unpacklo_epi64(int /*<<< orphan*/, int /*<<< orphan*/);
__m128i foo2(__m128i s1, __m128i s2) { return _mm_unpacklo_epi64(s1, s2); }


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

x86 assembly (clang, -O2):
<foo2>:
jmp    1030 <_mm_unpacklo_epi64@plt>

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

LLVM IR (-O2):
define i32 @foo2(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_unpacklo_epi64(i32 %0, i32 %1)
ret i32 %3
}
/* Type definitions */
struct sched_param {
  int dummy;
};
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int pthread_attr_getschedparam(int /*<<< orphan*/ *, struct sched_param *);
int my_pthread_attr_getschedparam(pthread_attr_t const *__attr,
                                  struct sched_param *param) {
  pthread_attr_t *realattr = (pthread_attr_t *)*(unsigned int *)__attr;
  return pthread_attr_getschedparam(realattr, param);
}


x86 assembly (clang, -O0):
<my_pthread_attr_getschedparam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <pthread_attr_getschedparam@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_pthread_attr_getschedparam>:
mov    (%rdi),%edi
jmp    1030 <pthread_attr_getschedparam@plt>

LLVM IR (-O0):
%struct.sched_param = type { i32 }
define i32 @my_pthread_attr_getschedparam(i32* %0, %struct.sched_param* %1) {
%3 = alloca i32*
%4 = alloca %struct.sched_param*
%5 = alloca i32*
store i32* %0, i32** %3
store %struct.sched_param* %1, %struct.sched_param** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %5
%10 = load i32*, i32** %5
%11 = load %struct.sched_param*, %struct.sched_param** %4
%12 = call i32 @pthread_attr_getschedparam(i32* %10, %struct.sched_param* %11)
ret i32 %12
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
define i32 @my_pthread_attr_getschedparam(i32* nocapture %0, %struct.sched_param* %1) {
%3 = load i32, i32* %0
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = tail call i32 @pthread_attr_getschedparam(i32* %5, %struct.sched_param* %1)
ret i32 %6
}
double double_sub(double a, double b) { return a - b; }


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

x86 assembly (clang, -O2):
<double_sub>:
subsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @double_sub(double %0, double %1) {
%3 = fsub double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ openpty(int *, int *, int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
void foo(void) {
  int master, slave;
  openpty(&master, &slave, 0, 0, 0);
}


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

x86 assembly (clang, -O2):
<foo>:
push   %rax
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <openpty@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @foo() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @openpty(i32* %1, i32* %2, i32 0, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @openpty(i32* %1, i32* %2, i32 0, i32 0, i32 0)
ret void
}
void set_default_offline_state(int cpu) {}


x86 assembly (clang, -O0):
<set_default_offline_state>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @set_default_offline_state(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ TMR2_DriverIRQHandler();
__attribute__((weak)) void TMR2_IRQHandler(void) { TMR2_DriverIRQHandler(); }


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

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

LLVM IR (-O0):
define weak void @TMR2_IRQHandler() {
%1 = call i32 (...) @TMR2_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @TMR2_IRQHandler() {
%1 = tail call i32 (...) @TMR2_DriverIRQHandler()
ret void
}
/* Variables and functions */
char *getenv(char *);
int /*<<< orphan*/ strcat(char *, char *);
char *makeDirPath() {
  char *s = getenv("HOME");
  strcat(s, "/.ctd/");
  return s;
}


x86 assembly (clang, -O0):
<makeDirPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeDirPath>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
lea    0xece(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcat@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [7 x i8] c"/.ctd/\00"
define i8* @makeDirPath() {
%1 = alloca i8*
%2 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = load i8*, i8** %1
ret i8* %5
}

LLVM IR (-O2):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [7 x i8] c"/.ctd/\00"
define i8* @makeDirPath() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret i8* %1
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ listen(int, int);
ssize_t test(void) {
  int sockfd = 4;
  int backlog = 7;
  return listen(sockfd, backlog);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x4,-0x4(%rbp)
movl   $0x7,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <listen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
mov    $0x4,%edi
mov    $0x7,%esi
jmp    1030 <listen@plt>

LLVM IR (-O0):
define i32 @test() {
%1 = alloca i32
%2 = alloca i32
store i32 4, i32* %1
store i32 7, i32* %2
%3 = load i32, i32* %1
%4 = load i32, i32* %2
%5 = call i32 @listen(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @test() {
%1 = tail call i32 @listen(i32 4, i32 7)
ret i32 %1
}
int fold(char c) {
  if (c < 'A' || c > 'Z')
    return (c);
  return (c | 040);
}


x86 assembly (clang, -O0):
<fold>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1124 <fold+0x24>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jle    1130 <fold+0x30>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113a <fold+0x3a>
movsbl -0x5(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fold>:
lea    -0x5b(%rdi),%ecx
mov    %edi,%eax
or     $0x20,%eax
cmp    $0xe6,%cl
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define i32 @fold(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp slt i32 %5, 65
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sgt i32 %9, 90
br i1 %10, label %11, label %14
11: ; preds = %7, %1
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
store i32 %13, i32* %2
br label %18
14: ; preds = %7
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = or i32 %16, 32
store i32 %17, i32* %2
br label %18
18: ; preds = %14, %11
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @fold(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -91
%4 = icmp ult i8 %3, -26
%5 = or i32 %2, 32
%6 = select i1 %4, i32 %2, i32 %5
ret i32 %6
}
/* Variables and functions */
int errno;
int *__errno() { return &errno; }


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

x86 assembly (clang, -O2):
<__errno>:
mov    0x2ed9(%rip),%rax
ret

LLVM IR (-O0):
@errno = global i32 0
define i32* @__errno() {
ret i32* @errno
}

LLVM IR (-O2):
@errno = global i32 0
define i32* @__errno() {
ret i32* @errno
}
void d2i_X509_CRL_bio(void) {}


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

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

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

LLVM IR (-O2):
define void @d2i_X509_CRL_bio() {
ret void
}
long pcount_goto_dw(unsigned long x) {
  long result = 0;
  if (!x)
    goto done;
loop:
  result += x & 0x1;
  x >>= 1;
  if (x)
    goto loop;
done:
  return result;
}


x86 assembly (clang, -O0):
<pcount_goto_dw>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1120 <pcount_goto_dw+0x20>
jmp    1156 <pcount_goto_dw+0x56>
jmp    1125 <pcount_goto_dw+0x25>
mov    -0x8(%rbp),%rax
and    $0x1,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1151 <pcount_goto_dw+0x51>
jmp    1125 <pcount_goto_dw+0x25>
jmp    1156 <pcount_goto_dw+0x56>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pcount_goto_dw>:
xor    %eax,%eax
test   %rdi,%rdi
je     1124 <pcount_goto_dw+0x24>
mov    %rdi,%rcx
nopw   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
add    %rdx,%rax
shr    %rcx
cmp    $0x1,%rdi
mov    %rcx,%rdi
ja     1110 <pcount_goto_dw+0x10>
ret

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

LLVM IR (-O2):
define i64 @pcount_goto_dw(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ %0, %1 ]
%5 = phi i64 [ %7, %3 ], [ 0, %1 ]
%6 = and i64 %4, 1
%7 = add i64 %5, %6
%8 = lshr i64 %4, 1
%9 = icmp ult i64 %4, 2
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i64 [ 0, %1 ], [ %7, %3 ]
ret i64 %11
}
void gtk_icon_view_set_row_spacing() {}


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

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

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

LLVM IR (-O2):
define void @gtk_icon_view_set_row_spacing() {
ret void
}
int main() {
  unsigned long t1 = -1;
  return t1 % 256;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movq   $0xffffffffffffffff,-0x10(%rbp)
ff
mov    -0x10(%rbp),%rax
and    $0xff,%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
store i64 -1, i64* %2
%3 = load i64, i64* %2
%4 = urem i64 %3, 256
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @main() {
ret i32 255
}
/* Type definitions */
typedef unsigned int uint32_t;

/* Variables and functions */
uint32_t softfloat_shift32RightJam(uint32_t a, unsigned int count) {
  return (count < 32) ? a >> count | ((uint32_t)(a << ((-count) & 31)) != 0)
                      : (a != 0);
}


x86 assembly (clang, -O0):
<softfloat_shift32RightJam>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jae    1141 <softfloat_shift32RightJam+0x41>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
mov    -0x4(%rbp),%edx
xor    %ecx,%ecx
sub    -0x8(%rbp),%ecx
and    $0x1f,%ecx
shl    %cl,%edx
mov    %edx,%ecx
cmp    $0x0,%ecx
setne  %cl
and    $0x1,%cl
movzbl %cl,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    1150 <softfloat_shift32RightJam+0x50>
cmpl   $0x0,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<softfloat_shift32RightJam>:
cmp    $0x1f,%esi
ja     1119 <softfloat_shift32RightJam+0x19>
mov    %esi,%ecx
mov    %edi,%edx
shr    %cl,%edx
neg    %cl
shl    %cl,%edi
xor    %eax,%eax
test   %edi,%edi
setne  %al
or     %edx,%eax
ret
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @softfloat_shift32RightJam(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 = icmp ult i32 %5, 32
br i1 %6, label %7, label %19
7: ; preds = %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = lshr i32 %8, %9
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = sub i32 0, %12
%14 = and i32 %13, 31
%15 = shl i32 %11, %14
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i32
%18 = or i32 %10, %17
br label %23
19: ; preds = %2
%20 = load i32, i32* %3
%21 = icmp ne i32 %20, 0
%22 = zext i1 %21 to i32
br label %23
23: ; preds = %19, %7
%24 = phi i32 [ %18, %7 ], [ %22, %19 ]
ret i32 %24
}

LLVM IR (-O2):
define i32 @softfloat_shift32RightJam(i32 %0, i32 %1) {
%3 = icmp ult i32 %1, 32
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = lshr i32 %0, %1
%6 = sub nsw i32 0, %1
%7 = and i32 %6, 31
%8 = shl i32 %0, %7
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i32
%11 = or i32 %5, %10
br label %15
12: ; preds = %2
%13 = icmp ne i32 %0, 0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %12, %4
%16 = phi i32 [ %11, %4 ], [ %14, %12 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ wFree(char *);
char *wPopString();
int /*<<< orphan*/ wPushNumber(int /*<<< orphan*/);
void wBasLen() {
  char *string;
  string = wPopString();
  wPushNumber(strlen(string));
  wFree(string);
}


x86 assembly (clang, -O0):
<wBasLen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <wPopString@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
call   1050 <wPushNumber@plt>
mov    -0x8(%rbp),%rdi
call   1060 <wFree@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wBasLen>:
push   %rbx
xor    %eax,%eax
call   1030 <wPopString@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
call   1050 <wPushNumber@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1060 <wFree@plt>

LLVM IR (-O0):
define void @wBasLen() {
%1 = alloca i8*
%2 = call i8* (...) @wPopString()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @strlen(i8* %3)
%5 = call i32 @wPushNumber(i32 %4)
%6 = load i8*, i8** %1
%7 = call i32 @wFree(i8* %6)
ret void
}

LLVM IR (-O2):
define void @wBasLen() {
%1 = tail call i8* (...) @wPopString()
%2 = tail call i32 @strlen(i8* %1)
%3 = tail call i32 @wPushNumber(i32 %2)
%4 = tail call i32 @wFree(i8* %1)
ret void
}
unsigned char FDC_GetDataRegister(void) { return 0x0ff; }


x86 assembly (clang, -O0):
<FDC_GetDataRegister>:
push   %rbp
mov    %rsp,%rbp
mov    $0xff,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FDC_GetDataRegister>:
mov    $0xff,%al
ret

LLVM IR (-O0):
define zeroext i8 @FDC_GetDataRegister() {
ret i8 -1
}

LLVM IR (-O2):
define zeroext i8 @FDC_GetDataRegister() {
ret i8 -1
}
void bab(int a, int b) {}


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

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

LLVM IR (-O0):
define void @bab(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @bab(i32 %0, i32 %1) {
ret void
}
void sig_hup(int signo) {}


x86 assembly (clang, -O0):
<sig_hup>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @sig_hup(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ testArray();
int /*<<< orphan*/ testFalse();
int /*<<< orphan*/ testNull();
int /*<<< orphan*/ testNumber();
int /*<<< orphan*/ testObject();
int /*<<< orphan*/ testParse();
int /*<<< orphan*/ testString();
int /*<<< orphan*/ testTrue();
int main() {
  testNull();
  testFalse();
  testTrue();
  testNumber();
  testString();
  testArray();
  testObject();
  testParse();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1090 <testNull@plt>
mov    $0x0,%al
call   1080 <testFalse@plt>
mov    $0x0,%al
call   10a0 <testTrue@plt>
mov    $0x0,%al
call   1040 <testNumber@plt>
mov    $0x0,%al
call   1030 <testString@plt>
mov    $0x0,%al
call   1070 <testArray@plt>
mov    $0x0,%al
call   1050 <testObject@plt>
mov    $0x0,%al
call   1060 <testParse@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1090 <testNull@plt>
xor    %eax,%eax
call   1080 <testFalse@plt>
xor    %eax,%eax
call   10a0 <testTrue@plt>
xor    %eax,%eax
call   1040 <testNumber@plt>
xor    %eax,%eax
call   1030 <testString@plt>
xor    %eax,%eax
call   1070 <testArray@plt>
xor    %eax,%eax
call   1050 <testObject@plt>
xor    %eax,%eax
call   1060 <testParse@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @testNull()
%3 = call i32 (...) @testFalse()
%4 = call i32 (...) @testTrue()
%5 = call i32 (...) @testNumber()
%6 = call i32 (...) @testString()
%7 = call i32 (...) @testArray()
%8 = call i32 (...) @testObject()
%9 = call i32 (...) @testParse()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @testNull()
%2 = tail call i32 (...) @testFalse()
%3 = tail call i32 (...) @testTrue()
%4 = tail call i32 (...) @testNumber()
%5 = tail call i32 (...) @testString()
%6 = tail call i32 (...) @testArray()
%7 = tail call i32 (...) @testObject()
%8 = tail call i32 (...) @testParse()
ret i32 0
}
void clear_bit(unsigned int nr, unsigned long *addr) {
  addr[((nr) / (sizeof(long) * 8))] &= ~(1UL << ((nr) % (sizeof(long) * 8)));
}


x86 assembly (clang, -O0):
<clear_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
and    $0x3f,%rcx
mov    $0x1,%edx
shl    %cl,%rdx
xor    $0xffffffffffffffff,%rdx
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shr    $0x6,%rcx
and    (%rax,%rcx,8),%rdx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_bit>:
mov    %edi,%ecx
mov    %edi,%eax
shr    $0x3,%eax
mov    $0xfffffffffffffffe,%rdx
rol    %cl,%rdx
and    $0xfffffff8,%eax
and    %rdx,(%rsi,%rax,1)
ret

LLVM IR (-O0):
define void @clear_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
store i32 %0, i32* %3
store i64* %1, i64** %4
%5 = load i32, i32* %3
%6 = zext i32 %5 to i64
%7 = urem i64 %6, 64
%8 = shl i64 1, %7
%9 = xor i64 %8, -1
%10 = load i64*, i64** %4
%11 = load i32, i32* %3
%12 = zext i32 %11 to i64
%13 = udiv i64 %12, 64
%14 = getelementptr inbounds i64, i64* %10, i64 %13
%15 = load i64, i64* %14
%16 = and i64 %15, %9
store i64 %16, i64* %14
ret void
}

LLVM IR (-O2):
define void @clear_bit(i32 %0, i64* nocapture %1) {
%3 = zext i32 %0 to i64
%4 = and i64 %3, 63
%5 = shl nuw i64 1, %4
%6 = xor i64 %5, -1
%7 = lshr i64 %3, 6
%8 = getelementptr inbounds i64, i64* %1, i64 %7
%9 = load i64, i64* %8
%10 = and i64 %9, %6
store i64 %10, i64* %8
ret void
}
hexdigit(x) int x;
{ return ((x &= 0x0f) < 10 ? x + '0' : x - 10 + 'A'); }


x86 assembly (clang, -O0):
<hexdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
cmp    $0xa,%eax
jge    1127 <hexdigit+0x27>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x8(%rbp)
jmp    1133 <hexdigit+0x33>
mov    -0x4(%rbp),%eax
sub    $0xa,%eax
add    $0x41,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexdigit>:
and    $0xf,%edi
lea    0x30(%rdi),%ecx
lea    0x37(%rdi),%eax
cmp    $0xa,%edi
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @hexdigit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 15
store i32 %4, i32* %2
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 48
br label %13
9: ; preds = %1
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 10
%12 = add nsw i32 %11, 65
br label %13
13: ; preds = %9, %6
%14 = phi i32 [ %8, %6 ], [ %12, %9 ]
ret i32 %14
}

LLVM IR (-O2):
define i32 @hexdigit(i32 %0) {
%2 = and i32 %0, 15
%3 = icmp ult i32 %2, 10
%4 = or i32 %2, 48
%5 = add nuw nsw i32 %2, 55
%6 = select i1 %3, i32 %4, i32 %5
ret i32 %6
}
int test_imm_D9int32_mem(int *val) {
  return ((*val) & (0xD9 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_D9int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 217
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
char toupper(char);
void strtoupper(char *s) {
  while (*s) {
    *s = toupper(*s);
    s++;
  }
}


x86 assembly (clang, -O0):
<strtoupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114e <strtoupper+0x3e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <strtoupper+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtoupper>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1136 <strtoupper+0x26>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <strtoupper+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @strtoupper(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call signext i8 @toupper(i8 signext %5)
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
int simulated_nested_loop_constant(int p) {
  int k = 0;
  int t = 5;
  int j = 0;
  for (int i = 0; i < 5; i++) {
  B:
    t = 3;
    j++;
    if (j < 100)
      goto B;
  }
  return k;
}


x86 assembly (clang, -O0):
<simulated_nested_loop_constant>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1164 <simulated_nested_loop_constant+0x64>
jmp    1132 <simulated_nested_loop_constant+0x32>
movl   $0x3,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x64,-0x10(%rbp)
jge    1151 <simulated_nested_loop_constant+0x51>
jmp    1132 <simulated_nested_loop_constant+0x32>
jmp    1156 <simulated_nested_loop_constant+0x56>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <simulated_nested_loop_constant+0x23>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @simulated_nested_loop_constant(i32 %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int getc(int /*<<< orphan*/ *);
int fgetc(FILE *fp) { return getc(fp); }


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

x86 assembly (clang, -O2):
<fgetc>:
jmp    1030 <getc@plt>

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

LLVM IR (-O2):
define i32 @fgetc(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
char *readline_with_prompt(const char *prompt,
                           char *(*readline_func)(const char *)) {
  printf("%s: ", prompt);
  return readline_func(prompt);
}


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

x86 assembly (clang, -O2):
<readline_with_prompt>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    *%rax

LLVM IR (-O0):
@.str = [5 x i8] c"%s: \00"
define i8* @readline_with_prompt(i8* %0, i8* (i8*)* %1) {
%3 = alloca i8*
%4 = alloca i8* (i8*)*
store i8* %0, i8** %3
store i8* (i8*)* %1, i8* (i8*)** %4
%5 = load i8*, i8** %3
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8* (i8*)*, i8* (i8*)** %4
%8 = load i8*, i8** %3
%9 = call i8* %7(i8* %8)
ret i8* %9
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s: \00"
define i8* @readline_with_prompt(i8* %0, i8* (i8*)* nocapture %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i8* %1(i8* %0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void aes_encrypt_deinit(void *ctx) { free(ctx); }


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

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

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

LLVM IR (-O2):
define void @aes_encrypt_deinit(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(
      stderr,
      "usage: nl [-p] [-b type] [-d delim] [-f type] [-h type] [-i incr] [-l "
      "num]\n"
      "          [-n format] [-s sep] [-v startnum] [-w width] [file]\n");
  exit(EXIT_FAILURE);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [139 x i8] c"usage: nl [-p] [-b type] [-d delim] [-f type] [-h type] [-i incr] [-l num]\0A [-n format] [-s sep] [-v startnum] [-w width] [file]\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [139 x i8] c"usage: nl [-p] [-b type] [-d delim] [-f type] [-h type] [-i incr] [-l num]\0A [-n format] [-s sep] [-v startnum] [-w width] [file]\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int snprintf(char *, int, char *, char const *);
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
void print_filename(const char *filename) {
  char message_buf[300];
  int res = snprintf(message_buf, 300, "==> %s <==\n", filename);
  write(STDOUT_FILENO, message_buf, res);
}


x86 assembly (clang, -O0):
<print_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x140(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x12c,%esi
lea    0xeba(%rip),%rdx
call   1040 <snprintf@plt>
mov    %eax,-0x144(%rbp)
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
lea    -0x140(%rbp),%rsi
mov    -0x144(%rbp),%edx
call   1030 <write@plt>
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_filename>:
push   %rbx
sub    $0x130,%rsp
mov    %rdi,%rcx
lea    0xece(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x12c,%esi
call   1040 <snprintf@plt>
mov    0x2ea7(%rip),%rcx
mov    (%rcx),%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x130,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"==> %s <==\0A\00"
@STDOUT_FILENO = global i32 0
define void @print_filename(i8* %0) {
%2 = alloca i8*
%3 = alloca [300 x i8]
%4 = alloca i32
store i8* %0, i8** %2
%5 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @snprintf(i8* %5, i32 300, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %6)
store i32 %7, i32* %4
%8 = load i32, i32* @STDOUT_FILENO
%9 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%10 = load i32, i32* %4
%11 = call i32 @write(i32 %8, i8* %9, i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"==> %s <==\0A\00"
@STDOUT_FILENO = global i32 0
define void @print_filename(i8* %0) {
%2 = alloca [300 x i8]
%3 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 300, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = load i32, i32* @STDOUT_FILENO
%6 = call i32 @write(i32 %5, i8* %3, i32 %4)
ret void
}
/* Variables and functions */
int compare_elements_helper(void *base, size_t element_size, int idx1, int idx2,
                            int (*comparer)(const void *, const void *)) {
  char *base_bytes = base;
  return comparer(&base_bytes[idx1 * element_size],
                  &base_bytes[idx2 * element_size]);
}


x86 assembly (clang, -O0):
<compare_elements_helper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rdi
movslq -0x14(%rbp),%rcx
imul   -0x10(%rbp),%rcx
add    %rcx,%rdi
mov    -0x28(%rbp),%rsi
movslq -0x18(%rbp),%rcx
imul   -0x10(%rbp),%rcx
add    %rcx,%rsi
call   *%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_elements_helper>:
movslq %edx,%rax
imul   %rsi,%rax
add    %rdi,%rax
movslq %ecx,%rcx
imul   %rcx,%rsi
add    %rdi,%rsi
mov    %rax,%rdi
jmp    *%r8

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

LLVM IR (-O2):
define i32 @compare_elements_helper(i8* %0, i64 %1, i32 %2, i32 %3, i32 (i8*, i8*)* nocapture %4) {
%6 = sext i32 %2 to i64
%7 = mul i64 %6, %1
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = sext i32 %3 to i64
%10 = mul i64 %9, %1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = tail call i32 %4(i8* %8, i8* %11)
ret i32 %12
}
int bOSHasSSEsupport(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @bOSHasSSEsupport() {
ret i32 0
}

LLVM IR (-O2):
define i32 @bOSHasSSEsupport() {
ret i32 0
}
/* Variables and functions */
size_t cpo_strlcpy(char *, char const *, size_t);
size_t cpo_strlen(char *);
size_t cpo_strlcat(char *dest, const char *src, size_t len) {
  size_t dlen = cpo_strlen(dest);
  return dlen + cpo_strlcpy(dest + dlen, src, (len > dlen ? len - dlen : 0));
}


x86 assembly (clang, -O0):
<cpo_strlcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <cpo_strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jbe    117c <cpo_strlcat+0x5c>
mov    -0x18(%rbp),%rax
sub    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    1187 <cpo_strlcat+0x67>
xor    %eax,%eax
mov    %rax,-0x40(%rbp)
jmp    1187 <cpo_strlcat+0x67>
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rdx
call   1030 <cpo_strlcpy@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
add    %rcx,%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpo_strlcat>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <cpo_strlen@plt>
mov    %rax,%r12
add    %rax,%rbx
xor    %edx,%edx
sub    %rax,%r15
cmovae %r15,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <cpo_strlcpy@plt>
add    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @cpo_strlcat(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = call i64 @cpo_strlen(i8* %8)
store i64 %9, i64* %7
%10 = load i64, i64* %7
%11 = load i8*, i8** %4
%12 = load i64, i64* %7
%13 = getelementptr inbounds i8, i8* %11, i64 %12
%14 = load i8*, i8** %5
%15 = load i64, i64* %6
%16 = load i64, i64* %7
%17 = icmp ugt i64 %15, %16
br i1 %17, label %18, label %22
18: ; preds = %3
%19 = load i64, i64* %6
%20 = load i64, i64* %7
%21 = sub i64 %19, %20
br label %23
22: ; preds = %3
br label %23
23: ; preds = %22, %18
%24 = phi i64 [ %21, %18 ], [ 0, %22 ]
%25 = call i64 @cpo_strlcpy(i8* %13, i8* %14, i64 %24)
%26 = add i64 %10, %25
ret i64 %26
}

LLVM IR (-O2):
define i64 @cpo_strlcat(i8* %0, i8* %1, i64 %2) {
%4 = tail call i64 @cpo_strlen(i8* %0)
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i64 @llvm.usub.sat.i64(i64 %2, i64 %4)
%7 = tail call i64 @cpo_strlcpy(i8* %5, i8* %1, i64 %6)
%8 = add i64 %7, %4
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void stdclrscr(void) { system("clear"); }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
define void @stdclrscr() {
%1 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define void @stdclrscr() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double M_PI;
double sin(double);
double MAP_SINUSOIDAL(double x_n, int iteration) {
  return (2.3 * x_n * x_n * sin(M_PI * x_n));
}


x86 assembly (clang, -O0):
<MAP_SINUSOIDAL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  0xed8(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2eaa(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MAP_SINUSOIDAL>:
push   %rax
movsd  0xee7(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
mov    0x2ebb(%rip),%rax
mulsd  (%rax),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @MAP_SINUSOIDAL(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = load double, double* %3
%6 = fmul double 2.300000e+00, %5
%7 = load double, double* %3
%8 = fmul double %6, %7
%9 = load double, double* @M_PI
%10 = load double, double* %3
%11 = fmul double %9, %10
%12 = call double @sin(double %11)
%13 = fmul double %8, %12
ret double %13
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @MAP_SINUSOIDAL(double %0, i32 %1) {
%3 = fmul double %0, 2.300000e+00
%4 = fmul double %3, %0
%5 = load double, double* @M_PI
%6 = fmul double %5, %0
%7 = tail call double @sin(double %6)
%8 = fmul double %4, %7
ret double %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fun4() { printf("This Fun4 \n"); }


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

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

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

LLVM IR (-O2):
@str = [11 x i8] c"This Fun4 \00"
define void @fun4() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PicoCSettingsHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void PicoCSettingsUpdated() { UAVObjUpdated(PicoCSettingsHandle()); }


x86 assembly (clang, -O0):
<PicoCSettingsUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <PicoCSettingsHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PicoCSettingsUpdated>:
push   %rax
xor    %eax,%eax
call   1030 <PicoCSettingsHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @PicoCSettingsUpdated() {
%1 = call i32 (...) @PicoCSettingsHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @PicoCSettingsUpdated() {
%1 = tail call i32 (...) @PicoCSettingsHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}