#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int prv_test_arm_add_data_1_imm();
int prv_test_arm_add_data_2_imm();
int prv_test_arm_add_data_ldr_imm();
int prv_test_arm_add_data_neg_2_imm();
int prv_test_arm_add_data_neg_imm();
int prv_test_encode_imm();
int prv_test_encode_lvl2_imm();
int prv_test_encode_nearest();
int arm_core_test(void) {
  int retval;
  retval = prv_test_encode_imm();
  retval |= prv_test_encode_nearest();
  retval |= prv_test_encode_lvl2_imm();
  retval |= prv_test_arm_add_data_1_imm();
  retval |= prv_test_arm_add_data_2_imm();
  retval |= prv_test_arm_add_data_neg_imm();
  retval |= prv_test_arm_add_data_neg_2_imm();
  retval |= prv_test_arm_add_data_ldr_imm();
  return retval;
}


x86 assembly (clang, -O0):
<arm_core_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   10a0 <prv_test_encode_imm@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <prv_test_encode_nearest@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1090 <prv_test_encode_lvl2_imm@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1080 <prv_test_arm_add_data_1_imm@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1060 <prv_test_arm_add_data_2_imm@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <prv_test_arm_add_data_neg_imm@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <prv_test_arm_add_data_neg_2_imm@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1070 <prv_test_arm_add_data_ldr_imm@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arm_core_test>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   10a0 <prv_test_encode_imm@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <prv_test_encode_nearest@plt>
mov    %eax,%ebp
or     %ebx,%ebp
xor    %eax,%eax
call   1090 <prv_test_encode_lvl2_imm@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1080 <prv_test_arm_add_data_1_imm@plt>
mov    %eax,%ebx
or     %r14d,%ebx
or     %ebp,%ebx
xor    %eax,%eax
call   1060 <prv_test_arm_add_data_2_imm@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1040 <prv_test_arm_add_data_neg_imm@plt>
mov    %eax,%r15d
or     %r14d,%r15d
xor    %eax,%eax
call   1050 <prv_test_arm_add_data_neg_2_imm@plt>
mov    %eax,%ebp
or     %r15d,%ebp
or     %ebx,%ebp
xor    %eax,%eax
call   1070 <prv_test_arm_add_data_ldr_imm@plt>
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @arm_core_test() {
%1 = alloca i32
%2 = call i32 (...) @prv_test_encode_imm()
store i32 %2, i32* %1
%3 = call i32 (...) @prv_test_encode_nearest()
%4 = load i32, i32* %1
%5 = or i32 %4, %3
store i32 %5, i32* %1
%6 = call i32 (...) @prv_test_encode_lvl2_imm()
%7 = load i32, i32* %1
%8 = or i32 %7, %6
store i32 %8, i32* %1
%9 = call i32 (...) @prv_test_arm_add_data_1_imm()
%10 = load i32, i32* %1
%11 = or i32 %10, %9
store i32 %11, i32* %1
%12 = call i32 (...) @prv_test_arm_add_data_2_imm()
%13 = load i32, i32* %1
%14 = or i32 %13, %12
store i32 %14, i32* %1
%15 = call i32 (...) @prv_test_arm_add_data_neg_imm()
%16 = load i32, i32* %1
%17 = or i32 %16, %15
store i32 %17, i32* %1
%18 = call i32 (...) @prv_test_arm_add_data_neg_2_imm()
%19 = load i32, i32* %1
%20 = or i32 %19, %18
store i32 %20, i32* %1
%21 = call i32 (...) @prv_test_arm_add_data_ldr_imm()
%22 = load i32, i32* %1
%23 = or i32 %22, %21
store i32 %23, i32* %1
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
define i32 @arm_core_test() {
%1 = tail call i32 (...) @prv_test_encode_imm()
%2 = tail call i32 (...) @prv_test_encode_nearest()
%3 = or i32 %2, %1
%4 = tail call i32 (...) @prv_test_encode_lvl2_imm()
%5 = or i32 %3, %4
%6 = tail call i32 (...) @prv_test_arm_add_data_1_imm()
%7 = or i32 %5, %6
%8 = tail call i32 (...) @prv_test_arm_add_data_2_imm()
%9 = or i32 %7, %8
%10 = tail call i32 (...) @prv_test_arm_add_data_neg_imm()
%11 = or i32 %9, %10
%12 = tail call i32 (...) @prv_test_arm_add_data_neg_2_imm()
%13 = or i32 %11, %12
%14 = tail call i32 (...) @prv_test_arm_add_data_ldr_imm()
%15 = or i32 %13, %14
ret i32 %15
}