xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ __emit_expression_range(int /*<<< orphan*/, int);
void test_multiplicative_operators(int lhs, int rhs) {
  __emit_expression_range(0, lhs * rhs);
  __emit_expression_range(0, lhs / rhs);
  __emit_expression_range(0, lhs % rhs);
}


x86 assembly (clang, -O0):
<test_multiplicative_operators>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
imul   -0x8(%rbp),%esi
xor    %edi,%edi
call   1030 <__emit_expression_range@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%esi
xor    %edi,%edi
call   1030 <__emit_expression_range@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%esi
xor    %edi,%edi
call   1030 <__emit_expression_range@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_multiplicative_operators>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
imul   %edi,%esi
xor    %edi,%edi
call   1030 <__emit_expression_range@plt>
mov    %ebp,%eax
cltd
idiv   %ebx
mov    %edx,%ebx
xor    %edi,%edi
mov    %eax,%esi
call   1030 <__emit_expression_range@plt>
xor    %edi,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <__emit_expression_range@plt>

LLVM IR (-O0):
define void @test_multiplicative_operators(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 = mul nsw i32 %5, %6
%8 = call i32 @__emit_expression_range(i32 0, i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = sdiv i32 %9, %10
%12 = call i32 @__emit_expression_range(i32 0, i32 %11)
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = srem i32 %13, %14
%16 = call i32 @__emit_expression_range(i32 0, i32 %15)
ret void
}

LLVM IR (-O2):
define void @test_multiplicative_operators(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = tail call i32 @__emit_expression_range(i32 0, i32 %3)
%5 = sdiv i32 %0, %1
%6 = tail call i32 @__emit_expression_range(i32 0, i32 %5)
%7 = srem i32 %0, %1
%8 = tail call i32 @__emit_expression_range(i32 0, i32 %7)
ret void
}
/* Variables and functions */
scalar_t__ powf(float, int);
float sqrtf(scalar_t__);
float DistanciaEuclideana(float x1, float x2, float y1, float y2) {
  return sqrtf(powf(x1 + x2, 2) + powf(y1 + y2, 2));
}


x86 assembly (clang, -O0):
<DistanciaEuclideana>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <powf@plt>
mov    %rax,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <powf@plt>
mov    -0x18(%rbp),%rdi
add    %rax,%rdi
call   1040 <sqrtf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DistanciaEuclideana>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm3,0xc(%rsp)
movss  %xmm2,0x8(%rsp)
addss  %xmm1,%xmm0
mov    $0x2,%edi
call   1030 <powf@plt>
mov    %rax,%rbx
movss  0x8(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <powf@plt>
add    %rax,%rbx
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <sqrtf@plt>

LLVM IR (-O0):
define float @DistanciaEuclideana(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %6
%11 = fadd float %9, %10
%12 = call i64 @powf(float %11, i32 2)
%13 = load float, float* %7
%14 = load float, float* %8
%15 = fadd float %13, %14
%16 = call i64 @powf(float %15, i32 2)
%17 = add nsw i64 %12, %16
%18 = call float @sqrtf(i64 %17)
ret float %18
}

LLVM IR (-O2):
define float @DistanciaEuclideana(float %0, float %1, float %2, float %3) {
%5 = fadd float %0, %1
%6 = tail call i64 @powf(float %5, i32 2)
%7 = fadd float %2, %3
%8 = tail call i64 @powf(float %7, i32 2)
%9 = add nsw i64 %8, %6
%10 = tail call float @sqrtf(i64 %9)
ret float %10
}
decode_i_p0(int a, int b) { return (a & 0xfff0000f) | 1 << (b + 4); }


x86 assembly (clang, -O0):
<decode_i_p0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfff0000f,%eax
mov    -0x8(%rbp),%ecx
add    $0x4,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_i_p0>:
mov    %edi,%eax
and    $0xfff0000f,%eax
add    $0x4,%sil
bts    %esi,%eax
ret

LLVM IR (-O0):
define i32 @decode_i_p0(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 = and i32 %5, -1048561
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 4
%9 = shl i32 1, %8
%10 = or i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @decode_i_p0(i32 %0, i32 %1) {
%3 = and i32 %0, -1048561
%4 = add nsw i32 %1, 4
%5 = shl nuw i32 1, %4
%6 = or i32 %5, %3
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ mask;
typedef int /*<<< orphan*/ cpu_set_t;

/* Variables and functions */
int /*<<< orphan*/ CPU_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ CPU_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ error(int, int /*<<< orphan*/, char *, int);
scalar_t__ sched_setaffinity(int /*<<< orphan*/, int, int /*<<< orphan*/ *);
int set_cpu(int cpu) {
  cpu_set_t mask;
  CPU_ZERO(&mask);
  CPU_SET(cpu, &mask);
  if (sched_setaffinity(0, sizeof(mask), &mask))
    error(1, 0, "setaffinity %d", cpu);
  return 0;
}


x86 assembly (clang, -O0):
<set_cpu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <CPU_ZERO@plt>
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1060 <CPU_SET@plt>
xor    %edi,%edi
mov    $0x4,%esi
lea    -0x8(%rbp),%rdx
call   1030 <sched_setaffinity@plt>
cmp    $0x0,%rax
je     1190 <set_cpu+0x50>
mov    -0x4(%rbp),%ecx
mov    $0x1,%edi
xor    %esi,%esi
lea    0xe75(%rip),%rdx
call   1050 <error@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_cpu>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <CPU_ZERO@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1060 <CPU_SET@plt>
xor    %edi,%edi
mov    $0x4,%esi
mov    %rbx,%rdx
call   1030 <sched_setaffinity@plt>
test   %rax,%rax
je     1185 <set_cpu+0x45>
lea    0xe89(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
mov    %ebp,%ecx
call   1050 <error@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"setaffinity %d\00"
define i32 @set_cpu(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @CPU_ZERO(i32* %3)
%5 = load i32, i32* %2
%6 = call i32 @CPU_SET(i32 %5, i32* %3)
%7 = call i64 @sched_setaffinity(i32 0, i32 4, i32* %3)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %1
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"setaffinity %d\00"
define i32 @set_cpu(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @CPU_ZERO(i32* %2)
%5 = call i32 @CPU_SET(i32 %0, i32* %2)
%6 = call i64 @sched_setaffinity(i32 0, i32 4, i32* %2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @error(i32 1, i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %10
10: ; preds = %8, %1
ret i32 0
}
/* Variables and functions */
int __uportsys_socket(int, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ errno;
int socket(int domain, int type, int protocol) {
  return __uportsys_socket(domain, type, protocol, &errno);
}


x86 assembly (clang, -O0):
<socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    0x2eaf(%rip),%rcx
call   1030 <__uportsys_socket@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket>:
mov    0x2ec9(%rip),%rcx
jmp    1030 <__uportsys_socket@plt>

LLVM IR (-O0):
@errno = global i32 0
define i32 @socket(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @__uportsys_socket(i32 %7, i32 %8, i32 %9, i32* @errno)
ret i32 %10
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @socket(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @__uportsys_socket(i32 %0, i32 %1, i32 %2, i32* @errno)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_context_suspend_source_by_name() {
  printf("NOT IMPLEMENTED:"
         "pa_context_suspend_source_by_name"
         "\n");
}


x86 assembly (clang, -O0):
<pa_context_suspend_source_by_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [51 x i8] c"NOT IMPLEMENTED:pa_context_suspend_source_by_name\0A\00"
define i32 @pa_context_suspend_source_by_name() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [50 x i8] c"NOT IMPLEMENTED:pa_context_suspend_source_by_name\00"
define i32 @pa_context_suspend_source_by_name() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ colormap;
};
typedef TYPE_1__ XWindowAttributes;

/* Variables and functions */
unsigned long get_XWindowAttributes_colormap(void *_p) {
  return (unsigned long)((XWindowAttributes *)_p)->colormap;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XWindowAttributes_colormap(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XWindowAttributes_colormap(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ perror(char const *);
void udie(const char *prefix) {
  perror(prefix);
  abort();
}


x86 assembly (clang, -O0):
<udie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<udie>:
push   %rax
call   1040 <perror@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @udie(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @udie(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 (...) @abort()
unreachable
}
int utf8isupper(int chr) {
  if (('A' <= chr) && ('Z' >= chr)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<utf8isupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    $0x41,%eax
cmp    -0x8(%rbp),%eax
jg     112f <utf8isupper+0x2f>
mov    $0x5a,%eax
cmp    -0x8(%rbp),%eax
jl     112f <utf8isupper+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1136 <utf8isupper+0x36>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8isupper>:
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @utf8isupper(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 65, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sge i32 90, %7
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @utf8isupper(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ MYSQL;

/* Variables and functions */
int /*<<< orphan*/ mysql_close(int /*<<< orphan*/ *);
void sql_close(void *sql) {
  if (sql) {
    mysql_close((MYSQL *)sql);
  }
}


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

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

LLVM IR (-O0):
define void @sql_close(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 %9
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = bitcast i8* %6 to i32*
%8 = call i32 @mysql_close(i32* %7)
br label %9
9: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @sql_close(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = bitcast i8* %0 to i32*
%5 = tail call i32 @mysql_close(i32* %4)
br label %6
6: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ *wcscat(int /*<<< orphan*/ *, int /*<<< orphan*/ const *);
wchar_t *dvm_wcscat(wchar_t *s1, const wchar_t *s2) { return wcscat(s1, s2); }


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

x86 assembly (clang, -O2):
<dvm_wcscat>:
jmp    1030 <wcscat@plt>

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

LLVM IR (-O2):
define i32* @dvm_wcscat(i32* %0, i32* %1) {
%3 = tail call i32* @wcscat(i32* %0, i32* %1)
ret i32* %3
}
double uOfX_df(double nlC, double lu) {
  return ((2.0 * nlC / (lu - nlC) + 2.0));
}


x86 assembly (clang, -O0):
<uOfX_df>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xeea(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xecf(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<uOfX_df>:
subsd  %xmm0,%xmm1
addsd  %xmm0,%xmm0
divsd  %xmm1,%xmm0
addsd  0xeec(%rip),%xmm0
ret

LLVM IR (-O0):
define double @uOfX_df(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 = fmul double 2.000000e+00, %5
%7 = load double, double* %4
%8 = load double, double* %3
%9 = fsub double %7, %8
%10 = fdiv double %6, %9
%11 = fadd double %10, 2.000000e+00
ret double %11
}

LLVM IR (-O2):
define double @uOfX_df(double %0, double %1) {
%3 = fmul double %0, 2.000000e+00
%4 = fsub double %1, %0
%5 = fdiv double %3, %4
%6 = fadd double %5, 2.000000e+00
ret double %6
}
long long int lmin(long long int a, long long int b) { return a < b ? a : b; }


x86 assembly (clang, -O0):
<lmin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <lmin+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <lmin+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lmin>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @lmin(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @lmin(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int f_blue() { return fputs("[34m", stdout); }


x86 assembly (clang, -O0):
<f_blue>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_blue>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[34m\00"
@stdout = global i32 0
define i32 @f_blue() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[34m\00"
@stdout = global i32 0
define i32 @f_blue() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}
/* Type definitions */
typedef int suseconds_t;
struct timespec {
  int tv_sec;
  int tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
void get_time_us(suseconds_t *tp) {
  struct timespec ts;
  clock_gettime(CLOCK_MONOTONIC, &ts);
  *tp = ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
}


x86 assembly (clang, -O0):
<get_time_us>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
imul   $0xf4240,-0x10(%rbp),%ecx
mov    -0xc(%rbp),%eax
mov    $0x3e8,%esi
cltd
idiv   %esi
add    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time_us>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
imul   $0xf4240,0x8(%rsp),%eax
movslq 0xc(%rsp),%rcx
imul   $0x10624dd3,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
add    %eax,%ecx
mov    %ecx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define void @get_time_us(i32* %0) {
%2 = alloca i32*
%3 = alloca %struct.timespec
store i32* %0, i32** %2
%4 = load i32, i32* @CLOCK_MONOTONIC
%5 = call i32 @clock_gettime(i32 %4, %struct.timespec* %3)
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000000
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
%10 = load i32, i32* %9
%11 = sdiv i32 %10, 1000
%12 = add nsw i32 %8, %11
%13 = load i32*, i32** %2
store i32 %12, i32* %13
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define void @get_time_us(i32* nocapture writeonly %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = load i32, i32* @CLOCK_MONOTONIC
%5 = call i32 @clock_gettime(i32 %4, %struct.timespec* %2)
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000000
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
%10 = load i32, i32* %9
%11 = sdiv i32 %10, 1000
%12 = add nsw i32 %11, %8
store i32 %12, i32* %0
ret void
}
/* Variables and functions */
scalar_t__ floor(float);
float stripe(float x) {
  x -= floor(x);
  return (x < .4999999);
}


x86 assembly (clang, -O0):
<stripe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <floor@plt>
cvtsi2ss %rax,%xmm1
movss  -0x4(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeb5(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2ss %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripe>:
push   %rax
movss  %xmm0,0x4(%rsp)
call   1030 <floor@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  0x4(%rsp),%xmm1
subss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  0xec3(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1148 <stripe+0x38>
xorps  %xmm0,%xmm0
pop    %rax
ret
movss  0xeb8(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @stripe(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @floor(float %3)
%5 = sitofp i64 %4 to float
%6 = load float, float* %2
%7 = fsub float %6, %5
store float %7, float* %2
%8 = load float, float* %2
%9 = fpext float %8 to double
%10 = fcmp olt double %9, 0x3FDFFFFF94A03595
%11 = zext i1 %10 to i32
%12 = sitofp i32 %11 to float
ret float %12
}

LLVM IR (-O2):
define float @stripe(float %0) {
%2 = tail call i64 @floor(float %0)
%3 = sitofp i64 %2 to float
%4 = fsub float %0, %3
%5 = fpext float %4 to double
%6 = fcmp olt double %5, 0x3FDFFFFF94A03595
%7 = uitofp i1 %6 to float
ret float %7
}
void UserStop(void) {}


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

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

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

LLVM IR (-O2):
define void @UserStop() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ OSTimeDlyHMSM(int /*<<< orphan*/, int /*<<< orphan*/, int,
                                 int /*<<< orphan*/);
void MidTask(void *pdata) {
  pdata = pdata;
  while (1) {
    OSTimeDlyHMSM(0, 0, 2, 0);
  }
}


x86 assembly (clang, -O0):
<MidTask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
xor    %ecx,%ecx
mov    $0x2,%edx
mov    %ecx,%edi
mov    %ecx,%esi
call   1030 <OSTimeDlyHMSM@plt>
jmp    1124 <MidTask+0x14>

x86 assembly (clang, -O2):
<MidTask>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
xor    %esi,%esi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1030 <OSTimeDlyHMSM@plt>
jmp    1120 <MidTask+0x10>

LLVM IR (-O0):
define void @MidTask(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
store i8* %3, i8** %2
br label %4
4: ; preds = %1, %4
%5 = call i32 @OSTimeDlyHMSM(i32 0, i32 0, i32 2, i32 0)
br label %4
}

LLVM IR (-O2):
define void @MidTask(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @OSTimeDlyHMSM(i32 0, i32 0, i32 2, i32 0)
br label %2
}
void loc() {
  asm volatile("movq -0x8(%%rbp), %%rax\n\t"
               "popq %%rbx\n\t"
               "addq %%rbx, %%rax\n\t"
               "pushq %%rax\n\t" ::
                   :);
}


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

x86 assembly (clang, -O2):
<loc>:
mov    -0x8(%rbp),%rax
pop    %rbx
add    %rbx,%rax
push   %rax
ret

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

LLVM IR (-O2):
define void @loc() {
tail call void asm sideeffect "movq -0x8(%rbp), %rax\0A\09popq %rbx\0A\09addq %rbx, %rax\0A\09pushq %rax\0A\09", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int _unlink(char const *);
int remove(const char *filename) { return _unlink(filename); }


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

x86 assembly (clang, -O2):
<remove>:
jmp    1030 <_unlink@plt>

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

LLVM IR (-O2):
define i32 @remove(i8* %0) {
%2 = tail call i32 @_unlink(i8* %0)
ret i32 %2
}
/* Variables and functions */
int _memchr(char *);
int _strerror(char *);
int _strstr(char *);
int main(int argc, char *argv[]) {
  int ret = 0;
  (void)argc;
  ret |= _memchr(argv[0]);
  ret |= _strerror(argv[0]);
  ret |= _strstr(argv[0]);
  return (ret == 0) ? 0 : 2;
}


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)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <_memchr@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <_strerror@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <_strstr@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    (%rsi),%rdi
call   1040 <_memchr@plt>
mov    %eax,%r14d
mov    (%rbx),%rdi
call   1050 <_strerror@plt>
mov    %eax,%ebp
or     %r14d,%ebp
mov    (%rbx),%rdi
call   1030 <_strstr@plt>
xor    %ecx,%ecx
or     %ebp,%eax
setne  %cl
add    %ecx,%ecx
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 0
%10 = load i8*, i8** %9
%11 = call i32 @_memchr(i8* %10)
%12 = load i32, i32* %6
%13 = or i32 %12, %11
store i32 %13, i32* %6
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @_strerror(i8* %16)
%18 = load i32, i32* %6
%19 = or i32 %18, %17
store i32 %19, i32* %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 @_strstr(i8* %22)
%24 = load i32, i32* %6
%25 = or i32 %24, %23
store i32 %25, i32* %6
%26 = load i32, i32* %6
%27 = icmp eq i32 %26, 0
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 0, i32 2
ret i32 %29
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @_memchr(i8* %3)
%5 = load i8*, i8** %1
%6 = tail call i32 @_strerror(i8* %5)
%7 = or i32 %6, %4
%8 = load i8*, i8** %1
%9 = tail call i32 @_strstr(i8* %8)
%10 = or i32 %7, %9
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 0, i32 2
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ handle_HUP(int /*<<< orphan*/);
int gen_HUP() { handle_HUP(0); }


x86 assembly (clang, -O0):
<gen_HUP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <handle_HUP@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gen_HUP() {
%1 = alloca i32
%2 = call i32 @handle_HUP(i32 0)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @gen_HUP() {
%1 = tail call i32 @handle_HUP(i32 0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ build_arglist(char *);
int /*<<< orphan*/ pathmod(char *, char *, char *, int);
int /*<<< orphan*/ redirect_in(char *);
int /*<<< orphan*/ redirect_out(int /*<<< orphan*/);
int /*<<< orphan*/ run_command();
void convert_S_to_s(char *path) {
  build_arglist("/usr/lib/cpp");
  redirect_in(path);
  redirect_out(pathmod(path, ".S", ".s", 1));
  run_command();
}


x86 assembly (clang, -O0):
<convert_S_to_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe9d(%rip),%rdi
call   1060 <build_arglist@plt>
mov    -0x8(%rbp),%rdi
call   1050 <redirect_in@plt>
mov    -0x8(%rbp),%rdi
lea    0xe91(%rip),%rsi
lea    0xe8d(%rip),%rdx
mov    $0x1,%ecx
call   1070 <pathmod@plt>
mov    %eax,%edi
call   1030 <redirect_out@plt>
mov    $0x0,%al
call   1040 <run_command@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_S_to_s>:
push   %rbx
mov    %rdi,%rbx
lea    0xea5(%rip),%rdi
call   1060 <build_arglist@plt>
mov    %rbx,%rdi
call   1050 <redirect_in@plt>
lea    0xe9e(%rip),%rsi
lea    0xe9a(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1,%ecx
call   1070 <pathmod@plt>
mov    %eax,%edi
call   1030 <redirect_out@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <run_command@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"/usr/lib/cpp\00"
@.str.1 = [3 x i8] c".S\00"
@.str.2 = [3 x i8] c".s\00"
define void @convert_S_to_s(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @build_arglist(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @redirect_in(i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @pathmod(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 1)
%8 = call i32 @redirect_out(i32 %7)
%9 = call i32 (...) @run_command()
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"/usr/lib/cpp\00"
@.str.1 = [3 x i8] c".S\00"
@.str.2 = [3 x i8] c".s\00"
define void @convert_S_to_s(i8* %0) {
%2 = tail call i32 @build_arglist(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @redirect_in(i8* %0)
%4 = tail call i32 @pathmod(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 1)
%5 = tail call i32 @redirect_out(i32 %4)
%6 = tail call i32 (...) @run_command()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printarr(int arr[], int size) {
  int i;
  for (i = 0; i < size; i++)
    printf("%d ", arr[i]);
  printf("n");
}


x86 assembly (clang, -O0):
<printarr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <printarr+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printarr+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printarr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <printarr+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <printarr+0x20>
mov    $0x6e,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @printarr(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 110)
ret void
}
int test_imm_18int8_reg(signed char val) {
  return ((val) & (0x18 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_18int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0x18,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_18int8_reg>:
test   $0x18,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_18int8_reg(i8 signext %0) {
%2 = and i8 %0, 24
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
float fabs(float a) {
  if (a < 0)
    return -a;
  else
    return a;
}


x86 assembly (clang, -O0):
<fabs>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1132 <fabs+0x32>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    113c <fabs+0x3c>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabs>:
movaps 0xef9(%rip),%xmm2
xorps  %xmm0,%xmm2
xorps  %xmm3,%xmm3
movaps %xmm0,%xmm1
cmpltss %xmm3,%xmm1
andps  %xmm1,%xmm2
andnps %xmm0,%xmm1
orps   %xmm2,%xmm1
movaps %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @fabs(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = fneg float %0
%4 = select i1 %2, float %3, float %0
ret float %4
}
int cpuid_get_byte(int reg, int position, int value) {
  return ((reg >> position) & value);
}


x86 assembly (clang, -O0):
<cpuid_get_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
and    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_get_byte>:
mov    %esi,%ecx
mov    %edi,%eax
sar    %cl,%eax
and    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @cpuid_get_byte(i32 %0, i32 %1, i32 %2) {
%4 = ashr i32 %0, %1
%5 = and i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_context_set_name() {
  printf("NOT IMPLEMENTED:"
         "pa_context_set_name"
         "\n");
}


x86 assembly (clang, -O0):
<pa_context_set_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [37 x i8] c"NOT IMPLEMENTED:pa_context_set_name\0A\00"
define i32 @pa_context_set_name() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [36 x i8] c"NOT IMPLEMENTED:pa_context_set_name\00"
define i32 @pa_context_set_name() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("Hello World from Rebuild environment "
         "host"
         "\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Hello World from Rebuild environment host\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [42 x i8] c"Hello World from Rebuild environment host\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ db(int);
void fprem() {
  db(0xD9);
  db(0xF8);
}


x86 assembly (clang, -O0):
<fprem>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd9,%edi
call   1030 <db@plt>
mov    $0xf8,%edi
call   1030 <db@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprem>:
push   %rax
mov    $0xd9,%edi
call   1030 <db@plt>
mov    $0xf8,%edi
pop    %rax
jmp    1030 <db@plt>

LLVM IR (-O0):
define void @fprem() {
%1 = call i32 @db(i32 217)
%2 = call i32 @db(i32 248)
ret void
}

LLVM IR (-O2):
define void @fprem() {
%1 = tail call i32 @db(i32 217)
%2 = tail call i32 @db(i32 248)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void w977_efm_exit(void) { outb(0xAA, 0x370); }


x86 assembly (clang, -O0):
<w977_efm_exit>:
push   %rbp
mov    %rsp,%rbp
mov    $0xaa,%edi
mov    $0x370,%esi
call   1030 <outb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<w977_efm_exit>:
mov    $0xaa,%edi
mov    $0x370,%esi
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @w977_efm_exit() {
%1 = call i32 @outb(i32 170, i32 880)
ret void
}

LLVM IR (-O2):
define void @w977_efm_exit() {
%1 = tail call i32 @outb(i32 170, i32 880)
ret void
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *file_name(const char *path) {
  const char *found_sep = strrchr(path, '/');
  if (found_sep) {
    return found_sep + 1;
  } else {
    return path;
  }
}


x86 assembly (clang, -O0):
<file_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114a <file_name+0x3a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1152 <file_name+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_name>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @file_name(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
void autoremove_wake_function(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<autoremove_wake_function>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<autoremove_wake_function>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.autoremove_wake_function = [25 x i8] c"autoremove_wake_function\00"
define void @autoremove_wake_function() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @__func__.autoremove_wake_function, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.autoremove_wake_function = [25 x i8] c"autoremove_wake_function\00"
define void @autoremove_wake_function() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @__func__.autoremove_wake_function, i64 0, i64 0))
ret void
}
/* Type definitions */
struct termios {
  int c_cflag;
};
typedef int speed_t;

/* Variables and functions */
int CBAUD;
speed_t cfgetospeed(const struct termios *tio) { return tio->c_cflag & CBAUD; }


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

x86 assembly (clang, -O2):
<cfgetospeed>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
and    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
@CBAUD = global i32 0
define i32 @cfgetospeed(%struct.termios* %0) {
%2 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %2
%3 = load %struct.termios*, %struct.termios** %2
%4 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = load i32, i32* @CBAUD
%7 = and i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@CBAUD = global i32 0
define i32 @cfgetospeed(%struct.termios* nocapture %0) {
%2 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = load i32, i32* @CBAUD
%5 = and i32 %4, %3
ret i32 %5
}
/* Type definitions */
struct BayesSignature {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ destruct_signature(struct BayesSignature *);
struct BayesSignature *new_Signature_s(char *, char *);
int /*<<< orphan*/ print_signature(struct BayesSignature *);
void test2() {
  struct BayesSignature *signature;
  char *signature_directory = "/home/liquid/eclipseworkspace/SignatureMatcher";
  signature = new_Signature_s(signature_directory, "real_signature1");
  print_signature(signature);
  destruct_signature(signature);
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xee1(%rip),%rsi
call   1030 <new_Signature_s@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <print_signature@plt>
mov    -0x8(%rbp),%rdi
call   1050 <destruct_signature@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xef0(%rip),%rsi
call   1030 <new_Signature_s@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <print_signature@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <destruct_signature@plt>

LLVM IR (-O0):
%struct.BayesSignature = type { i32 }
@.str = [47 x i8] c"/home/liquid/eclipseworkspace/SignatureMatcher\00"
@.str.1 = [16 x i8] c"real_signature1\00"
define void @test2() {
%1 = alloca %struct.BayesSignature*
%2 = alloca i8*
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = call %struct.BayesSignature* @new_Signature_s(i8* %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
store %struct.BayesSignature* %4, %struct.BayesSignature** %1
%5 = load %struct.BayesSignature*, %struct.BayesSignature** %1
%6 = call i32 @print_signature(%struct.BayesSignature* %5)
%7 = load %struct.BayesSignature*, %struct.BayesSignature** %1
%8 = call i32 @destruct_signature(%struct.BayesSignature* %7)
ret void
}

LLVM IR (-O2):
%struct.BayesSignature = type { i32 }
@.str = [47 x i8] c"/home/liquid/eclipseworkspace/SignatureMatcher\00"
@.str.1 = [16 x i8] c"real_signature1\00"
define void @test2() {
%1 = tail call %struct.BayesSignature* @new_Signature_s(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @print_signature(%struct.BayesSignature* %1)
%3 = tail call i32 @destruct_signature(%struct.BayesSignature* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ PKCS7_SIGN_ENVELOPE;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
scalar_t__ ASN1_item_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                         int /*<<< orphan*/ *);
int /*<<< orphan*/ PKCS7_SIGN_ENVELOPE_it;
PKCS7_SIGN_ENVELOPE *d2i_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE **a,
                                             const unsigned char **in,
                                             long len) {
  return (PKCS7_SIGN_ENVELOPE *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
                                              &PKCS7_SIGN_ENVELOPE_it);
}


x86 assembly (clang, -O0):
<d2i_PKCS7_SIGN_ENVELOPE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x2eb1(%rip),%rcx
call   1030 <ASN1_item_d2i@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2i_PKCS7_SIGN_ENVELOPE>:
mov    0x2ed1(%rip),%rcx
jmp    1030 <ASN1_item_d2i@plt>

LLVM IR (-O0):
@PKCS7_SIGN_ENVELOPE_it = global i32 0
define i32* @d2i_PKCS7_SIGN_ENVELOPE(i32** %0, i8** %1, i64 %2) {
%4 = alloca i32**
%5 = alloca i8**
%6 = alloca i64
store i32** %0, i32*** %4
store i8** %1, i8*** %5
store i64 %2, i64* %6
%7 = load i32**, i32*** %4
%8 = load i8**, i8*** %5
%9 = load i64, i64* %6
%10 = call i64 @ASN1_item_d2i(i32** %7, i8** %8, i64 %9, i32* @PKCS7_SIGN_ENVELOPE_it)
%11 = inttoptr i64 %10 to i32*
ret i32* %11
}

LLVM IR (-O2):
@PKCS7_SIGN_ENVELOPE_it = global i32 0
define i32* @d2i_PKCS7_SIGN_ENVELOPE(i32** %0, i8** %1, i64 %2) {
%4 = tail call i64 @ASN1_item_d2i(i32** %0, i8** %1, i64 %2, i32* @PKCS7_SIGN_ENVELOPE_it)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
int g5_get_number_of_pipelines(void) { return 4; }


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

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

LLVM IR (-O0):
define i32 @g5_get_number_of_pipelines() {
ret i32 4
}

LLVM IR (-O2):
define i32 @g5_get_number_of_pipelines() {
ret i32 4
}