xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ _crypt_output_magic(char const *, char *, int);
char *_crypt_retval_magic(char *retval, const char *setting, char *output,
                          int size) {
  if (retval)
    return retval;
  if (_crypt_output_magic(setting, output, size))
    return NULL;
  return output;
}


x86 assembly (clang, -O0):
<_crypt_retval_magic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113f <_crypt_retval_magic+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116e <_crypt_retval_magic+0x5e>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <_crypt_output_magic@plt>
cmp    $0x0,%rax
je     1166 <_crypt_retval_magic+0x56>
movq   $0x0,-0x8(%rbp)
jmp    116e <_crypt_retval_magic+0x5e>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_crypt_retval_magic>:
mov    %rdi,%rax
test   %rdi,%rdi
je     1119 <_crypt_retval_magic+0x9>
ret
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %ecx,%edx
call   1030 <_crypt_output_magic@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
cmove  %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @_crypt_retval_magic(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = load i8*, i8** %6
store i8* %13, i8** %5
br label %23
14: ; preds = %4
%15 = load i8*, i8** %7
%16 = load i8*, i8** %8
%17 = load i32, i32* %9
%18 = call i64 @_crypt_output_magic(i8* %15, i8* %16, i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
store i8* null, i8** %5
br label %23
21: ; preds = %14
%22 = load i8*, i8** %8
store i8* %22, i8** %5
br label %23
23: ; preds = %21, %20, %12
%24 = load i8*, i8** %5
ret i8* %24
}

LLVM IR (-O2):
define i8* @_crypt_retval_magic(i8* readnone %0, i8* %1, i8* %2, i32 %3) {
%5 = icmp eq i8* %0, null
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = tail call i64 @_crypt_output_magic(i8* %1, i8* %2, i32 %3)
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* %2, i8* null
br label %10
10: ; preds = %6, %4
%11 = phi i8* [ %0, %4 ], [ %9, %6 ]
ret i8* %11
}
/* Variables and functions */
void *_slab_alloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *_slab_calloc(size_t size) {
  void *ptr;
  if ((ptr = _slab_alloc(size)) == NULL)
    return NULL;
  memset(ptr, 0, size);
  return ptr;
}


x86 assembly (clang, -O0):
<_slab_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <_slab_alloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1150 <_slab_calloc+0x30>
movq   $0x0,-0x8(%rbp)
jmp    1167 <_slab_calloc+0x47>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_slab_calloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <_slab_alloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1141 <_slab_calloc+0x21>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @_slab_calloc(i64 %0) {
%2 = tail call i8* @_slab_alloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
br label %6
6: ; preds = %1, %4
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ __delay_ms(int);
void Delay_ms(unsigned long x) {
  unsigned long i;
  for (i = 0; i < x; i++) {
    __delay_ms(1);
  }
}


x86 assembly (clang, -O0):
<Delay_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    114d <Delay_ms+0x3d>
mov    $0x1,%edi
call   1030 <__delay_ms@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <Delay_ms+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Delay_ms>:
push   %rbx
test   %rdi,%rdi
je     1130 <Delay_ms+0x20>
mov    %rdi,%rbx
nopl   0x0(%rax)
mov    $0x1,%edi
call   1030 <__delay_ms@plt>
add    $0xffffffffffffffff,%rbx
jne    1120 <Delay_ms+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @Delay_ms(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @__delay_ms(i32 1)
%6 = add nuw i64 %4, 1
%7 = icmp eq i64 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Type definitions */
struct gthread_s {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ indent(int);
void gthread_dump(int k, const char *msg, struct gthread_s *gthread) {
  indent(k);
  ;
  indent(k);
  ;
  indent(k);
  ;
  indent(k);
  ;
  indent(k);
  ;
  indent(k);
  ;
}


x86 assembly (clang, -O0):
<gthread_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <indent@plt>
mov    -0x4(%rbp),%edi
call   1030 <indent@plt>
mov    -0x4(%rbp),%edi
call   1030 <indent@plt>
mov    -0x4(%rbp),%edi
call   1030 <indent@plt>
mov    -0x4(%rbp),%edi
call   1030 <indent@plt>
mov    -0x4(%rbp),%edi
call   1030 <indent@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gthread_dump>:
push   %rbx
mov    %edi,%ebx
call   1030 <indent@plt>
mov    %ebx,%edi
call   1030 <indent@plt>
mov    %ebx,%edi
call   1030 <indent@plt>
mov    %ebx,%edi
call   1030 <indent@plt>
mov    %ebx,%edi
call   1030 <indent@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <indent@plt>

LLVM IR (-O0):
%struct.gthread_s = type { i32 }
define void @gthread_dump(i32 %0, i8* %1, %struct.gthread_s* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca %struct.gthread_s*
store i32 %0, i32* %4
store i8* %1, i8** %5
store %struct.gthread_s* %2, %struct.gthread_s** %6
%7 = load i32, i32* %4
%8 = call i32 @indent(i32 %7)
%9 = load i32, i32* %4
%10 = call i32 @indent(i32 %9)
%11 = load i32, i32* %4
%12 = call i32 @indent(i32 %11)
%13 = load i32, i32* %4
%14 = call i32 @indent(i32 %13)
%15 = load i32, i32* %4
%16 = call i32 @indent(i32 %15)
%17 = load i32, i32* %4
%18 = call i32 @indent(i32 %17)
ret void
}

LLVM IR (-O2):
%struct.gthread_s = type { i32 }
define void @gthread_dump(i32 %0, i8* nocapture readnone %1, %struct.gthread_s* nocapture readnone %2) {
%4 = tail call i32 @indent(i32 %0)
%5 = tail call i32 @indent(i32 %0)
%6 = tail call i32 @indent(i32 %0)
%7 = tail call i32 @indent(i32 %0)
%8 = tail call i32 @indent(i32 %0)
%9 = tail call i32 @indent(i32 %0)
ret void
}
/* Type definitions */
struct link {
  int dummy;
};

/* Variables and functions */
struct link *clone(struct link *);
int /*<<< orphan*/ sort(struct link *);
struct link *sorted(struct link *head) {
  struct link *copy = clone(head);
  sort(copy);
  return copy;
}


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

x86 assembly (clang, -O2):
<sorted>:
push   %rbx
call   1030 <clone@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sort@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.link = type { i32 }
define %struct.link* @sorted(%struct.link* %0) {
%2 = alloca %struct.link*
%3 = alloca %struct.link*
store %struct.link* %0, %struct.link** %2
%4 = load %struct.link*, %struct.link** %2
%5 = call %struct.link* @clone(%struct.link* %4)
store %struct.link* %5, %struct.link** %3
%6 = load %struct.link*, %struct.link** %3
%7 = call i32 @sort(%struct.link* %6)
%8 = load %struct.link*, %struct.link** %3
ret %struct.link* %8
}

LLVM IR (-O2):
%struct.link = type { i32 }
define %struct.link* @sorted(%struct.link* %0) {
%2 = tail call %struct.link* @clone(%struct.link* %0)
%3 = tail call i32 @sort(%struct.link* %2)
ret %struct.link* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test(void) { printf("I'm in test3.c\n"); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"I'm in test3.c\0A\00"
define void @test() {
%1 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [15 x i8] c"I'm in test3.c\00"
define void @test() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
float cosf(float);
float sinf(float);
float test(float f) { return sinf(f) + cosf(f); }


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <cosf@plt>
movaps %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
movss  %xmm0,(%rsp)
call   1030 <sinf@plt>
movss  %xmm0,0x4(%rsp)
movss  (%rsp),%xmm0
call   1040 <cosf@plt>
addss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @test(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @sinf(float %3)
%5 = load float, float* %2
%6 = call float @cosf(float %5)
%7 = fadd float %4, %6
ret float %7
}

LLVM IR (-O2):
define float @test(float %0) {
%2 = tail call float @sinf(float %0)
%3 = tail call float @cosf(float %0)
%4 = fadd float %2, %3
ret float %4
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ run_tests();
int main(void) {
  run_tests();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <run_tests@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <run_tests@plt>
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @run_tests()
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @run_tests()
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
__attribute__((always_)) void native_cpuid(unsigned int *eax, unsigned int *ebx,
                                           unsigned int *ecx,
                                           unsigned int *edx) {
  asm("cpuid"
      : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
      : "0"(*eax), "2"(*ecx));
}


x86 assembly (clang, -O0):
<native_cpuid>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%ecx
cpuid
mov    %eax,%r9d
mov    -0x38(%rbp),%rax
mov    %ecx,%esi
mov    -0x30(%rbp),%rcx
mov    %r9d,(%r8)
mov    %ebx,(%rdi)
mov    %esi,(%rcx)
mov    %edx,(%rax)
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<native_cpuid>:
push   %rbx
mov    %rcx,%r8
mov    %rdx,%r9
mov    (%rdi),%eax
mov    (%rdx),%ecx
cpuid
mov    %eax,(%rdi)
mov    %ebx,(%rsi)
mov    %ecx,(%r9)
mov    %edx,(%r8)
pop    %rbx
ret

LLVM IR (-O0):
define void @native_cpuid(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32*, i32** %5
%10 = load i32*, i32** %6
%11 = load i32*, i32** %7
%12 = load i32*, i32** %8
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = load i32*, i32** %7
%16 = load i32, i32* %15
%17 = call { i32, i32, i32, i32 } asm "cpuid", "={ax},={bx},={cx},={dx},0,2,~{dirflag},~{fpsr},~{flags}"(i32 %14, i32 %16)
%18 = extractvalue { i32, i32, i32, i32 } %17, 0
%19 = extractvalue { i32, i32, i32, i32 } %17, 1
%20 = extractvalue { i32, i32, i32, i32 } %17, 2
%21 = extractvalue { i32, i32, i32, i32 } %17, 3
store i32 %18, i32* %9
store i32 %19, i32* %10
store i32 %20, i32* %11
store i32 %21, i32* %12
ret void
}

LLVM IR (-O2):
define void @native_cpuid(i32* nocapture %0, i32* nocapture writeonly %1, i32* nocapture %2, i32* nocapture writeonly %3) {
%5 = load i32, i32* %0
%6 = load i32, i32* %2
%7 = tail call { i32, i32, i32, i32 } asm "cpuid", "={ax},={bx},={cx},={dx},0,2,~{dirflag},~{fpsr},~{flags}"(i32 %5, i32 %6)
%8 = extractvalue { i32, i32, i32, i32 } %7, 0
%9 = extractvalue { i32, i32, i32, i32 } %7, 1
%10 = extractvalue { i32, i32, i32, i32 } %7, 2
%11 = extractvalue { i32, i32, i32, i32 } %7, 3
store i32 %8, i32* %0
store i32 %9, i32* %1
store i32 %10, i32* %2
store i32 %11, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UPnPResponse_RenderingControl_GetBrightness(void *, int);
int /*<<< orphan*/ printf(char *, unsigned int);
void UPnPRenderingControl_GetBrightness(void *upnptoken,
                                        unsigned int InstanceID) {
  printf("Invoke: UPnPRenderingControl_GetBrightness(%u);\r\n", InstanceID);
  UPnPResponse_RenderingControl_GetBrightness(upnptoken, 250);
}


x86 assembly (clang, -O0):
<UPnPRenderingControl_GetBrightness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0xfa,%esi
call   1040 <UPnPResponse_RenderingControl_GetBrightness@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UPnPRenderingControl_GetBrightness>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xfa,%esi
pop    %rbx
jmp    1040 <UPnPResponse_RenderingControl_GetBrightness@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"Invoke: UPnPRenderingControl_GetBrightness(%u);\0D\0A\00"
define void @UPnPRenderingControl_GetBrightness(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %3
%8 = call i32 @UPnPResponse_RenderingControl_GetBrightness(i8* %7, i32 250)
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"Invoke: UPnPRenderingControl_GetBrightness(%u);\0D\0A\00"
define void @UPnPRenderingControl_GetBrightness(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = tail call i32 @UPnPResponse_RenderingControl_GetBrightness(i8* %0, i32 250)
ret void
}
unsigned long hash_sdbm(char *str) {
  unsigned long hash = 0;
  int c;
  if (*str == '\0')
    return hash;
  while (c = *str++)
    hash = c + (hash << 6) + (hash << 16) - hash;
  return hash;
}


x86 assembly (clang, -O0):
<hash_sdbm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    112d <hash_sdbm+0x2d>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117f <hash_sdbm+0x7f>
jmp    1132 <hash_sdbm+0x32>
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     1177 <hash_sdbm+0x77>
movslq -0x1c(%rbp),%rax
mov    -0x18(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
mov    -0x18(%rbp),%rcx
shl    $0x10,%rcx
add    %rcx,%rax
sub    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1132 <hash_sdbm+0x32>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_sdbm>:
mov    (%rdi),%cl
test   %cl,%cl
je     1130 <hash_sdbm+0x30>
add    $0x1,%rdi
xor    %edx,%edx
nopl   0x0(%rax)
movsbq %cl,%rax
imul   $0x10040,%rdx,%rcx
sub    %rdx,%rax
add    %rcx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
mov    %rax,%rdx
test   %cl,%cl
jne    1110 <hash_sdbm+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @hash_sdbm(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i8* %0, i8** %3
store i64 0, i64* %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i64, i64* %4
store i64 %11, i64* %2
br label %32
12: ; preds = %1
br label %13
13: ; preds = %19, %12
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
%16 = load i8, i8* %14
%17 = sext i8 %16 to i32
store i32 %17, i32* %5
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %13
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = load i64, i64* %4
%23 = shl i64 %22, 6
%24 = add i64 %21, %23
%25 = load i64, i64* %4
%26 = shl i64 %25, 16
%27 = add i64 %24, %26
%28 = load i64, i64* %4
%29 = sub i64 %27, %28
store i64 %29, i64* %4
br label %13
30: ; preds = %13
%31 = load i64, i64* %4
store i64 %31, i64* %2
br label %32
32: ; preds = %30, %10
%33 = load i64, i64* %2
ret i64 %33
}

LLVM IR (-O2):
define i64 @hash_sdbm(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %12, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i8 [ %13, %4 ], [ %2, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = sext i8 %7 to i64
%10 = mul i64 %5, 65600
%11 = sub i64 %9, %5
%12 = add i64 %11, %10
%13 = load i8, i8* %8
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i64 [ 0, %1 ], [ %12, %4 ]
ret i64 %16
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
__attribute__((constructor)) void lib_solus_init(void) {
  fprintf(stderr, "WARNING: libsolus is WIP and subject to rapid change\n");
}


x86 assembly (clang, -O0):
<lib_solus_init>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lib_solus_init>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [54 x i8] c"WARNING: libsolus is WIP and subject to rapid change\0A\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @lib_solus_init, i8* null }]
define void @lib_solus_init() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [54 x i8] c"WARNING: libsolus is WIP and subject to rapid change\0A\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @lib_solus_init, i8* null }]
define void @lib_solus_init() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
ret void
}
void f8_1(int *q) {
  if (*q == 1)
    q = 0;
}


x86 assembly (clang, -O0):
<f8_1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x1,(%rax)
jne    111d <f8_1+0x1d>
movq   $0x0,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f8_1(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i32* null, i32** %2
br label %7
7: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @f8_1(i32* nocapture %0) {
ret void
}
/* Variables and functions */
bool secondIsBigger(int first, int second, bool aceIsOne) {
  if (aceIsOne) {
    return second > first;
  } else
    return (second == 1) || ((second > first) && (first != 1));
}


x86 assembly (clang, -O0):
<secondIsBigger>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     112d <secondIsBigger+0x2d>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1168 <secondIsBigger+0x68>
mov    $0x1,%al
cmpl   $0x1,-0xc(%rbp)
mov    %al,-0x11(%rbp)
je     115d <secondIsBigger+0x5d>
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x12(%rbp)
jle    1157 <secondIsBigger+0x57>
cmpl   $0x1,-0x8(%rbp)
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<secondIsBigger>:
test   %edx,%edx
je     110d <secondIsBigger+0xd>
cmp    %edi,%esi
setg   %al
movzbl %al,%eax
ret
cmp    $0x1,%esi
sete   %cl
cmp    %edi,%esi
setg   %dl
cmp    $0x1,%edi
setne  %al
and    %dl,%al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @secondIsBigger(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load i32, i32* %6
%12 = load i32, i32* %5
%13 = icmp sgt i32 %11, %12
%14 = zext i1 %13 to i32
store i32 %14, i32* %4
br label %30
15: ; preds = %3
%16 = load i32, i32* %6
%17 = icmp eq i32 %16, 1
br i1 %17, label %27, label %18
18: ; preds = %15
%19 = load i32, i32* %6
%20 = load i32, i32* %5
%21 = icmp sgt i32 %19, %20
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i32, i32* %5
%24 = icmp ne i32 %23, 1
br label %25
25: ; preds = %22, %18
%26 = phi i1 [ false, %18 ], [ %24, %22 ]
br label %27
27: ; preds = %25, %15
%28 = phi i1 [ true, %15 ], [ %26, %25 ]
%29 = zext i1 %28 to i32
store i32 %29, i32* %4
br label %30
30: ; preds = %27, %10
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
define i32 @secondIsBigger(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = icmp sgt i32 %1, %0
br label %13
7: ; preds = %3
%8 = icmp eq i32 %1, 1
%9 = icmp sgt i32 %1, %0
%10 = icmp ne i32 %0, 1
%11 = and i1 %10, %9
%12 = or i1 %8, %11
br label %13
13: ; preds = %7, %5
%14 = phi i1 [ %6, %5 ], [ %12, %7 ]
%15 = zext i1 %14 to i32
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void hello_world() { assert(1 == 0); }


x86 assembly (clang, -O0):
<hello_world>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hello_world>:
xor    %edi,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @hello_world() {
%1 = call i32 @assert(i32 0)
ret void
}

LLVM IR (-O2):
define void @hello_world() {
%1 = tail call i32 @assert(i32 0)
ret void
}
/* Type definitions */
typedef scalar_t__ int8_t;
typedef scalar_t__ int16_t;

/* Variables and functions */
scalar_t__ INT8_MAX;
scalar_t__ INT8_MIN;
int8_t __hsail_sat_mul_s8(int8_t a, int8_t b) {
  int16_t c = (int16_t)a * (int16_t)b;
  if (c > INT8_MAX)
    return INT8_MAX;
  else if (c < INT8_MIN)
    return INT8_MIN;
  else
    return c;
}


x86 assembly (clang, -O0):
<__hsail_sat_mul_s8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2eb4(%rip),%rcx
cmp    (%rcx),%rax
jle    1140 <__hsail_sat_mul_s8+0x40>
mov    0x2ea4(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    116f <__hsail_sat_mul_s8+0x6f>
mov    -0x20(%rbp),%rax
mov    0x2e9d(%rip),%rcx
cmp    (%rcx),%rax
jge    1167 <__hsail_sat_mul_s8+0x67>
mov    0x2e8d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    116f <__hsail_sat_mul_s8+0x6f>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hsail_sat_mul_s8>:
imul   %rsi,%rdi
mov    0x2ecd(%rip),%rcx
mov    0x2ed6(%rip),%rax
mov    (%rax),%rax
cmp    %rax,%rdi
cmovge %rdi,%rax
mov    (%rcx),%rcx
cmp    %rcx,%rdi
cmovg  %rcx,%rax
ret

LLVM IR (-O0):
@INT8_MAX = global i64 0
@INT8_MIN = global i64 0
define i64 @__hsail_sat_mul_s8(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = mul nsw i64 %7, %8
store i64 %9, i64* %6
%10 = load i64, i64* %6
%11 = load i64, i64* @INT8_MAX
%12 = icmp sgt i64 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i64, i64* @INT8_MAX
store i64 %14, i64* %3
br label %23
15: ; preds = %2
%16 = load i64, i64* %6
%17 = load i64, i64* @INT8_MIN
%18 = icmp slt i64 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = load i64, i64* @INT8_MIN
store i64 %20, i64* %3
br label %23
21: ; preds = %15
%22 = load i64, i64* %6
store i64 %22, i64* %3
br label %23
23: ; preds = %21, %19, %13
%24 = load i64, i64* %3
ret i64 %24
}

LLVM IR (-O2):
@INT8_MAX = global i64 0
@INT8_MIN = global i64 0
define i64 @__hsail_sat_mul_s8(i64 %0, i64 %1) {
%3 = mul nsw i64 %1, %0
%4 = load i64, i64* @INT8_MAX
%5 = icmp sgt i64 %3, %4
%6 = load i64, i64* @INT8_MIN
%7 = icmp slt i64 %3, %6
%8 = select i1 %7, i64 %6, i64 %3
%9 = select i1 %5, i64 %4, i64 %8
ret i64 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float, float);
float fah(float C) {
  float newDegF = (32 + C * 9.00 / 5.00);
  printf("%.2f in degrees Celsius is %.2f in degrees Fahrenheit.\n", C,
         newDegF);
}


x86 assembly (clang, -O0):
<fah>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xee2(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xeba(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fah>:
cvtss2sd %xmm0,%xmm1
mulsd  0xee4(%rip),%xmm1
divsd  0xee4(%rip),%xmm1
addsd  0xee4(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
lea    0xee1(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [56 x i8] c"%.2f in degrees Celsius is %.2f in degrees Fahrenheit.\0A\00"
define float @fah(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %3
%5 = load float, float* %3
%6 = fpext float %5 to double
%7 = fmul double %6, 9.000000e+00
%8 = fdiv double %7, 5.000000e+00
%9 = fadd double 3.200000e+01, %8
%10 = fptrunc double %9 to float
store float %10, float* %4
%11 = load float, float* %3
%12 = load float, float* %4
%13 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), float %11, float %12)
%14 = load float, float* %2
ret float %14
}

LLVM IR (-O2):
@.str = [56 x i8] c"%.2f in degrees Celsius is %.2f in degrees Fahrenheit.\0A\00"
define float @fah(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 9.000000e+00
%4 = fdiv double %3, 5.000000e+00
%5 = fadd double %4, 3.200000e+01
%6 = fptrunc double %5 to float
%7 = tail call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), float %0, float %6)
ret float undef
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
void openLogFile(void **fid) {
  FILE *fptr;
  fptr = fopen("sldemo_lct_fault.log", "wt");
  if (fptr == NULL) {
    printf("Cannot open the file 'sldemo_lct_fault.log'\n");
  }
  *fid = fptr;
}


x86 assembly (clang, -O0):
<openLogFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
lea    0xedb(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115a <openLogFile+0x3a>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openLogFile>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xed2(%rip),%rdi
lea    0xee0(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114e <openLogFile+0x2e>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [21 x i8] c"sldemo_lct_fault.log\00"
@.str.1 = [3 x i8] c"wt\00"
@.str.2 = [45 x i8] c"Cannot open the file 'sldemo_lct_fault.log'\0A\00"
define void @openLogFile(i8** %0) {
%2 = alloca i8**
%3 = alloca i32*
store i8** %0, i8*** %2
%4 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i32*, i32** %3
%11 = bitcast i32* %10 to i8*
%12 = load i8**, i8*** %2
store i8* %11, i8** %12
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"sldemo_lct_fault.log\00"
@.str.1 = [3 x i8] c"wt\00"
@str = [44 x i8] c"Cannot open the file 'sldemo_lct_fault.log'\00"
define void @openLogFile(i8** nocapture writeonly %0) {
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = bitcast i8** %0 to i32**
store i32* %2, i32** %7
ret void
}
/* Variables and functions */
bool is_string(const char *str) { return str && str[0]; }


x86 assembly (clang, -O0):
<is_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1128 <is_string+0x28>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_string>:
xor    %eax,%eax
test   %rdi,%rdi
je     110d <is_string+0xd>
cmpb   $0x0,(%rdi)
setne  %al
ret

LLVM IR (-O0):
define i32 @is_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br label %11
11: ; preds = %5, %1
%12 = phi i1 [ false, %1 ], [ %10, %5 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @is_string(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp ne i8 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %8
}
int quersumme(int x) {
  int sum = 0;
  while (x > 0) {
    sum += x % 10;
    x /= 10;
  }
  return sum;
}


x86 assembly (clang, -O0):
<quersumme>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    113c <quersumme+0x3c>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%edx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <quersumme+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<quersumme>:
xor    %eax,%eax
test   %edi,%edi
jle    112d <quersumme+0x2d>
mov    $0xcccccccd,%r8d
nopl   0x0(%rax)
mov    %edi,%edx
imul   %r8,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edi,%ecx
sub    %esi,%ecx
add    %ecx,%eax
cmp    $0x9,%edi
mov    %edx,%edi
ja     1110 <quersumme+0x10>
ret

LLVM IR (-O0):
define i32 @quersumme(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 sgt i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %2
%9 = srem i32 %8, 10
%10 = load i32, i32* %3
%11 = add nsw i32 %10, %9
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = sdiv i32 %12, 10
store i32 %13, i32* %2
br label %4
14: ; preds = %4
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @quersumme(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %10
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = urem i32 %5, 10
%7 = add nuw nsw i32 %4, %6
%8 = udiv i32 %5, 10
%9 = icmp ult i32 %5, 10
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 *, unsigned char);
void printHexaBin(const char *bin, size_t count) {
  for (; count; count--, bin++)
    printf("%.2x", (unsigned char)*bin);
}


x86 assembly (clang, -O0):
<printHexaBin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115b <printHexaBin+0x4b>
mov    -0x8(%rbp),%rax
lea    0xeca(%rip),%rdi
movzbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1120 <printHexaBin+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printHexaBin>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1146 <printHexaBin+0x36>
mov    %rsi,%r12
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xed4(%rip),%r15
nopl   0x0(%rax)
movzbl (%r14,%rbx,1),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <printHexaBin+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.2x\00"
define void @printHexaBin(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
br label %5
5: ; preds = %12, %2
%6 = load i64, i64* %4
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %10)
br label %12
12: ; preds = %8
%13 = load i64, i64* %4
%14 = add i64 %13, -1
store i64 %14, i64* %4
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %3
br label %5
17: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.2x\00"
define void @printHexaBin(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %9, %4 ], [ %1, %2 ]
%6 = phi i8* [ %10, %4 ], [ %0, %2 ]
%7 = load i8, i8* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %7)
%9 = add i64 %5, -1
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = icmp eq i64 %9, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %2
ret void
}
void glUniform2fv(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glUniform2fv() {
ret void
}
int u_min(int x, int y) { return (x < y) ? x : y; }


x86 assembly (clang, -O0):
<u_min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <u_min+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <u_min+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<u_min>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define i32 @u_min(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 = icmp slt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @u_min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
int find_width(int max, int chunks) {
  int width = 0;
  while (max > chunks) {
    width++;
    max -= chunks;
  }
  if (width == 0)
    return 1;
  else
    return width;
}


x86 assembly (clang, -O0):
<find_width>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1136 <find_width+0x36>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    1111 <find_width+0x11>
cmpl   $0x0,-0x10(%rbp)
jne    114c <find_width+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    1152 <find_width+0x52>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_width>:
mov    $0x1,%eax
cmp    %esi,%edi
jle    1119 <find_width+0x19>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
sub    %esi,%edi
cmp    %esi,%edi
jg     1110 <find_width+0x10>
ret

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

LLVM IR (-O2):
define i32 @find_width(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %4, label %10
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ 0, %2 ]
%6 = phi i32 [ %8, %4 ], [ %0, %2 ]
%7 = add nuw nsw i32 %5, 1
%8 = sub nsw i32 %6, %1
%9 = icmp sgt i32 %8, %1
br i1 %9, label %4, label %10
10: ; preds = %4, %2
%11 = phi i32 [ 1, %2 ], [ %7, %4 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ SDL_DestroyTexture(void *);
void lSDL_Texture_destroy(void *ptr) { SDL_DestroyTexture(ptr); }


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

x86 assembly (clang, -O2):
<lSDL_Texture_destroy>:
jmp    1030 <SDL_DestroyTexture@plt>

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

LLVM IR (-O2):
define void @lSDL_Texture_destroy(i8* %0) {
%2 = tail call i32 @SDL_DestroyTexture(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isfinite(float);
float scalbnf(float, int);
float ldexpf(float value, int exp) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
  if (!isfinite(value) || value == (float)0.0)
    return value;
#pragma GCC diagnostic pop
  value = scalbnf(value, exp);
  return value;
}


x86 assembly (clang, -O0):
<ldexpf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <isfinite@plt>
cmp    $0x0,%eax
je     115a <ldexpf+0x3a>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1169 <ldexpf+0x49>
jp     1169 <ldexpf+0x49>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1185 <ldexpf+0x65>
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1030 <scalbnf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldexpf>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movss  %xmm0,0xc(%rsp)
call   1040 <isfinite@plt>
xorps  %xmm0,%xmm0
movss  0xc(%rsp),%xmm1
ucomiss %xmm0,%xmm1
movaps %xmm1,%xmm0
jne    1145 <ldexpf+0x25>
jnp    1155 <ldexpf+0x35>
test   %eax,%eax
je     1155 <ldexpf+0x35>
mov    %ebx,%edi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <scalbnf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @ldexpf(float %0, i32 %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store float %0, float* %4
store i32 %1, i32* %5
%6 = load float, float* %4
%7 = call i32 @isfinite(float %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load float, float* %4
%11 = fcmp oeq float %10, 0.000000e+00
br i1 %11, label %12, label %14
12: ; preds = %9, %2
%13 = load float, float* %4
store float %13, float* %3
br label %19
14: ; preds = %9
%15 = load float, float* %4
%16 = load i32, i32* %5
%17 = call float @scalbnf(float %15, i32 %16)
store float %17, float* %4
%18 = load float, float* %4
store float %18, float* %3
br label %19
19: ; preds = %14, %12
%20 = load float, float* %3
ret float %20
}

LLVM IR (-O2):
define float @ldexpf(float %0, i32 %1) {
%3 = tail call i32 @isfinite(float %0)
%4 = icmp eq i32 %3, 0
%5 = fcmp oeq float %0, 0.000000e+00
%6 = or i1 %5, %4
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call float @scalbnf(float %0, i32 %1)
br label %9
9: ; preds = %2, %7
%10 = phi float [ %8, %7 ], [ %0, %2 ]
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  while (--argc > 0)
    printf((argc > 1) ? "%s " : "%s\n", *++argv);
  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)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    116d <main+0x5d>
mov    -0x8(%rbp),%ecx
lea    0xec2(%rip),%rdi
lea    0xeb7(%rip),%rax
cmp    $0x1,%ecx
cmovg  %rax,%rdi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rsi
call   1030 <printf@plt>
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     115e <main+0x4e>
mov    %rsi,%rbx
mov    %edi,%ebp
add    $0x8,%rbx
add    $0x1,%ebp
lea    0xed5(%rip),%r14
lea    0xeca(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
cmp    $0x3,%ebp
mov    %r15,%rdi
cmove  %r14,%rdi
mov    (%rbx),%rsi
call   1030 <printf@plt>
add    $0x8,%rbx
add    $0xffffffff,%ebp
cmp    $0x2,%ebp
ja     1140 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s \00"
@.str.1 = [4 x i8] c"%s\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
br label %6
6: ; preds = %10, %2
%7 = load i32, i32* %4
%8 = add nsw i32 %7, -1
store i32 %8, i32* %4
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %6
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
%13 = zext i1 %12 to i64
%14 = select i1 %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i32 1
store i8** %16, i8*** %5
%17 = load i8*, i8** %16
%18 = call i32 @printf(i8* %14, i8* %17)
br label %6
19: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s \00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %14
4: ; preds = %2, %4
%5 = phi i8** [ %10, %4 ], [ %1, %2 ]
%6 = phi i32 [ %7, %4 ], [ %0, %2 ]
%7 = add nsw i32 %6, -1
%8 = icmp eq i32 %6, 2
%9 = select i1 %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
%10 = getelementptr inbounds i8*, i8** %5, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @printf(i8* %9, i8* %11)
%13 = icmp ugt i32 %6, 2
br i1 %13, label %4, label %14
14: ; preds = %4, %2
ret i32 0
}
/* Variables and functions */
int round(double);
int okrug(double x) {
  if (round(x) <= x)
    return round(x);
  else
    return round(x) - 1;
}


x86 assembly (clang, -O0):
<okrug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <round@plt>
cvtsi2sd %eax,%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     114c <okrug+0x3c>
movsd  -0x10(%rbp),%xmm0
call   1030 <round@plt>
mov    %eax,-0x4(%rbp)
jmp    115c <okrug+0x4c>
movsd  -0x10(%rbp),%xmm0
call   1030 <round@plt>
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<okrug>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
call   1030 <round@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <round@plt>
movsd  0x8(%rsp),%xmm0
ucomisd 0x10(%rsp),%xmm0
sbb    $0x0,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @okrug(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = call i32 @round(double %4)
%6 = sitofp i32 %5 to double
%7 = load double, double* %3
%8 = fcmp ole double %6, %7
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load double, double* %3
%11 = call i32 @round(double %10)
store i32 %11, i32* %2
br label %16
12: ; preds = %1
%13 = load double, double* %3
%14 = call i32 @round(double %13)
%15 = sub nsw i32 %14, 1
store i32 %15, i32* %2
br label %16
16: ; preds = %12, %9
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @okrug(double %0) {
%2 = tail call i32 @round(double %0)
%3 = sitofp i32 %2 to double
%4 = fcmp ugt double %3, %0
%5 = tail call i32 @round(double %0)
%6 = sext i1 %4 to i32
%7 = add nsw i32 %5, %6
ret i32 %7
}