xunge/DecIR huggingface dataset:
unsigned int sdbm_hash(const char *key) {
  unsigned int h = 0;
  while (*key)
    h = (unsigned char)*key++ + (h << 6) + (h << 16) - h;
  return h;
}


x86 assembly (clang, -O0):
<sdbm_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1149 <sdbm_hash+0x49>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
mov    -0xc(%rbp),%ecx
shl    $0x6,%ecx
add    %ecx,%eax
mov    -0xc(%rbp),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <sdbm_hash+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdbm_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <sdbm_hash+0x27>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movzbl %cl,%ecx
imul   $0x1003f,%eax,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <sdbm_hash+0x10>
ret
xor    %eax,%eax
ret

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

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

/* Variables and functions */
struct RuckSackStringList *rucksack_stringlist_create();
int /*<<< orphan*/ rucksack_stringlist_destroy(struct RuckSackStringList *);
void test_create_destroy(void) {
  struct RuckSackStringList *list = rucksack_stringlist_create();
  rucksack_stringlist_destroy(list);
}


x86 assembly (clang, -O0):
<test_create_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rucksack_stringlist_create@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <rucksack_stringlist_destroy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_create_destroy>:
push   %rax
xor    %eax,%eax
call   1030 <rucksack_stringlist_create@plt>
mov    %rax,%rdi
pop    %rax
jmp    1040 <rucksack_stringlist_destroy@plt>

LLVM IR (-O0):
%struct.RuckSackStringList = type { i32 }
define void @test_create_destroy() {
%1 = alloca %struct.RuckSackStringList*
%2 = call %struct.RuckSackStringList* (...) @rucksack_stringlist_create()
store %struct.RuckSackStringList* %2, %struct.RuckSackStringList** %1
%3 = load %struct.RuckSackStringList*, %struct.RuckSackStringList** %1
%4 = call i32 @rucksack_stringlist_destroy(%struct.RuckSackStringList* %3)
ret void
}

LLVM IR (-O2):
%struct.RuckSackStringList = type { i32 }
define void @test_create_destroy() {
%1 = tail call %struct.RuckSackStringList* (...) @rucksack_stringlist_create()
%2 = tail call i32 @rucksack_stringlist_destroy(%struct.RuckSackStringList* %1)
ret void
}
OP(dd, b8) { op_b8(); }


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <op_b8@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_b8()
ret i32 undef
}
__attribute__((used)) int _read(int file, char *ptr, int len) { return 0; }


x86 assembly (clang, -O0):
<_read>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (i32, i8*, i32)* @_read to i8*)], section "llvm.metadata"
define i32 @_read(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (i32, i8*, i32)* @_read to i8*)], section "llvm.metadata"
define i32 @_read(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
char **array_movetoend(char **element) {
  char **ptr = element;
  while (*(ptr + 1)) {
    *(ptr) = *(ptr + 1);
    ptr++;
  }
  *ptr = *element;
  return ptr;
}


x86 assembly (clang, -O0):
<array_movetoend>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     113f <array_movetoend+0x3f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <array_movetoend+0x10>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_movetoend>:
mov    0x8(%rdi),%rcx
mov    %rdi,%rax
test   %rcx,%rcx
je     1120 <array_movetoend+0x20>
mov    %rdi,%rax
nop
mov    %rcx,(%rax)
mov    0x10(%rax),%rcx
add    $0x8,%rax
test   %rcx,%rcx
jne    1110 <array_movetoend+0x10>
mov    (%rdi),%rcx
mov    %rcx,(%rax)
ret

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

LLVM IR (-O2):
define i8** @array_movetoend(i8** %0) {
%2 = getelementptr inbounds i8*, i8** %0, i64 1
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %12, label %5
5: ; preds = %1, %5
%6 = phi i8* [ %10, %5 ], [ %3, %1 ]
%7 = phi i8** [ %9, %5 ], [ %2, %1 ]
%8 = phi i8** [ %7, %5 ], [ %0, %1 ]
store i8* %6, i8** %8
%9 = getelementptr inbounds i8*, i8** %7, i64 1
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %5
12: ; preds = %5, %1
%13 = phi i8** [ %0, %1 ], [ %7, %5 ]
%14 = load i8*, i8** %0
store i8* %14, i8** %13
ret i8** %13
}
/* Variables and functions */
int /*<<< orphan*/ httpSubsClockMs();
void DoClockMs() { httpSubsClockMs(); }


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

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

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

LLVM IR (-O2):
define void @DoClockMs() {
%1 = tail call i32 (...) @httpSubsClockMs()
ret void
}
/* Variables and functions */
double pow(int, double);
double vapPress(int T) {
  double E;
  E = 6.11 * pow(10, 7.5 * T / (237.7 + T));
  return E;
}


x86 assembly (clang, -O0):
<vapPress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xee8(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xecf(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    $0xa,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xeaa(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vapPress>:
push   %rax
cvtsi2sd %edi,%xmm1
movsd  0xee3(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xedf(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0xa,%edi
call   1030 <pow@plt>
mulsd  0xed1(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @vapPress(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sitofp i32 %4 to double
%6 = fmul double 7.500000e+00, %5
%7 = load i32, i32* %2
%8 = sitofp i32 %7 to double
%9 = fadd double 2.377000e+02, %8
%10 = fdiv double %6, %9
%11 = call double @pow(i32 10, double %10)
%12 = fmul double 6.110000e+00, %11
store double %12, double* %3
%13 = load double, double* %3
ret double %13
}

LLVM IR (-O2):
define double @vapPress(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fmul double %2, 7.500000e+00
%4 = fadd double %2, 2.377000e+02
%5 = fdiv double %3, %4
%6 = tail call double @pow(i32 10, double %5)
%7 = fmul double %6, 6.110000e+00
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ terminal_write(char const *, int /*<<< orphan*/);
void terminal_writestring(const char *data) {
  terminal_write(data, strlen(data));
}


x86 assembly (clang, -O0):
<terminal_writestring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1040 <terminal_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<terminal_writestring>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <terminal_write@plt>

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

LLVM IR (-O2):
define void @terminal_writestring(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @terminal_write(i8* %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SSL_free(void *);
int /*<<< orphan*/ SSL_shutdown(void *);
void __ustream_ssl_session_free(void *ssl) {
  SSL_shutdown(ssl);
  SSL_free(ssl);
}


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

x86 assembly (clang, -O2):
<__ustream_ssl_session_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <SSL_shutdown@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <SSL_free@plt>

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

LLVM IR (-O2):
define void @__ustream_ssl_session_free(i8* %0) {
%2 = tail call i32 @SSL_shutdown(i8* %0)
%3 = tail call i32 @SSL_free(i8* %0)
ret void
}
int is_valid_radius(double r) { return r > 0.0; }


x86 assembly (clang, -O0):
<is_valid_radius>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_valid_radius>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @is_valid_radius(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 0.000000e+00
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @is_valid_radius(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
%3 = zext i1 %2 to i32
ret i32 %3
}
void hostapd_ubus_add_vlan(struct hostapd_data *hapd,
                           struct hostapd_vlan *vlan) {}


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

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

LLVM IR (-O0):
%struct.hostapd_data = type opaque
%struct.hostapd_vlan = type opaque
define void @hostapd_ubus_add_vlan(%struct.hostapd_data* %0, %struct.hostapd_vlan* %1) {
%3 = alloca %struct.hostapd_data*
%4 = alloca %struct.hostapd_vlan*
store %struct.hostapd_data* %0, %struct.hostapd_data** %3
store %struct.hostapd_vlan* %1, %struct.hostapd_vlan** %4
ret void
}

LLVM IR (-O2):
%struct.hostapd_data = type opaque
%struct.hostapd_vlan = type opaque
define void @hostapd_ubus_add_vlan(%struct.hostapd_data* nocapture %0, %struct.hostapd_vlan* nocapture %1) {
ret void
}
/* Type definitions */
struct mg_connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ close_socket_gracefully(struct mg_connection *);
int /*<<< orphan*/ mg_flush(struct mg_connection *);
void close_connection(struct mg_connection *conn) {
  (void)mg_flush(conn);
  close_socket_gracefully(conn);
}


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

x86 assembly (clang, -O2):
<close_connection>:
push   %rbx
mov    %rdi,%rbx
call   1040 <mg_flush@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <close_socket_gracefully@plt>

LLVM IR (-O0):
%struct.mg_connection = type { i32 }
define void @close_connection(%struct.mg_connection* %0) {
%2 = alloca %struct.mg_connection*
store %struct.mg_connection* %0, %struct.mg_connection** %2
%3 = load %struct.mg_connection*, %struct.mg_connection** %2
%4 = call i32 @mg_flush(%struct.mg_connection* %3)
%5 = load %struct.mg_connection*, %struct.mg_connection** %2
%6 = call i32 @close_socket_gracefully(%struct.mg_connection* %5)
ret void
}

LLVM IR (-O2):
%struct.mg_connection = type { i32 }
define void @close_connection(%struct.mg_connection* %0) {
%2 = tail call i32 @mg_flush(%struct.mg_connection* %0)
%3 = tail call i32 @close_socket_gracefully(%struct.mg_connection* %0)
ret void
}
int stack_list_empty(struct Stack *s) {}


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

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

LLVM IR (-O0):
%struct.Stack = type opaque
define i32 @stack_list_empty(%struct.Stack* %0) {
%2 = alloca i32
%3 = alloca %struct.Stack*
store %struct.Stack* %0, %struct.Stack** %3
%4 = load i32, i32* %2
ret i32 %4
}

LLVM IR (-O2):
%struct.Stack = type opaque
define i32 @stack_list_empty(%struct.Stack* nocapture readnone %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ test_tt_db_read_file(char *);
int main() {
  test_tt_db_read_file("test.csv");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"test.csv\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @test_tt_db_read_file(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"test.csv\00"
define i32 @main() {
%1 = tail call i32 @test_tt_db_read_file(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void g_get_system_config_dirs() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_ERROR;
int errno;
int getsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int *);
int hi_get_soerror(int sd) {
  int status, err;
  socklen_t len;
  err = 0;
  len = sizeof(err);
  status = getsockopt(sd, SOL_SOCKET, SO_ERROR, &err, &len);
  if (status == 0) {
    errno = err;
  }
  return status;
}


x86 assembly (clang, -O0):
<hi_get_soerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x4,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
mov    0x2e94(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1030 <getsockopt@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1164 <hi_get_soerror+0x54>
mov    -0xc(%rbp),%ecx
mov    0x2e76(%rip),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hi_get_soerror>:
push   %rax
movl   $0x0,(%rsp)
movl   $0x4,0x4(%rsp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
mov    0x2ea0(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rcx
lea    0x4(%rsp),%r8
call   1030 <getsockopt@plt>
test   %eax,%eax
je     1145 <hi_get_soerror+0x35>
pop    %rcx
ret
mov    (%rsp),%ecx
mov    0x2e89(%rip),%rdx
mov    %ecx,(%rdx)
pop    %rcx
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_ERROR = global i32 0
@errno = global i32 0
define i32 @hi_get_soerror(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %4
store i32 4, i32* %5
%6 = load i32, i32* %2
%7 = load i32, i32* @SOL_SOCKET
%8 = load i32, i32* @SO_ERROR
%9 = call i32 @getsockopt(i32 %6, i32 %7, i32 %8, i32* %4, i32* %5)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = load i32, i32* %4
store i32 %13, i32* @errno
br label %14
14: ; preds = %12, %1
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_ERROR = global i32 0
@errno = global i32 0
define i32 @hi_get_soerror(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %2
store i32 4, i32* %3
%6 = load i32, i32* @SOL_SOCKET
%7 = load i32, i32* @SO_ERROR
%8 = call i32 @getsockopt(i32 %0, i32 %6, i32 %7, i32* %2, i32* %3)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i32, i32* %2
store i32 %11, i32* @errno
br label %12
12: ; preds = %10, %1
ret i32 %8
}
/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
void cmd_mvwin_wch(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}


x86 assembly (clang, -O0):
<cmd_mvwin_wch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    115a <cmd_mvwin_wch+0x2a>
jmp    1170 <cmd_mvwin_wch+0x40>
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xe95(%rip),%rdi
call   1050 <report_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_mvwin_wch>:
push   %rax
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1142 <cmd_mvwin_wch+0x12>
pop    %rax
ret
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xead(%rip),%rdi
pop    %rax
jmp    1050 <report_error@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_mvwin_wch(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = call i32 @check_arg_count(i32 %5, i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %12
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_mvwin_wch(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %5
ret void
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
scalar_t__ timespec_compare(struct timespec, struct timespec);
struct timespec timespec_max(struct timespec a, struct timespec b) {
  return timespec_compare(a, b) < 0 ? b : a;
}


x86 assembly (clang, -O0):
<timespec_max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x10(%rbp)
mov    %esi,-0x18(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <timespec_compare@plt>
cmp    $0x0,%rax
jge    113e <timespec_max+0x2e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <timespec_max+0x34>
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timespec_max>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <timespec_compare@plt>
test   %rax,%rax
cmovs  %ebx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
define i32 @timespec_max(i32 %0, i32 %1) {
%3 = alloca %struct.timespec
%4 = alloca %struct.timespec
%5 = alloca %struct.timespec
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 0
store i32 %0, i32* %6
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
store i32 %1, i32* %7
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 0
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i64 @timespec_compare(i32 %9, i32 %11)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = bitcast %struct.timespec* %3 to i8*
%16 = bitcast %struct.timespec* %5 to i8*
br label %20
17: ; preds = %2
%18 = bitcast %struct.timespec* %3 to i8*
%19 = bitcast %struct.timespec* %4 to i8*
br label %20
20: ; preds = %17, %14
%21 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%22 = load i32, i32* %21
ret i32 %22
}

LLVM IR (-O2):
define i32 @timespec_max(i32 %0, i32 %1) {
%3 = tail call i64 @timespec_compare(i32 %0, i32 %1)
%4 = icmp slt i64 %3, 0
%5 = select i1 %4, i32 %1, i32 %0
ret i32 %5
}
double aa_sign(double val) {
  if (val > 0)
    return 1;
  if (val < 0)
    return -1;
  return 0;
}


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

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

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

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


x86 assembly (clang, -O0):
<offsethash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x2711,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<offsethash>:
movabs $0x346c6e4615f66d33,%rcx
6e 6c 34
mov    %rdi,%rax
imul   %rcx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0xb,%rdx
add    %eax,%edx
imul   $0x2711,%edx,%eax
sub    %eax,%edi
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @offsethash(i64 %0) {
%2 = srem i64 %0, 10001
%3 = trunc i64 %2 to i32
ret i32 %3
}
char parter(char ch) {
  switch (ch) {
  case '}':
    return '{';
  case ')':
    return '(';
  case ']':
    return '[';
  }
  return 0;
}


x86 assembly (clang, -O0):
<parter>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x29,%eax
je     114a <parter+0x4a>
jmp    111f <parter+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x5d,%eax
je     1153 <parter+0x53>
jmp    1130 <parter+0x30>
mov    -0x8(%rbp),%eax
sub    $0x7d,%eax
jne    115c <parter+0x5c>
jmp    1141 <parter+0x41>
movb   $0x7b,-0x1(%rbp)
jmp    1160 <parter+0x60>
movb   $0x28,-0x1(%rbp)
jmp    1160 <parter+0x60>
movb   $0x5b,-0x1(%rbp)
jmp    1160 <parter+0x60>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parter>:
cmp    $0x7d,%edi
je     1112 <parter+0x12>
cmp    $0x5d,%edi
je     1115 <parter+0x15>
cmp    $0x29,%edi
jne    1118 <parter+0x18>
mov    $0x28,%al
ret
mov    $0x7b,%al
ret
mov    $0x5b,%al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define signext i8 @parter(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %9 [
i32 125, label %6
i32 41, label %7
i32 93, label %8
]
6: ; preds = %1
store i8 123, i8* %2
br label %10
7: ; preds = %1
store i8 40, i8* %2
br label %10
8: ; preds = %1
store i8 91, i8* %2
br label %10
9: ; preds = %1
store i8 0, i8* %2
br label %10
10: ; preds = %9, %8, %7, %6
%11 = load i8, i8* %2
ret i8 %11
}

LLVM IR (-O2):
define signext i8 @parter(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %5 [
i32 125, label %6
i32 41, label %3
i32 93, label %4
]
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3
%7 = phi i8 [ 0, %5 ], [ 91, %4 ], [ 40, %3 ], [ 123, %1 ]
ret i8 %7
}
/* Variables and functions */
int LZ4_decompress_safe(char const *, char *, int, int);
int LZ4_uncompress_unknownOutputSize(const char *source, char *dest, int isize,
                                     int maxOutputSize) {
  return LZ4_decompress_safe(source, dest, isize, maxOutputSize);
}


x86 assembly (clang, -O0):
<LZ4_uncompress_unknownOutputSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1030 <LZ4_decompress_safe@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LZ4_uncompress_unknownOutputSize>:
jmp    1030 <LZ4_decompress_safe@plt>

LLVM IR (-O0):
define i32 @LZ4_uncompress_unknownOutputSize(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @LZ4_decompress_safe(i8* %9, i8* %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @LZ4_uncompress_unknownOutputSize(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @LZ4_decompress_safe(i8* %0, i8* %1, i32 %2, i32 %3)
ret i32 %5
}
/* Type definitions */
struct parameters {
  int dummy;
};

/* Variables and functions */
double chi_13(struct parameters *);
double chi_31(struct parameters *p) { return chi_13(p); }


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

x86 assembly (clang, -O2):
<chi_31>:
jmp    1030 <chi_13@plt>

LLVM IR (-O0):
%struct.parameters = type { i32 }
define double @chi_31(%struct.parameters* %0) {
%2 = alloca %struct.parameters*
store %struct.parameters* %0, %struct.parameters** %2
%3 = load %struct.parameters*, %struct.parameters** %2
%4 = call double @chi_13(%struct.parameters* %3)
ret double %4
}

LLVM IR (-O2):
%struct.parameters = type { i32 }
define double @chi_31(%struct.parameters* %0) {
%2 = tail call double @chi_13(%struct.parameters* %0)
ret double %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
FILE *openFile(char *fileName) {
  FILE *fp;
  if ((fp = fopen(fileName, "r")) == NULL) {
    printf("open file error \n");
    exit(0);
  } else {
    printf("open file success \n");
  }
  return fp;
}


x86 assembly (clang, -O0):
<openFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    116d <openFile+0x3d>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openFile>:
push   %rbx
lea    0xec8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1156 <openFile+0x26>
mov    %rax,%rbx
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rax
pop    %rbx
ret
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [18 x i8] c"open file error \0A\00"
@.str.2 = [20 x i8] c"open file success \0A\00"
define i32* @openFile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @exit(i32 0)
unreachable
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10
%13 = load i32*, i32** %3
ret i32* %13
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@str = [19 x i8] c"open file success \00"
@str.3 = [17 x i8] c"open file error \00"
define noalias i32* @openFile(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.3, i64 0, i64 0))
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32* %2
}
void g5_set_cutoff_table(double (*ffunc)(double), double fcut, double fcor,
                         double (*pfunc)(double), double pcut, double pcor) {}


x86 assembly (clang, -O0):
<g5_set_cutoff_table>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @g5_set_cutoff_table(double (double)* %0, double %1, double %2, double (double)* %3, double %4, double %5) {
%7 = alloca double (double)*
%8 = alloca double
%9 = alloca double
%10 = alloca double (double)*
%11 = alloca double
%12 = alloca double
store double (double)* %0, double (double)** %7
store double %1, double* %8
store double %2, double* %9
store double (double)* %3, double (double)** %10
store double %4, double* %11
store double %5, double* %12
ret void
}

LLVM IR (-O2):
define void @g5_set_cutoff_table(double (double)* nocapture %0, double %1, double %2, double (double)* nocapture %3, double %4, double %5) {
ret void
}
int test_imm_FFint16_mem(short *val) {
  return ((*val) & (0xFF << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_FFint16_mem>:
cmpb   $0x0,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_FFint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 255
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
__attribute__((no)) int foo() {
  int a = -1;
  volatile unsigned b = 1U;
  int c = 1;
  c = (a + 972195718) >> (1LU <= b);
  if (c == 486097858)
    ;
  else
    __builtin_abort();
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x39f28786,%eax
mov    -0x8(%rbp),%ecx
mov    %ecx,%ecx
mov    %ecx,%edx
mov    $0x1,%ecx
cmp    %rdx,%rcx
setbe  %cl
and    $0x1,%cl
movzbl %cl,%ecx
sar    %cl,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1cf943c2,-0xc(%rbp)
jne    1164 <foo+0x54>
jmp    1169 <foo+0x59>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
movl   $0x1,0x4(%rsp)
cmpl   $0x0,0x4(%rsp)
je     1124 <foo+0x14>
xor    %eax,%eax
pop    %rcx
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @foo() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 -1, i32* %1
store volatile i32 1, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 972195718
%6 = load volatile i32, i32* %2
%7 = zext i32 %6 to i64
%8 = icmp ule i64 1, %7
%9 = zext i1 %8 to i32
%10 = ashr i32 %5, %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 486097858
br i1 %12, label %13, label %14
13: ; preds = %0
br label %15
14: ; preds = %0
unreachable
15: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
define i32 @foo() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 1, i32* %1
%3 = load volatile i32, i32* %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
tail call void @abort()
unreachable
6: ; preds = %0
ret i32 0
}
int abs(n) { return (n < 0) ? -n : n; }


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <abs+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <abs+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int is_prime(int n) {
  int f;
  f = 2;
  while (f < n) {
    if (n % f == 0)
      return 0;
    f = f + 1;
  }
  return n;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1144 <is_prime+0x44>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1136 <is_prime+0x36>
movl   $0x0,-0x4(%rbp)
jmp    114a <is_prime+0x4a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <is_prime+0xe>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
cmp    $0x3,%edi
jl     1120 <is_prime+0x20>
mov    $0x2,%ecx
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     1123 <is_prime+0x23>
add    $0x1,%ecx
cmp    %ecx,%edi
jne    1110 <is_prime+0x10>
mov    %edi,%eax
ret
xor    %edi,%edi
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %5, label %10
3: ; preds = %5
%4 = icmp eq i32 %9, %0
br i1 %4, label %10, label %5
5: ; preds = %1, %3
%6 = phi i32 [ %9, %3 ], [ 2, %1 ]
%7 = srem i32 %0, %6
%8 = icmp eq i32 %7, 0
%9 = add nuw nsw i32 %6, 1
br i1 %8, label %10, label %3
10: ; preds = %5, %3, %1
%11 = phi i32 [ %0, %1 ], [ %0, %3 ], [ 0, %5 ]
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *,
                           unsigned long);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
void write_switch(FILE *out, const char *strname, size_t depth) {
  if (depth > 0)
    fputc('\n', out);
  fprintf(out, "switch (%s[%lu]) {", strname, (unsigned long)depth);
}


x86 assembly (clang, -O0):
<write_switch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jbe    114d <write_switch+0x2d>
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_switch>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdx,%rdx
je     1140 <write_switch+0x20>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r15,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"switch (%s[%lu]) {\00"
define void @write_switch(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 i64, i64* %6
%8 = icmp ugt i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load i32*, i32** %4
%11 = call i32 @fputc(i8 signext 10, i32* %10)
br label %12
12: ; preds = %9, %3
%13 = load i32*, i32** %4
%14 = load i8*, i8** %5
%15 = load i64, i64* %6
%16 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %14, i64 %15)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"switch (%s[%lu]) {\00"
define void @write_switch(i32* nocapture %0, i8* %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @fputc(i8 signext 10, i32* %0)
br label %7
7: ; preds = %5, %3
%8 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %1, i64 %2)
ret void
}
/* Variables and functions */
unsigned short __gnu_f2h_internal(unsigned int, int);
unsigned short __hsail_f32_to_f16(unsigned int a) {
  return __gnu_f2h_internal(a, 1);
}


x86 assembly (clang, -O0):
<__hsail_f32_to_f16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <__gnu_f2h_internal@plt>
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hsail_f32_to_f16>:
mov    $0x1,%esi
jmp    1030 <__gnu_f2h_internal@plt>

LLVM IR (-O0):
define zeroext i16 @__hsail_f32_to_f16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call zeroext i16 @__gnu_f2h_internal(i32 %3, i32 1)
ret i16 %4
}

LLVM IR (-O2):
define zeroext i16 @__hsail_f32_to_f16(i32 %0) {
%2 = tail call zeroext i16 @__gnu_f2h_internal(i32 %0, i32 1)
ret i16 %2
}
unsigned char portgetc(unsigned short port) {
  unsigned char rc;
  asm volatile("inb %1, %0" : "=a"(rc) : "dN"(port));
  return rc;
}


x86 assembly (clang, -O0):
<portgetc>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%al
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<portgetc>:
mov    %edi,%edx
in     (%dx),%al
ret

LLVM IR (-O0):
define zeroext i8 @portgetc(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i8 asm sideeffect "inb $1, $0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @portgetc(i16 zeroext %0) {
%2 = tail call i8 asm sideeffect "inb $1, $0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i8 %2
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t gsub(uint8_t a, uint8_t b) { return a ^ b; }


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

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

LLVM IR (-O0):
define i32 @gsub(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 = xor i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @gsub(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
ret i32 %3
}
int test_main() { return 0; }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ SwapWord(char *, int);
long little2bigl(long num) {
  SwapWord((char *)&num, sizeof(num));
  return num;
}


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

x86 assembly (clang, -O2):
<little2bigl>:
push   %rax
mov    %rdi,(%rsp)
mov    %rsp,%rdi
mov    $0x8,%esi
call   1030 <SwapWord@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @little2bigl(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = bitcast i64* %2 to i8*
%4 = call i32 @SwapWord(i8* %3, i32 8)
%5 = load i64, i64* %2
ret i64 %5
}

LLVM IR (-O2):
define i64 @little2bigl(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = bitcast i64* %2 to i8*
%4 = call i32 @SwapWord(i8* %3, i32 8)
%5 = load i64, i64* %2
ret i64 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIG_SETMASK;
int /*<<< orphan*/ host_sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ host_sigfillset(int /*<<< orphan*/ *);
int /*<<< orphan*/ host_sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                                    int /*<<< orphan*/ *);
int /*<<< orphan*/ sigisemptyset(int /*<<< orphan*/ *);
int host_ipl_save(void) {
  sigset_t iset, oset;
  host_sigfillset(&iset);
  host_sigemptyset(&oset);
  host_sigprocmask(SIG_SETMASK, &iset, &oset);
  return !sigisemptyset(&oset);
}


x86 assembly (clang, -O0):
<host_ipl_save>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1050 <host_sigfillset@plt>
lea    -0x8(%rbp),%rdi
call   1060 <host_sigemptyset@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <host_sigprocmask@plt>
lea    -0x8(%rbp),%rdi
call   1030 <sigisemptyset@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<host_ipl_save>:
push   %r14
push   %rbx
push   %rax
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1050 <host_sigfillset@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <host_sigemptyset@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <host_sigprocmask@plt>
mov    %rbx,%rdi
call   1030 <sigisemptyset@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SIG_SETMASK = global i32 0
define i32 @host_ipl_save() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @host_sigfillset(i32* %1)
%4 = call i32 @host_sigemptyset(i32* %2)
%5 = load i32, i32* @SIG_SETMASK
%6 = call i32 @host_sigprocmask(i32 %5, i32* %1, i32* %2)
%7 = call i32 @sigisemptyset(i32* %2)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
@SIG_SETMASK = global i32 0
define i32 @host_ipl_save() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @host_sigfillset(i32* %1)
%6 = call i32 @host_sigemptyset(i32* %2)
%7 = load i32, i32* @SIG_SETMASK
%8 = call i32 @host_sigprocmask(i32 %7, i32* %1, i32* %2)
%9 = call i32 @sigisemptyset(i32* %2)
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}