#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 */
scalar_t__ cpu_is_exynos4();
scalar_t__ cpu_is_exynos5();
scalar_t__ proid_is_exynos4412();
scalar_t__ proid_is_exynos5420();
unsigned int get_bank_num(void) {
  if (cpu_is_exynos5()) {
    if (proid_is_exynos5420())
      return 6;
    else
      return 8;
  } else if (cpu_is_exynos4()) {
    if (proid_is_exynos4412())
      return 4;
    else
      return 3;
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_bank_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <cpu_is_exynos5@plt>
cmp    $0x0,%rax
je     1182 <get_bank_num+0x42>
mov    $0x0,%al
call   1050 <proid_is_exynos5420@plt>
cmp    $0x0,%rax
je     1176 <get_bank_num+0x36>
movl   $0x6,-0x4(%rbp)
jmp    11c8 <get_bank_num+0x88>
movl   $0x8,-0x4(%rbp)
jmp    11c8 <get_bank_num+0x88>
mov    $0x0,%al
call   1060 <cpu_is_exynos4@plt>
cmp    $0x0,%rax
je     11bc <get_bank_num+0x7c>
mov    $0x0,%al
call   1040 <proid_is_exynos4412@plt>
cmp    $0x0,%rax
je     11b0 <get_bank_num+0x70>
movl   $0x4,-0x4(%rbp)
jmp    11c8 <get_bank_num+0x88>
movl   $0x3,-0x4(%rbp)
jmp    11c8 <get_bank_num+0x88>
jmp    11c1 <get_bank_num+0x81>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bank_num>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <cpu_is_exynos5@plt>
test   %rax,%rax
je     1166 <get_bank_num+0x26>
xor    %eax,%eax
call   1050 <proid_is_exynos5420@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
lea    (%rcx,%rcx,1),%ebx
add    $0x6,%ebx
jmp    1185 <get_bank_num+0x45>
xor    %eax,%eax
call   1060 <cpu_is_exynos4@plt>
test   %rax,%rax
je     1185 <get_bank_num+0x45>
xor    %eax,%eax
call   1040 <proid_is_exynos4412@plt>
cmp    $0x1,%rax
mov    $0x4,%ebx
sbb    $0x0,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_bank_num() {
%1 = alloca i32
%2 = call i64 (...) @cpu_is_exynos5()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = call i64 (...) @proid_is_exynos5420()
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %4
store i32 6, i32* %1
br label %19
8: ; preds = %4
store i32 8, i32* %1
br label %19
9: ; preds = %0
%10 = call i64 (...) @cpu_is_exynos4()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = call i64 (...) @proid_is_exynos4412()
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 4, i32* %1
br label %19
16: ; preds = %12
store i32 3, i32* %1
br label %19
17: ; preds = %9
br label %18
18: ; preds = %17
store i32 0, i32* %1
br label %19
19: ; preds = %18, %16, %15, %8, %7
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
define i32 @get_bank_num() {
%1 = tail call i64 (...) @cpu_is_exynos5()
%2 = icmp eq i64 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call i64 (...) @proid_is_exynos5420()
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i32 8, i32 6
br label %14
7: ; preds = %0
%8 = tail call i64 (...) @cpu_is_exynos4()
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = tail call i64 (...) @proid_is_exynos4412()
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i32 3, i32 4
br label %14
14: ; preds = %7, %10, %3
%15 = phi i32 [ %6, %3 ], [ %13, %10 ], [ 0, %7 ]
ret i32 %15
}