xunge/DecIR huggingface dataset:
/* Type definitions */
struct gs_cb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ load_gs_cb(struct gs_cb *);
void restore_gs_cb(struct gs_cb *gs_cb) {
  if (gs_cb)
    load_gs_cb(gs_cb);
}


x86 assembly (clang, -O0):
<restore_gs_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <restore_gs_cb+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <load_gs_cb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<restore_gs_cb>:
test   %rdi,%rdi
je     111a <restore_gs_cb+0xa>
jmp    1030 <load_gs_cb@plt>
ret

LLVM IR (-O0):
%struct.gs_cb = type { i32 }
define void @restore_gs_cb(%struct.gs_cb* %0) {
%2 = alloca %struct.gs_cb*
store %struct.gs_cb* %0, %struct.gs_cb** %2
%3 = load %struct.gs_cb*, %struct.gs_cb** %2
%4 = icmp ne %struct.gs_cb* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load %struct.gs_cb*, %struct.gs_cb** %2
%7 = call i32 @load_gs_cb(%struct.gs_cb* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
%struct.gs_cb = type { i32 }
define void @restore_gs_cb(%struct.gs_cb* %0) {
%2 = icmp eq %struct.gs_cb* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @load_gs_cb(%struct.gs_cb* %0)
br label %5
5: ; preds = %3, %1
ret void
}
int atomic_load_int(int *p) { return __atomic_load_n((p), 0); }


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

x86 assembly (clang, -O2):
<atomic_load_int>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @atomic_load_int(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load atomic i32, i32* %4 monotonic
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @atomic_load_int(i32* nocapture %0) {
%2 = load atomic i32, i32* %0 monotonic
ret i32 %2
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ report_params(int /*<<< orphan*/, int, char **, char **);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[], char *env[]) {
  report_params(stdout, argc, argv, env);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <report_params@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
call   1030 <report_params@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%8 = load i32, i32* @stdout
%9 = load i32, i32* %5
%10 = load i8**, i8*** %6
%11 = load i8**, i8*** %7
%12 = call i32 @report_params(i32 %8, i32 %9, i8** %10, i8** %11)
%13 = load i32, i32* @EXIT_SUCCESS
ret i32 %13
}

LLVM IR (-O2):
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = load i32, i32* @stdout
%5 = tail call i32 @report_params(i32 %4, i32 %0, i8** %1, i8** %2)
%6 = load i32, i32* @EXIT_SUCCESS
ret i32 %6
}
void set_eax(int val) { __asm__ __volatile__("mov %0, %%eax" : : "m"(val)); }


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

x86 assembly (clang, -O2):
<set_eax>:
mov    %edi,-0x4(%rsp)
mov    -0x4(%rsp),%eax
ret

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

LLVM IR (-O2):
define void @set_eax(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}
/* Variables and functions */
int cgi_getnentryint(char const *, int /*<<< orphan*/);
int cgi_getentryint(const char *field_name) {
  return cgi_getnentryint(field_name, 0);
}


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

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

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

LLVM IR (-O2):
define i32 @cgi_getentryint(i8* %0) {
%2 = tail call i32 @cgi_getnentryint(i8* %0, i32 0)
ret i32 %2
}
const char *check_cptr_VSTREAM_PPNchar(const char *v) { return v; }


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

x86 assembly (clang, -O2):
<check_cptr_VSTREAM_PPNchar>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @check_cptr_VSTREAM_PPNchar(i8* readnone returned %0) {
ret i8* %0
}
/* Type definitions */
struct iax_session {
  int dummy;
};

/* Variables and functions */
int send_command(struct iax_session *, int, int, int /*<<< orphan*/,
                 unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strlen(char *);
int iax_send_url(struct iax_session *session, char *url, int link) {
  return send_command(session, 9, link ? 18 : 1, 0, (unsigned char *)url,
                      strlen(url), -1);
}


x86 assembly (clang, -O0):
<iax_send_url>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edx
mov    $0x1,%eax
mov    $0x12,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%r8
mov    %eax,%r9d
mov    $0x9,%esi
xor    %ecx,%ecx
movl   $0xffffffff,(%rsp)
call   1040 <send_command@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iax_send_url>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
test   %edx,%edx
mov    $0x1,%eax
mov    $0x12,%ebp
cmove  %eax,%ebp
mov    %rsi,%rdi
call   1030 <strlen@plt>
movl   $0xffffffff,(%rsp)
mov    %r14,%rdi
mov    $0x9,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
mov    %eax,%r9d
call   1040 <send_command@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.iax_session = type { i32 }
define i32 @iax_send_url(%struct.iax_session* %0, i8* %1, i32 %2) {
%4 = alloca %struct.iax_session*
%5 = alloca i8*
%6 = alloca i32
store %struct.iax_session* %0, %struct.iax_session** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load %struct.iax_session*, %struct.iax_session** %4
%8 = load i32, i32* %6
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 18, i32 1
%12 = load i8*, i8** %5
%13 = load i8*, i8** %5
%14 = call i32 @strlen(i8* %13)
%15 = call i32 @send_command(%struct.iax_session* %7, i32 9, i32 %11, i32 0, i8* %12, i32 %14, i32 -1)
ret i32 %15
}

LLVM IR (-O2):
%struct.iax_session = type { i32 }
define i32 @iax_send_url(%struct.iax_session* %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = select i1 %4, i32 1, i32 18
%6 = tail call i32 @strlen(i8* %1)
%7 = tail call i32 @send_command(%struct.iax_session* %0, i32 9, i32 %5, i32 0, i8* %1, i32 %6, i32 -1)
ret i32 %7
}
/* Type definitions */
struct t_config_option {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fset_buffer_set_title();
void fset_config_change_title_color_cb(const void *pointer, void *data,
                                       struct t_config_option *option) {
  (void)pointer;
  (void)data;
  (void)option;
  fset_buffer_set_title();
}


x86 assembly (clang, -O0):
<fset_config_change_title_color_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <fset_buffer_set_title@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.t_config_option = type { i32 }
define void @fset_config_change_title_color_cb(i8* %0, i8* %1, %struct.t_config_option* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.t_config_option*
store i8* %0, i8** %4
store i8* %1, i8** %5
store %struct.t_config_option* %2, %struct.t_config_option** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load %struct.t_config_option*, %struct.t_config_option** %6
%10 = call i32 (...) @fset_buffer_set_title()
ret void
}

LLVM IR (-O2):
%struct.t_config_option = type { i32 }
define void @fset_config_change_title_color_cb(i8* nocapture readnone %0, i8* nocapture readnone %1, %struct.t_config_option* nocapture readnone %2) {
%4 = tail call i32 (...) @fset_buffer_set_title()
ret void
}
long EOSAIRoundToNearest(float x) {
  if (x + 0.5 > 0)
    return (long)(x + 0.5);
  return (long)(x - 0.5);
}


x86 assembly (clang, -O0):
<EOSAIRoundToNearest>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    114e <EOSAIRoundToNearest+0x4e>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec4(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x8(%rbp)
jmp    116c <EOSAIRoundToNearest+0x6c>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea1(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<EOSAIRoundToNearest>:
cvtss2sd %xmm0,%xmm0
movsd  0xef4(%rip),%xmm1
addsd  %xmm0,%xmm1
addsd  0xef0(%rip),%xmm0
xorpd  %xmm2,%xmm2
cmpltsd %xmm1,%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm1,%xmm2
cvttsd2si %xmm2,%rax
ret

LLVM IR (-O0):
define i64 @EOSAIRoundToNearest(float %0) {
%2 = alloca i64
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fpext float %4 to double
%6 = fadd double %5, 5.000000e-01
%7 = fcmp ogt double %6, 0.000000e+00
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = fadd double %10, 5.000000e-01
%12 = fptosi double %11 to i64
store i64 %12, i64* %2
br label %18
13: ; preds = %1
%14 = load float, float* %3
%15 = fpext float %14 to double
%16 = fsub double %15, 5.000000e-01
%17 = fptosi double %16 to i64
store i64 %17, i64* %2
br label %18
18: ; preds = %13, %8
%19 = load i64, i64* %2
ret i64 %19
}

LLVM IR (-O2):
define i64 @EOSAIRoundToNearest(float %0) {
%2 = fpext float %0 to double
%3 = fadd double %2, 5.000000e-01
%4 = fcmp ogt double %3, 0.000000e+00
%5 = fadd double %2, -5.000000e-01
%6 = select i1 %4, double %3, double %5
%7 = fptosi double %6 to i64
ret i64 %7
}
int median2(int n, int hex) {
  int i = hex;
  while (n % i != n)
    i *= hex;
  return i / hex;
}


x86 assembly (clang, -O0):
<median2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    -0x4(%rbp),%edx
je     112f <median2+0x2f>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1110 <median2+0x10>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<median2>:
mov    %edi,%eax
cltd
idiv   %esi
mov    %esi,%ecx
cmp    %edi,%edx
je     111c <median2+0x1c>
mov    %esi,%ecx
nopl   (%rax)
imul   %esi,%ecx
mov    %edi,%eax
cltd
idiv   %ecx
cmp    %edi,%edx
jne    1110 <median2+0x10>
mov    %ecx,%eax
cltd
idiv   %esi
ret

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

LLVM IR (-O2):
define i32 @median2(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = icmp eq i32 %3, %0
br i1 %4, label %10, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %7, %5 ], [ %1, %2 ]
%7 = mul nsw i32 %6, %1
%8 = srem i32 %0, %7
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %5
10: ; preds = %5, %2
%11 = phi i32 [ %1, %2 ], [ %7, %5 ]
%12 = sdiv i32 %11, %1
ret i32 %12
}
int main() {
  int x;
  int y;
  x = 3;
  y = x++;
  return x + y;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 7
}
/* Variables and functions */
int /*<<< orphan*/ initmagicmoves();
void initMagics() { initmagicmoves(); }


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

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

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

LLVM IR (-O2):
define void @initMagics() {
%1 = tail call i32 (...) @initmagicmoves()
ret void
}
/* Variables and functions */
char *foo(char *, char *);
char *bar(char *first, char *last) {
  int y;
  if (!first)
    return last;
  if (!last)
    return first;
  if (*first == 'a')
    return foo(first, last);
  return 0;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1138 <bar+0x28>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117e <bar+0x6e>
cmpq   $0x0,-0x18(%rbp)
jne    1150 <bar+0x40>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117e <bar+0x6e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jne    1176 <bar+0x66>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <foo@plt>
mov    %rax,-0x8(%rbp)
jmp    117e <bar+0x6e>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
test   %rdi,%rdi
je     112a <bar+0x1a>
test   %rsi,%rsi
je     1124 <bar+0x14>
cmpb   $0x61,(%rdi)
jne    1128 <bar+0x18>
jmp    1030 <foo@plt>
mov    %rdi,%rax
ret
xor    %esi,%esi
mov    %rsi,%rax
ret

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

LLVM IR (-O2):
define i8* @bar(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = icmp eq i8* %1, null
br i1 %5, label %11, label %6
6: ; preds = %4
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 97
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i8* @foo(i8* %0, i8* %1)
br label %11
11: ; preds = %6, %4, %2, %9
%12 = phi i8* [ %10, %9 ], [ %1, %2 ], [ %0, %4 ], [ null, %6 ]
ret i8* %12
}
int comp(const void *p1, const void *p2) {
  return *(long long *)p1 - *(long long *)p2;
}


x86 assembly (clang, -O0):
<comp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<comp>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @comp(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 = bitcast i8* %5 to i64*
%7 = load i64, i64* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i64*
%10 = load i64, i64* %9
%11 = sub nsw i64 %7, %10
%12 = trunc i64 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @comp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = sub nsw i64 %4, %6
%8 = trunc i64 %7 to i32
ret i32 %8
}
/* Variables and functions */
int *counting_sort(int *, int, int);
int *radix_sort(int *vec, int length) {
  int i;
  for (i = 1; i < 100000000; i *= 10) {
    vec = counting_sort(vec, length, i);
  }
  return vec;
}


x86 assembly (clang, -O0):
<radix_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x5f5e100,-0x10(%rbp)
jge    1152 <radix_sort+0x42>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <counting_sort@plt>
mov    %rax,-0x8(%rbp)
imul   $0xa,-0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <radix_sort+0x16>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<radix_sort>:
push   %rbx
mov    %esi,%ebx
mov    $0x1,%edx
call   1030 <counting_sort@plt>
mov    %rax,%rdi
mov    %ebx,%esi
mov    $0xa,%edx
call   1030 <counting_sort@plt>
mov    %rax,%rdi
mov    %ebx,%esi
mov    $0x64,%edx
call   1030 <counting_sort@plt>
mov    %rax,%rdi
mov    %ebx,%esi
mov    $0x3e8,%edx
call   1030 <counting_sort@plt>
mov    %rax,%rdi
mov    %ebx,%esi
mov    $0x2710,%edx
call   1030 <counting_sort@plt>
mov    %rax,%rdi
mov    %ebx,%esi
mov    $0x186a0,%edx
call   1030 <counting_sort@plt>
mov    %rax,%rdi
mov    %ebx,%esi
mov    $0xf4240,%edx
call   1030 <counting_sort@plt>
mov    %rax,%rdi
mov    %ebx,%esi
mov    $0x989680,%edx
pop    %rbx
jmp    1030 <counting_sort@plt>

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

LLVM IR (-O2):
define i32* @radix_sort(i32* %0, i32 %1) {
%3 = tail call i32* @counting_sort(i32* %0, i32 %1, i32 1)
%4 = tail call i32* @counting_sort(i32* %3, i32 %1, i32 10)
%5 = tail call i32* @counting_sort(i32* %4, i32 %1, i32 100)
%6 = tail call i32* @counting_sort(i32* %5, i32 %1, i32 1000)
%7 = tail call i32* @counting_sort(i32* %6, i32 %1, i32 10000)
%8 = tail call i32* @counting_sort(i32* %7, i32 %1, i32 100000)
%9 = tail call i32* @counting_sort(i32* %8, i32 %1, i32 1000000)
%10 = tail call i32* @counting_sort(i32* %9, i32 %1, i32 10000000)
ret i32* %10
}
/* Variables and functions */
int pq_quit_state();
int pq_check(void) { return pq_quit_state(); }


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

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

LLVM IR (-O0):
define i32 @pq_check() {
%1 = call i32 (...) @pq_quit_state()
ret i32 %1
}

LLVM IR (-O2):
define i32 @pq_check() {
%1 = tail call i32 (...) @pq_quit_state()
ret i32 %1
}
int color_offset_f3(int x, int y) {
  return (((y << 10) + (((x << 10) * 185) / 42) - (16412 << 10)) >> 10);
}


x86 assembly (clang, -O0):
<color_offset_f3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0xa,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xa,%eax
imul   $0xb9,%eax,%eax
mov    $0x2a,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
sub    $0x1007000,%eax
sar    $0xa,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<color_offset_f3>:
shl    $0xa,%esi
imul   $0x2e400,%edi,%eax
cltq
imul   $0x30c30c31,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
add    %esi,%eax
add    $0xfeff9000,%eax
sar    $0xa,%eax
ret

LLVM IR (-O0):
define i32 @color_offset_f3(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = shl i32 %5, 10
%7 = load i32, i32* %3
%8 = shl i32 %7, 10
%9 = mul nsw i32 %8, 185
%10 = sdiv i32 %9, 42
%11 = add nsw i32 %6, %10
%12 = sub nsw i32 %11, 16805888
%13 = ashr i32 %12, 10
ret i32 %13
}

LLVM IR (-O2):
define i32 @color_offset_f3(i32 %0, i32 %1) {
%3 = shl i32 %1, 10
%4 = mul i32 %0, 189440
%5 = sdiv i32 %4, 42
%6 = add nsw i32 %5, -16805888
%7 = add i32 %6, %3
%8 = ashr i32 %7, 10
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, unsigned char *, unsigned char);
char *no_extract_pstring(unsigned char *pstring) {
  static char buf[256];
  memcpy(buf, (pstring + 1), *pstring);
  buf[*pstring] = 0;
  return buf;
}


x86 assembly (clang, -O0):
<no_extract_pstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
add    $0x1,%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%al
movzbl %al,%edx
lea    0x2f0c(%rip),%rdi
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,%ecx
lea    0x2ef7(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2eec(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<no_extract_pstring>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x1(%rdi),%rsi
movzbl (%rdi),%edx
lea    0x2f1b(%rip),%r14
mov    %r14,%rdi
call   1030 <memcpy@plt>
movzbl (%rbx),%eax
movb   $0x0,(%rax,%r14,1)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@no_extract_pstring.buf = internal global [256 x i8] zeroinitializer
define i8* @no_extract_pstring(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = call i32 @memcpy(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @no_extract_pstring.buf, i64 0, i64 0), i8* %4, i8 zeroext %6)
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = zext i8 %9 to i64
%11 = getelementptr inbounds [256 x i8], [256 x i8]* @no_extract_pstring.buf, i64 0, i64 %10
store i8 0, i8* %11
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @no_extract_pstring.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@no_extract_pstring.buf = internal global [256 x i8] zeroinitializer
define i8* @no_extract_pstring(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %0
%4 = tail call i32 @memcpy(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @no_extract_pstring.buf, i64 0, i64 0), i8* %2, i8 zeroext %3)
%5 = load i8, i8* %0
%6 = zext i8 %5 to i64
%7 = getelementptr inbounds [256 x i8], [256 x i8]* @no_extract_pstring.buf, i64 0, i64 %6
store i8 0, i8* %7
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @no_extract_pstring.buf, i64 0, i64 0)
}
void filepath_free_strvec(char **pathv) {
  free(pathv[0]);
  free(pathv);
}


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

x86 assembly (clang, -O2):
<filepath_free_strvec>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @filepath_free_strvec(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = load i8**, i8*** %2
%7 = bitcast i8** %6 to i8*
ret void
}

LLVM IR (-O2):
define void @filepath_free_strvec(i8** nocapture %0) {
%2 = load i8*, i8** %0
tail call void @free(i8* %2)
%3 = bitcast i8** %0 to i8*
tail call void @free(i8* %3)
ret void
}
int tsk_set_kas_error(int err) { return err ^ (1 << 14); }


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

x86 assembly (clang, -O2):
<tsk_set_kas_error>:
mov    %edi,%eax
xor    $0x4000,%eax
ret

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

LLVM IR (-O2):
define i32 @tsk_set_kas_error(i32 %0) {
%2 = xor i32 %0, 16384
ret i32 %2
}
unsigned int s5p_get_mpll(unsigned long pllval, unsigned long baseclk) {
  unsigned long mdiv, pdiv, sdiv;
  baseclk /= 1000;
  mdiv = (pllval & (0xff << 16)) >> 16;
  pdiv = (pllval & (0x3f << 8)) >> 8;
  sdiv = (pllval & (0x03 << 0)) >> 0;
  return (baseclk * (mdiv)) / ((pdiv) << sdiv) * 1000;
}


x86 assembly (clang, -O0):
<s5p_get_mpll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0xff0000,%rax
shr    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
and    $0x3f00,%rax
shr    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
and    $0x3,%rax
shr    $0x0,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
shl    %cl,%rdx
mov    %rdx,%rcx
xor    %edx,%edx
div    %rcx
imul   $0x3e8,%rax,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<s5p_get_mpll>:
mov    %rsi,%rax
mov    %rdi,%rcx
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%rdx
9b c4 20
mul    %rdx
shr    $0x4,%rdx
mov    %ecx,%eax
shr    $0x10,%eax
mov    %ecx,%esi
shr    $0x8,%esi
and    $0x3f,%esi
and    $0x3,%cl
shl    %cl,%rsi
movzbl %al,%eax
imul   %rdx,%rax
movabs $0x7fffffff00000000,%rcx
ff ff 7f
test   %rcx,%rax
je     1150 <s5p_get_mpll+0x50>
xor    %edx,%edx
div    %rsi
imul   $0x3e8,%eax,%eax
ret
xor    %edx,%edx
div    %esi
imul   $0x3e8,%eax,%eax
ret

LLVM IR (-O0):
define i32 @s5p_get_mpll(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%8 = load i64, i64* %4
%9 = udiv i64 %8, 1000
store i64 %9, i64* %4
%10 = load i64, i64* %3
%11 = and i64 %10, 16711680
%12 = lshr i64 %11, 16
store i64 %12, i64* %5
%13 = load i64, i64* %3
%14 = and i64 %13, 16128
%15 = lshr i64 %14, 8
store i64 %15, i64* %6
%16 = load i64, i64* %3
%17 = and i64 %16, 3
%18 = lshr i64 %17, 0
store i64 %18, i64* %7
%19 = load i64, i64* %4
%20 = load i64, i64* %5
%21 = mul i64 %19, %20
%22 = load i64, i64* %6
%23 = load i64, i64* %7
%24 = shl i64 %22, %23
%25 = udiv i64 %21, %24
%26 = mul i64 %25, 1000
%27 = trunc i64 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
define i32 @s5p_get_mpll(i64 %0, i64 %1) {
%3 = udiv i64 %1, 1000
%4 = lshr i64 %0, 16
%5 = and i64 %4, 255
%6 = lshr i64 %0, 8
%7 = and i64 %6, 63
%8 = and i64 %0, 3
%9 = mul nuw nsw i64 %3, %5
%10 = shl nuw nsw i64 %7, %8
%11 = udiv i64 %9, %10
%12 = trunc i64 %11 to i32
%13 = mul i32 %12, 1000
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ XStandardColormap;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XStandardColormap(void) {
  XStandardColormap *_p =
      (XStandardColormap *)malloc(sizeof(XStandardColormap));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XStandardColormap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XStandardColormap+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XStandardColormap>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XStandardColormap+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XStandardColormap() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XStandardColormap() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ str_ltrim(char *const);
int /*<<< orphan*/ str_rtrim(char *const);
void str_trim(char *const start) {
  str_ltrim(start);
  str_rtrim(start);
}


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

x86 assembly (clang, -O2):
<str_trim>:
push   %rbx
mov    %rdi,%rbx
call   1040 <str_ltrim@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <str_rtrim@plt>

LLVM IR (-O0):
define void @str_trim(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @str_ltrim(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @str_rtrim(i8* %5)
ret void
}

LLVM IR (-O2):
define void @str_trim(i8* %0) {
%2 = tail call i32 @str_ltrim(i8* %0)
%3 = tail call i32 @str_rtrim(i8* %0)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ *display;
};
typedef TYPE_1__ XButtonReleasedEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
void set_XButtonReleasedEvent_display(void *_p, void *_v) {
  ((XButtonReleasedEvent *)_p)->display = (Display *)_v;
}


x86 assembly (clang, -O0):
<set_XButtonReleasedEvent_display>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XButtonReleasedEvent_display>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32* }
define void @set_XButtonReleasedEvent_display(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to %struct.TYPE_2__*
%9 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %8, i32 0, i32 0
store i32* %6, i32** %9
ret void
}

LLVM IR (-O2):
define void @set_XButtonReleasedEvent_display(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}
int hash(const char *name) {
  int h;
  const char *cp;
  for (cp = name, h = 0; *cp; h = (h << 2) + *cp++)
    ;
  return ((h & 0x7fffffff) % 97);
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <hash+0x4b>
jmp    1129 <hash+0x29>
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <hash+0x17>
mov    -0xc(%rbp),%eax
and    $0x7fffffff,%eax
mov    $0x61,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1142 <hash+0x42>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
lea    (%rcx,%rax,4),%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
and    $0x7fffffff,%eax
imul   $0x51d07eaf,%rax,%rcx
shr    $0x20,%rcx
mov    %eax,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x6,%edx
imul   $0x61,%edx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = phi i32 [ %11, %4 ], [ 0, %1 ]
%8 = shl i32 %7, 2
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = sext i8 %5 to i32
%11 = add nsw i32 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i32 %11, 2147483647
%16 = urem i32 %15, 97
br label %17
17: ; preds = %14, %1
%18 = phi i32 [ 0, %1 ], [ %16, %14 ]
ret i32 %18
}
zz_bind_call_fun_tag(proc, tag) int (*proc)();
struct s_tag *tag;
{
  setaction_exesproc(proc, tag);
  return 1;
}


x86 assembly (clang, -O0):
<zz_bind_call_fun_tag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <setaction_exesproc@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zz_bind_call_fun_tag>:
push   %rax
xor    %eax,%eax
call   1030 <setaction_exesproc@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.s_tag = type opaque
define i32 @zz_bind_call_fun_tag(i32 (...)* %0, %struct.s_tag* %1) {
%3 = alloca i32 (...)*
%4 = alloca %struct.s_tag*
store i32 (...)* %0, i32 (...)** %3
store %struct.s_tag* %1, %struct.s_tag** %4
%5 = load i32 (...)*, i32 (...)** %3
%6 = load %struct.s_tag*, %struct.s_tag** %4
%7 = call i32 (i32 (...)*, %struct.s_tag*, ...) bitcast (i32 (...)* @setaction_exesproc to i32 (i32 (...)*, %struct.s_tag*, ...)*)(i32 (...)* %5, %struct.s_tag* %6)
ret i32 1
}

LLVM IR (-O2):
%struct.s_tag = type opaque
define i32 @zz_bind_call_fun_tag(i32 (...)* %0, %struct.s_tag* %1) {
%3 = tail call i32 (i32 (...)*, %struct.s_tag*, ...) bitcast (i32 (...)* @setaction_exesproc to i32 (i32 (...)*, %struct.s_tag*, ...)*)(i32 (...)* %0, %struct.s_tag* %1)
ret i32 1
}
/* Variables and functions */
int strnlen(const char *s, unsigned int len) {
  int n;
  n = 0;
  while (*s++ && n < len)
    n++;
  return (n);
}


x86 assembly (clang, -O0):
<strnlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     113e <strnlen+0x3e>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
setb   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    114e <strnlen+0x4e>
jmp    115c <strnlen+0x5c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <strnlen+0x12>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnlen>:
xor    %eax,%eax
cmpb   $0x0,(%rdi)
je     111f <strnlen+0x1f>
test   %esi,%esi
je     111f <strnlen+0x1f>
xor    %eax,%eax
nopl   (%rax)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
je     111f <strnlen+0x1f>
cmp    %esi,%eax
jb     1110 <strnlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strnlen(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp ne i8 %3, 0
%5 = icmp ne i32 %1, 0
%6 = and i1 %4, %5
br i1 %6, label %7, label %16
7: ; preds = %2, %7
%8 = phi i32 [ %11, %7 ], [ 0, %2 ]
%9 = phi i8* [ %10, %7 ], [ %0, %2 ]
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = add nuw nsw i32 %8, 1
%12 = load i8, i8* %10
%13 = icmp ne i8 %12, 0
%14 = icmp ult i32 %11, %1
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %7, label %16
16: ; preds = %7, %2
%17 = phi i32 [ 0, %2 ], [ %11, %7 ]
ret i32 %17
}
/* Variables and functions */
int posix_memalign(void **, int, size_t const);
void *spx_memalign_alloc(const size_t size, int *err) {
  void *p = NULL;
  if (0 != (*err = posix_memalign(&p, 8, size))) {
    return NULL;
  }
  return p;
}


x86 assembly (clang, -O0):
<spx_memalign_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdx
lea    -0x20(%rbp),%rdi
mov    $0x8,%esi
call   1030 <posix_memalign@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
cmp    %ecx,%eax
je     1159 <spx_memalign_alloc+0x49>
movq   $0x0,-0x8(%rbp)
jmp    1161 <spx_memalign_alloc+0x51>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spx_memalign_alloc>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%rdx
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x8,%esi
call   1030 <posix_memalign@plt>
mov    %eax,(%rbx)
test   %eax,%eax
jne    1140 <spx_memalign_alloc+0x30>
mov    0x8(%rsp),%rax
jmp    1142 <spx_memalign_alloc+0x32>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @spx_memalign_alloc(i64 %0, i32* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i32 @posix_memalign(i8** %3, i32 8, i64 %0)
store i32 %5, i32* %1
%6 = icmp eq i32 %5, 0
%7 = load i8*, i8** %3
%8 = select i1 %6, i8* %7, i8* null
ret i8* %8
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
size_t strlen(char *);
int /*<<< orphan*/ vsnprintf(char *, size_t, char const *, int /*<<< orphan*/);
size_t ne_vsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
  vsnprintf(str, size, fmt, ap);
  str[size - 1] = '\0';
  return strlen(str);
}


x86 assembly (clang, -O0):
<ne_vsnprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <vsnprintf@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ne_vsnprintf>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <vsnprintf@plt>
movb   $0x0,-0x1(%r14,%rbx,1)
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strlen@plt>

LLVM IR (-O0):
define i64 @ne_vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 @vsnprintf(i8* %9, i64 %10, i8* %11, i32 %12)
%14 = load i8*, i8** %5
%15 = load i64, i64* %6
%16 = sub i64 %15, 1
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 0, i8* %17
%18 = load i8*, i8** %5
%19 = call i64 @strlen(i8* %18)
ret i64 %19
}

LLVM IR (-O2):
define i64 @ne_vsnprintf(i8* nocapture %0, i64 %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 @vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3)
%6 = add i64 %1, -1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 0, i8* %7
%8 = tail call i64 @strlen(i8* dereferenceable(1) %0)
ret i64 %8
}
int test_imm_55uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x55 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_55uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 85
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
double scalarProduct(double *a, double *b) {
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}


x86 assembly (clang, -O0):
<scalarProduct>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<scalarProduct>:
movsd  0x8(%rdi),%xmm0
mulsd  0x8(%rsi),%xmm0
movsd  (%rdi),%xmm1
mulsd  (%rsi),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  0x10(%rsi),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @scalarProduct(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
%10 = load double, double* %9
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = fmul double %13, %16
%18 = call double @llvm.fmuladd.f64(double %7, double %10, double %17)
%19 = load double*, double** %3
%20 = getelementptr inbounds double, double* %19, i64 2
%21 = load double, double* %20
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 2
%24 = load double, double* %23
%25 = call double @llvm.fmuladd.f64(double %21, double %24, double %18)
ret double %25
}

LLVM IR (-O2):
define double @scalarProduct(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fmul double %6, %8
%10 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %9)
%11 = getelementptr inbounds double, double* %0, i64 2
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %10)
ret double %15
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ stdout;
char *ro_fgets(char *str, int n, FILE *stream) {
  if (stream == stdin)
    fflush(stdout);
  return fgets(str, n, stream);
}


x86 assembly (clang, -O0):
<ro_fgets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2eaa(%rip),%rcx
cmp    (%rcx),%rax
jne    1155 <ro_fgets+0x35>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <fgets@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ro_fgets>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    0x2eb4(%rip),%rax
cmp    %rdx,(%rax)
jne    1147 <ro_fgets+0x27>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fgets@plt>

LLVM IR (-O0):
@stdin = global i32* null
@stdout = global i32 0
define i8* @ro_fgets(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32*, i32** %6
%8 = load i32*, i32** @stdin
%9 = icmp eq i32* %7, %8
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i32, i32* @stdout
%12 = call i32 @fflush(i32 %11)
br label %13
13: ; preds = %10, %3
%14 = load i8*, i8** %4
%15 = load i32, i32* %5
%16 = load i32*, i32** %6
%17 = call i8* @fgets(i8* %14, i32 %15, i32* %16)
ret i8* %17
}

LLVM IR (-O2):
@stdin = global i32* null
@stdout = global i32 0
define i8* @ro_fgets(i8* %0, i32 %1, i32* nocapture %2) {
%4 = load i32*, i32** @stdin
%5 = icmp eq i32* %4, %2
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* @stdout
%8 = tail call i32 @fflush(i32 %7)
br label %9
9: ; preds = %6, %3
%10 = tail call i8* @fgets(i8* %0, i32 %1, i32* %2)
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ link_error();
int main() {
  if ("<12ers" + 1 == 0)
    link_error();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}