xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
extern const char *onig_version(void) {
  static char s[12];
  sprintf(s, "%d.%d.%d", 4, 4, 4);
  return s;
}


x86 assembly (clang, -O0):
<onig_version>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f0e(%rip),%rdi
lea    0xede(%rip),%rsi
mov    $0x4,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1030 <sprintf@plt>
lea    0x2eef(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<onig_version>:
push   %rbx
lea    0x2f11(%rip),%rbx
lea    0xee1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
mov    $0x4,%ecx
mov    $0x4,%r8d
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@onig_version.s = internal global [12 x i8] zeroinitializer
@.str = [9 x i8] c"%d.%d.%d\00"
define i8* @onig_version() {
%1 = call i32 @sprintf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @onig_version.s, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 4, i32 4, i32 4)
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @onig_version.s, i64 0, i64 0)
}

LLVM IR (-O2):
@onig_version.s = internal global [12 x i8] zeroinitializer
@.str = [9 x i8] c"%d.%d.%d\00"
define i8* @onig_version() {
%1 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @onig_version.s, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 4, i32 4, i32 4)
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @onig_version.s, i64 0, i64 0)
}
void delay(int noops) {
  int i;
  for (i = 0; i < noops; i++) {
    __asm("nop");
  }
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1129 <delay+0x29>
nop
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <delay+0xe>
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay>:
test   %edi,%edi
jle    1116 <delay+0x16>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
nop
add    $0xffffffff,%edi
jne    1110 <delay+0x10>
ret

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

LLVM IR (-O2):
define void @delay(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %7
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ 0, %1 ]
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
%5 = add nuw nsw i32 %4, 1
%6 = icmp eq i32 %5, %0
br i1 %6, label %7, label %3
7: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
char *strutil_replace_all(char *, char, char);
int main(void) {
  char *str = "Hezzo, Worzd!";
  char *new = strutil_replace_all(str, 'z', 'l');
  printf("Original:  \"%s\"\n", str);
  printf("Processed: \"%s\"\n", new);
  free(new);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x7a,%esi
mov    $0x6c,%edx
call   1050 <strutil_replace_all@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%r14
mov    %r14,%rdi
mov    $0x7a,%esi
mov    $0x6c,%edx
call   1050 <strutil_replace_all@plt>
mov    %rax,%rbx
lea    0xeb7(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hezzo, Worzd!\00"
@.str.1 = [17 x i8] c"Original: \22%s\22\0A\00"
@.str.2 = [17 x i8] c"Processed: \22%s\22\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strutil_replace_all(i8* %4, i8 signext 122, i8 signext 108)
store i8* %5, i8** %3
%6 = load i8*, i8** %2
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %3
%11 = call i32 @free(i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hezzo, Worzd!\00"
@.str.1 = [17 x i8] c"Original: \22%s\22\0A\00"
@.str.2 = [17 x i8] c"Processed: \22%s\22\0A\00"
define i32 @main() {
%1 = tail call i8* @strutil_replace_all(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8 signext 122, i8 signext 108)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%4 = tail call i32 @free(i8* %1)
ret i32 0
}
char *hash_plugin_summary(void) { return ("phpbb3 \t\tphpBB3 hashes plugin"); }


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

x86 assembly (clang, -O2):
<hash_plugin_summary>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [30 x i8] c"phpbb3 \09\09phpBB3 hashes plugin\00"
define i8* @hash_plugin_summary() {
ret i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [30 x i8] c"phpbb3 \09\09phpBB3 hashes plugin\00"
define i8* @hash_plugin_summary() {
ret i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0)
}
void f1(void *p) { printf("f1():%s\n", p); }


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

x86 assembly (clang, -O2):
<f1>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"f1():%s\0A\00"
define void @f1(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int strspn(char const *, char const *);
char *ltrimstr(const char *str, const char *list) {
  assert(str != NULL);
  if (list == NULL)
    list = " \n\r\t\v\f";
  return (char *)(str + strspn(str, list));
}


x86 assembly (clang, -O0):
<ltrimstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
jne    1158 <ltrimstr+0x38>
lea    0xeac(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strspn@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltrimstr>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
test   %r14,%r14
lea    0xebe(%rip),%rsi
cmovne %r14,%rsi
mov    %rbx,%rdi
call   1030 <strspn@plt>
cltq
add    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c" \0A\0D\09\0B\0C\00"
define i8* @ltrimstr(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i8*, i8** %4
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %4
br label %12
12: ; preds = %11, %2
%13 = load i8*, i8** %3
%14 = load i8*, i8** %3
%15 = load i8*, i8** %4
%16 = call i32 @strspn(i8* %14, i8* %15)
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %13, i64 %17
ret i8* %18
}

LLVM IR (-O2):
@.str = [7 x i8] c" \0A\0D\09\0B\0C\00"
define i8* @ltrimstr(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp eq i8* %1, null
%7 = select i1 %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %1
%8 = tail call i32 @strspn(i8* %0, i8* %7)
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
ret i8* %10
}
int test_arm_ptr_routine(int a) { return a + 1; }


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

x86 assembly (clang, -O2):
<test_arm_ptr_routine>:
lea    0x1(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @test_arm_ptr_routine(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
scalar_t__ fmod(int, int);
int log10(int);
bool isPowerOfThree5(int n) { return fmod(log10(n) / log10(3), 1) == 0; }


x86 assembly (clang, -O0):
<isPowerOfThree5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <log10@plt>
mov    %eax,-0x8(%rbp)
mov    $0x3,%edi
call   1040 <log10@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%edi
mov    $0x1,%esi
call   1030 <fmod@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPowerOfThree5>:
push   %rbx
call   1040 <log10@plt>
mov    %eax,%ebx
mov    $0x3,%edi
call   1040 <log10@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    %eax,%edi
mov    $0x1,%esi
call   1030 <fmod@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isPowerOfThree5(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @log10(i32 %3)
%5 = call i32 @log10(i32 3)
%6 = sdiv i32 %4, %5
%7 = call i64 @fmod(i32 %6, i32 1)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @isPowerOfThree5(i32 %0) {
%2 = tail call i32 @log10(i32 %0)
%3 = tail call i32 @log10(i32 3)
%4 = sdiv i32 %2, %3
%5 = tail call i64 @fmod(i32 %4, i32 1)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: %s\n",
          "inst -s file -d dstdir [-m mode] [-o owner] [-g group] [-c|-C] [-f] "
          "[-q]");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"Usage: %s\0A\00"
@.str.1 = [73 x i8] c"inst -s file -d dstdir [-m mode] [-o owner] [-g group] [-c|-C] [-f] [-q]\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"Usage: %s\0A\00"
@.str.1 = [73 x i8] c"inst -s file -d dstdir [-m mode] [-o owner] [-g group] [-c|-C] [-f] [-q]\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int spi_write(int, int *, int);
int do_bulk_erase(int fd) {
  uint8_t op = 0xC7;
  return spi_write(fd, &op, 1);
}


x86 assembly (clang, -O0):
<do_bulk_erase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xc7,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
mov    $0x1,%edx
call   1030 <spi_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_bulk_erase>:
push   %rax
movl   $0xc7,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x1,%edx
call   1030 <spi_write@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @do_bulk_erase(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 199, i32* %3
%4 = load i32, i32* %2
%5 = call i32 @spi_write(i32 %4, i32* %3, i32 1)
ret i32 %5
}

LLVM IR (-O2):
define i32 @do_bulk_erase(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 199, i32* %2
%4 = call i32 @spi_write(i32 %0, i32* %2, i32 1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void func1(void) { printf("Hello from func1!\n"); }


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

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

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

LLVM IR (-O2):
@str = [18 x i8] c"Hello from func1!\00"
define void @func1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret void
}
float logDrive(int iInput, float iMultiply) {
  return (pow(abs(iInput), iMultiply)) * sgn(iInput);
}


x86 assembly (clang, -O0):
<logDrive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
cvtsi2sd %eax,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
call   1050 <pow@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <sgn@plt>
movsd  -0x10(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logDrive>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
cvtsi2sd %eax,%xmm2
cvtss2sd %xmm0,%xmm1
movapd %xmm2,%xmm0
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <sgn@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @logDrive(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
store i32 %0, i32* %3
store float %1, float* %4
%5 = load i32, i32* %3
%6 = call i32 @abs(i32 %5)
%7 = sitofp i32 %6 to double
%8 = load float, float* %4
%9 = fpext float %8 to double
%10 = call double @pow(double %7, double %9)
%11 = load i32, i32* %3
%12 = call i32 (i32, ...) bitcast (i32 (...)* @sgn to i32 (i32, ...)*)(i32 %11)
%13 = sitofp i32 %12 to double
%14 = fmul double %10, %13
%15 = fptrunc double %14 to float
ret float %15
}

LLVM IR (-O2):
define float @logDrive(i32 %0, float %1) {
%3 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%4 = sitofp i32 %3 to double
%5 = fpext float %1 to double
%6 = tail call double @pow(double %4, double %5)
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @sgn to i32 (i32, ...)*)(i32 %0)
%8 = sitofp i32 %7 to double
%9 = fmul double %6, %8
%10 = fptrunc double %9 to float
ret float %10
}
void INT_Excep_SDHI_SBFAI(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_SDHI_SBFAI() {
ret void
}
int countchar(int x) {
  int j = 0;
  while (x != 0) {
    x = x / 10;
    j++;
  }
  return j;
}


x86 assembly (clang, -O0):
<countchar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1134 <countchar+0x34>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <countchar+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<countchar>:
xor    %eax,%eax
test   %edi,%edi
je     1132 <countchar+0x32>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
add    $0x1,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <countchar+0x10>
ret

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

LLVM IR (-O2):
define i32 @countchar(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = sdiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = add i32 %5, 9
%9 = icmp ult i32 %8, 19
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("\nHello World!\n");
  int i = 10;
  printf("I is: %d", i);
  printf("\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str.1 = [9 x i8] c"I is: %d\00"
@str = [14 x i8] c"\0AHello World!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 10)
%3 = tail call i32 @putchar(i32 10)
ret i32 0
}
/* Variables and functions */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
char *Memory(int length, int size) {
  char *fb;
  fb = (char *)calloc(length, size);
  if (fb == NULL) {
    printf("\nMemory error\n");
    exit(-1);
  };
  return (fb);
}


x86 assembly (clang, -O0):
<Memory>:
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   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116e <Memory+0x3e>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Memory>:
push   %rax
call   1040 <calloc@plt>
test   %rax,%rax
je     113d <Memory+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"\0AMemory error\0A\00"
define i8* @Memory(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i64 @calloc(i32 %6, i32 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@str = [14 x i8] c"\0AMemory error\00"
define i8* @Memory(i32 %0, i32 %1) {
%3 = tail call i64 @calloc(i32 %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
%9 = inttoptr i64 %3 to i8*
ret i8* %9
}
/* Type definitions */
typedef int uint16_t;
typedef scalar_t__ __x;

/* Variables and functions */
uint16_t bswap_16(uint16_t x) {
  uint16_t __x = (x);
  return ((uint16_t)((((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) |
                     (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8)));
}


x86 assembly (clang, -O0):
<bswap_16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bswap_16>:
rol    $0x8,%di
movzwl %di,%eax
ret

LLVM IR (-O0):
define i32 @bswap_16(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = and i32 %5, 255
%7 = shl i32 %6, 8
%8 = load i32, i32* %3
%9 = and i32 %8, 65280
%10 = ashr i32 %9, 8
%11 = or i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @bswap_16(i32 %0) {
%2 = trunc i32 %0 to i16
%3 = tail call i16 @llvm.bswap.i16(i16 %2)
%4 = zext i16 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  printf("Hello World STDOUT.\n");
  fprintf(stderr, "Hello World STDERR.\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"Hello World STDOUT.\0A\00"
@stderr = global i32 0
@.str.1 = [21 x i8] c"Hello World STDERR.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str.1 = [21 x i8] c"Hello World STDERR.\0A\00"
@str = [20 x i8] c"Hello World STDOUT.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
int test1(void) {
  __attribute__((vector_size(16))) int a;
  return a[-1];
}


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

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

LLVM IR (-O0):
define i32 @test1() {
%1 = alloca <4 x i32>
%2 = load <4 x i32>, <4 x i32>* %1
%3 = extractelement <4 x i32> %2, i32 -1
ret i32 %3
}

LLVM IR (-O2):
define i32 @test1() {
ret i32 undef
}
double floor(double x) {
  if (x >= 0) {
    return (double)(long)x;
  } else if (x == (long)x) {
    return x;
  } else {
    return -1.0 * floor(-1 * x) - 1.0;
  }
}


x86 assembly (clang, -O0):
<floor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1144 <floor+0x34>
cvttsd2si -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1199 <floor+0x89>
movsd  -0x10(%rbp),%xmm0
cvttsd2si -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm1
ucomisd %xmm1,%xmm0
jne    1173 <floor+0x63>
jp     1173 <floor+0x63>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1199 <floor+0x89>
movsd  0xe85(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <floor@plt>
movaps %xmm0,%xmm1
movsd  0xe70(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floor>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
cvttsd2si %xmm0,%rax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
jae    1133 <floor+0x23>
ucomisd %xmm0,%xmm1
jne    1138 <floor+0x28>
jp     1138 <floor+0x28>
movapd %xmm0,%xmm1
movapd %xmm1,%xmm0
ret
push   %rax
xorpd  0xebf(%rip),%xmm0
call   1030 <floor@plt>
movsd  0xec2(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @floor(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load double, double* %3
%8 = fptosi double %7 to i64
%9 = sitofp i64 %8 to double
store double %9, double* %2
br label %23
10: ; preds = %1
%11 = load double, double* %3
%12 = load double, double* %3
%13 = fptosi double %12 to i64
%14 = sitofp i64 %13 to double
%15 = fcmp oeq double %11, %14
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = load double, double* %3
store double %17, double* %2
br label %23
18: ; preds = %10
%19 = load double, double* %3
%20 = fmul double -1.000000e+00, %19
%21 = call double @llvm.floor.f64(double %20)
%22 = call double @llvm.fmuladd.f64(double -1.000000e+00, double %21, double -1.000000e+00)
store double %22, double* %2
br label %23
23: ; preds = %18, %16, %6
%24 = load double, double* %2
ret double %24
}

LLVM IR (-O2):
define double @floor(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
%3 = fptosi double %0 to i64
%4 = sitofp i64 %3 to double
br i1 %2, label %5, label %11
5: ; preds = %1
%6 = fcmp oeq double %4, %0
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = fneg double %0
%9 = tail call double @llvm.floor.f64(double %8)
%10 = tail call double @llvm.fmuladd.f64(double %9, double -1.000000e+00, double -1.000000e+00)
br label %11
11: ; preds = %1, %5, %7
%12 = phi double [ %10, %7 ], [ %0, %5 ], [ %4, %1 ]
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void _rq_yc_day_count_mgr_free_func(void *p) { free(p); }


x86 assembly (clang, -O0):
<_rq_yc_day_count_mgr_free_func>:
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):
<_rq_yc_day_count_mgr_free_func>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @_rq_yc_day_count_mgr_free_func(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 @_rq_yc_day_count_mgr_free_func(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
unsigned long _string_hash(const char *str_) {
  char *str = (char *)str_;
  unsigned long hash = 5381;
  int c;
  while ((c = *str++)) {
    hash = ((hash << 5) + hash) + c;
  }
  return hash;
}


x86 assembly (clang, -O0):
<_string_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x1505,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     1152 <_string_hash+0x52>
mov    -0x18(%rbp),%rax
shl    $0x5,%rax
add    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <_string_hash+0x18>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_string_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112d <_string_hash+0x2d>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movsbq %cl,%rax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <_string_hash+0x10>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i64 @_string_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = mul i64 %7, 33
%10 = sext i8 %5 to i64
%11 = add i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
/* Type definitions */
struct world_allocator {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(struct world_allocator *);
void world_allocator_init(struct world_allocator *a) { assert(a); }


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

x86 assembly (clang, -O2):
<world_allocator_init>:
jmp    1030 <assert@plt>

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

LLVM IR (-O2):
%struct.world_allocator = type { i32 }
define void @world_allocator_init(%struct.world_allocator* %0) {
%2 = tail call i32 @assert(%struct.world_allocator* %0)
ret void
}
fne(x) long long int x;
{
  if (x != 0)
    return 13;
  else
    return 140;
}


x86 assembly (clang, -O0):
<fne>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     111f <fne+0x1f>
movl   $0xd,-0x4(%rbp)
jmp    1126 <fne+0x26>
movl   $0x8c,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fne>:
test   %rdi,%rdi
mov    $0x8c,%ecx
mov    $0xd,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fne(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 13, i32* %2
br label %8
7: ; preds = %1
store i32 140, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @fne(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = select i1 %2, i32 140, i32 13
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ togo_argv_init(int, char **);
int /*<<< orphan*/ togo_c_init();
int /*<<< orphan*/ togo_daemon_init();
int /*<<< orphan*/ togo_module_init();
int /*<<< orphan*/ togo_pool_init();
int /*<<< orphan*/ togo_server_init();
void togo_init(int argc, char *argv[]) {
  togo_pool_init();
  togo_argv_init(argc, argv);
  togo_c_init();
  togo_daemon_init();
  togo_module_init();
  togo_server_init();
}


x86 assembly (clang, -O0):
<togo_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <togo_pool_init@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1080 <togo_argv_init@plt>
mov    $0x0,%al
call   1060 <togo_c_init@plt>
mov    $0x0,%al
call   1070 <togo_daemon_init@plt>
mov    $0x0,%al
call   1050 <togo_module_init@plt>
mov    $0x0,%al
call   1030 <togo_server_init@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<togo_init>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <togo_pool_init@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1080 <togo_argv_init@plt>
xor    %eax,%eax
call   1060 <togo_c_init@plt>
xor    %eax,%eax
call   1070 <togo_daemon_init@plt>
xor    %eax,%eax
call   1050 <togo_module_init@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <togo_server_init@plt>

LLVM IR (-O0):
define void @togo_init(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @togo_pool_init()
%6 = load i32, i32* %3
%7 = load i8**, i8*** %4
%8 = call i32 @togo_argv_init(i32 %6, i8** %7)
%9 = call i32 (...) @togo_c_init()
%10 = call i32 (...) @togo_daemon_init()
%11 = call i32 (...) @togo_module_init()
%12 = call i32 (...) @togo_server_init()
ret void
}

LLVM IR (-O2):
define void @togo_init(i32 %0, i8** %1) {
%3 = tail call i32 (...) @togo_pool_init()
%4 = tail call i32 @togo_argv_init(i32 %0, i8** %1)
%5 = tail call i32 (...) @togo_c_init()
%6 = tail call i32 (...) @togo_daemon_init()
%7 = tail call i32 (...) @togo_module_init()
%8 = tail call i32 (...) @togo_server_init()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void TIM8_TRG_COM_TIM14_IRQHandler() {
  default_handler();
}


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

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

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

LLVM IR (-O2):
define weak void @TIM8_TRG_COM_TIM14_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Type definitions */
struct timeval {
  int tv_sec;
  long long tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long long system_time() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return (tv.tv_sec * 1000000) + (tv.tv_usec);
}


x86 assembly (clang, -O0):
<system_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,-0x10(%rbp),%eax
cltq
add    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<system_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq 0x8(%rsp),%rax
imul   $0xf4240,%rax,%rax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i64 @system_time() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000000
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = add nsw i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i64 @system_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add nsw i64 %9, %7
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void __attribute__((constructor)) init(void) { write(1, "1", 1); }


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edx
lea    0xee0(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @init, i8* null }]
define void @init() {
%1 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @init, i8* null }]
define void @init() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
int cmp(void const *e1, void const *e2) {
  int i = *(*((int **)e1));
  int j = *(*((int **)e2));
  if (i < j)
    return -1;
  if (i == j)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    113c <cmp+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    115b <cmp+0x5b>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    1154 <cmp+0x54>
movl   $0x0,-0x4(%rbp)
jmp    115b <cmp+0x5b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
mov    (%rdi),%rax
mov    (%rax),%eax
mov    (%rsi),%rcx
xor    %edx,%edx
cmp    (%rcx),%eax
setne  %dl
mov    $0xffffffff,%eax
cmovge %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32**
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
%6 = bitcast i8* %1 to i32**
%7 = load i32*, i32** %6
%8 = load i32, i32* %7
%9 = icmp slt i32 %5, %8
%10 = icmp ne i32 %5, %8
%11 = zext i1 %10 to i32
%12 = select i1 %9, i32 -1, i32 %11
ret i32 %12
}
int preload(int a) { return a; }


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

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

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

LLVM IR (-O2):
define i32 @preload(i32 returned %0) {
ret i32 %0
}
unsigned round_up(unsigned n, unsigned incr) {
  return n + (incr - n % incr) % incr;
}


x86 assembly (clang, -O0):
<round_up>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    -0x10(%rbp),%eax
sub    %edx,%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    -0xc(%rbp),%eax
add    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_up>:
mov    %edi,%eax
xor    %edx,%edx
div    %esi
mov    %esi,%eax
sub    %edx,%eax
xor    %edx,%edx
div    %esi
lea    (%rdx,%rdi,1),%eax
ret

LLVM IR (-O0):
define i32 @round_up(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 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = urem i32 %7, %8
%10 = sub i32 %6, %9
%11 = load i32, i32* %4
%12 = urem i32 %10, %11
%13 = add i32 %5, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @round_up(i32 %0, i32 %1) {
%3 = urem i32 %0, %1
%4 = sub i32 %1, %3
%5 = urem i32 %4, %1
%6 = add i32 %5, %0
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint_fast32_t;

/* Variables and functions */
int /*<<< orphan*/ mod_mul(int /*<<< orphan*/, int);
uint_fast32_t mod_mul_y(uint_fast32_t a) { return mod_mul(a, 104480); }


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

x86 assembly (clang, -O2):
<mod_mul_y>:
mov    $0x19820,%esi
jmp    1030 <mod_mul@plt>

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

LLVM IR (-O2):
define i32 @mod_mul_y(i32 %0) {
%2 = tail call i32 @mod_mul(i32 %0, i32 104480)
ret i32 %2
}
double EDfabs(double x) {
  if (x > 0.) {
    return (1.);
  } else {
    if (x < 0.) {
      return (-1.);
    } else {
      return (0.);
    }
  }
}


x86 assembly (clang, -O0):
<EDfabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    112d <EDfabs+0x2d>
movsd  0xee5(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1155 <EDfabs+0x55>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    114d <EDfabs+0x4d>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1155 <EDfabs+0x55>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<EDfabs>:
xorpd  %xmm1,%xmm1
movapd %xmm0,%xmm2
cmpltsd %xmm1,%xmm2
movsd  0xeeb(%rip),%xmm3
andpd  %xmm2,%xmm3
cmpltsd %xmm0,%xmm1
movsd  0xee2(%rip),%xmm0
andpd  %xmm1,%xmm0
andnpd %xmm3,%xmm1
orpd   %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @EDfabs(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ogt double %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store double 1.000000e+00, double* %2
br label %12
7: ; preds = %1
%8 = load double, double* %3
%9 = fcmp olt double %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %7
store double -1.000000e+00, double* %2
br label %12
11: ; preds = %7
store double 0.000000e+00, double* %2
br label %12
12: ; preds = %11, %10, %6
%13 = load double, double* %2
ret double %13
}

LLVM IR (-O2):
define double @EDfabs(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
%3 = fcmp olt double %0, 0.000000e+00
%4 = select i1 %3, double -1.000000e+00, double 0.000000e+00
%5 = select i1 %2, double 1.000000e+00, double %4
ret double %5
}
int foo(double a) { return 0; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @foo(double %0) {
ret i32 0
}
int lexer_special_to_code(char c) {
  switch (c) {
  case 'a':
    return 7;
    break;
  case 'b':
    return 8;
    break;
  case 'f':
    return 12;
    break;
  case 'n':
    return 10;
    break;
  case 'r':
    return 13;
    break;
  case 't':
    return 9;
    break;
  case 'v':
    return 11;
    break;
  default:
    return 0;
    break;
  }
}


x86 assembly (clang, -O0):
<lexer_special_to_code>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x15,%eax
ja     1188 <lexer_special_to_code+0x88>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x7,-0x4(%rbp)
jmp    118f <lexer_special_to_code+0x8f>
movl   $0x8,-0x4(%rbp)
jmp    118f <lexer_special_to_code+0x8f>
movl   $0xc,-0x4(%rbp)
jmp    118f <lexer_special_to_code+0x8f>
movl   $0xa,-0x4(%rbp)
jmp    118f <lexer_special_to_code+0x8f>
movl   $0xd,-0x4(%rbp)
jmp    118f <lexer_special_to_code+0x8f>
movl   $0x9,-0x4(%rbp)
jmp    118f <lexer_special_to_code+0x8f>
movl   $0xb,-0x4(%rbp)
jmp    118f <lexer_special_to_code+0x8f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lexer_special_to_code>:
add    $0xffffff9f,%edi
cmp    $0x15,%edi
ja     1123 <lexer_special_to_code+0x23>
mov    $0x7,%eax
lea    0xeec(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x8,%eax
ret
xor    %eax,%eax
ret
mov    $0xc,%eax
ret
mov    $0xa,%eax
ret
mov    $0x9,%eax
ret
mov    $0xb,%eax
ret
mov    $0xd,%eax
ret

LLVM IR (-O0):
define i32 @lexer_special_to_code(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
switch i32 %5, label %13 [
i32 97, label %6
i32 98, label %7
i32 102, label %8
i32 110, label %9
i32 114, label %10
i32 116, label %11
i32 118, label %12
]
6: ; preds = %1
store i32 7, i32* %2
br label %14
7: ; preds = %1
store i32 8, i32* %2
br label %14
8: ; preds = %1
store i32 12, i32* %2
br label %14
9: ; preds = %1
store i32 10, i32* %2
br label %14
10: ; preds = %1
store i32 13, i32* %2
br label %14
11: ; preds = %1
store i32 9, i32* %2
br label %14
12: ; preds = %1
store i32 11, i32* %2
br label %14
13: ; preds = %1
store i32 0, i32* %2
br label %14
14: ; preds = %13, %12, %11, %10, %9, %8, %7, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @lexer_special_to_code(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %9 [
i32 97, label %10
i32 98, label %3
i32 102, label %4
i32 110, label %5
i32 114, label %6
i32 116, label %7
i32 118, label %8
]
3: ; preds = %1
br label %10
4: ; preds = %1
br label %10
5: ; preds = %1
br label %10
6: ; preds = %1
br label %10
7: ; preds = %1
br label %10
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %1, %9, %8, %7, %6, %5, %4, %3
%11 = phi i32 [ 0, %9 ], [ 11, %8 ], [ 9, %7 ], [ 13, %6 ], [ 10, %5 ], [ 12, %4 ], [ 8, %3 ], [ 7, %1 ]
ret i32 %11
}