#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();
scalar_t__ proid_is_exynos5422();
unsigned int get_bank_num(void) {
  if (cpu_is_exynos5()) {
    if (proid_is_exynos5420() || proid_is_exynos5422())
      return 6;
    else
      return 8;
  } else if (cpu_is_exynos4()) {
    if (proid_is_exynos4412())
      return 8;
    else
      return 4;
  }
  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     11a3 <get_bank_num+0x53>
mov    $0x0,%al
call   1050 <proid_is_exynos5420@plt>
cmp    $0x0,%rax
jne    118b <get_bank_num+0x3b>
mov    $0x0,%al
call   1070 <proid_is_exynos5422@plt>
cmp    $0x0,%rax
je     1197 <get_bank_num+0x47>
movl   $0x6,-0x4(%rbp)
jmp    11e9 <get_bank_num+0x99>
movl   $0x8,-0x4(%rbp)
jmp    11e9 <get_bank_num+0x99>
mov    $0x0,%al
call   1060 <cpu_is_exynos4@plt>
cmp    $0x0,%rax
je     11dd <get_bank_num+0x8d>
mov    $0x0,%al
call   1040 <proid_is_exynos4412@plt>
cmp    $0x0,%rax
je     11d1 <get_bank_num+0x81>
movl   $0x8,-0x4(%rbp)
jmp    11e9 <get_bank_num+0x99>
movl   $0x4,-0x4(%rbp)
jmp    11e9 <get_bank_num+0x99>
jmp    11e2 <get_bank_num+0x92>
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     1187 <get_bank_num+0x37>
xor    %eax,%eax
call   1050 <proid_is_exynos5420@plt>
mov    $0x6,%ebx
test   %rax,%rax
jne    11a9 <get_bank_num+0x59>
xor    %eax,%eax
call   1070 <proid_is_exynos5422@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
lea    (%rcx,%rcx,1),%ebx
add    $0x6,%ebx
jmp    11a9 <get_bank_num+0x59>
xor    %eax,%eax
call   1060 <cpu_is_exynos4@plt>
test   %rax,%rax
je     11a9 <get_bank_num+0x59>
xor    %eax,%eax
call   1040 <proid_is_exynos4412@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0x4(,%rcx,4),%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 %12
4: ; preds = %0
%5 = call i64 (...) @proid_is_exynos5420()
%6 = icmp ne i64 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = call i64 (...) @proid_is_exynos5422()
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7, %4
store i32 6, i32* %1
br label %22
11: ; preds = %7
store i32 8, i32* %1
br label %22
12: ; preds = %0
%13 = call i64 (...) @cpu_is_exynos4()
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = call i64 (...) @proid_is_exynos4412()
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 8, i32* %1
br label %22
19: ; preds = %15
store i32 4, i32* %1
br label %22
20: ; preds = %12
br label %21
21: ; preds = %20
store i32 0, i32* %1
br label %22
22: ; preds = %21, %19, %18, %11, %10
%23 = load i32, i32* %1
ret i32 %23
}

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 %10, label %3
3: ; preds = %0
%4 = tail call i64 (...) @proid_is_exynos5420()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = tail call i64 (...) @proid_is_exynos5422()
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i32 8, i32 6
br label %17
10: ; preds = %0
%11 = tail call i64 (...) @cpu_is_exynos4()
%12 = icmp eq i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %10
%14 = tail call i64 (...) @proid_is_exynos4412()
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i32 4, i32 8
br label %17
17: ; preds = %6, %10, %13, %3
%18 = phi i32 [ 6, %3 ], [ %16, %13 ], [ 0, %10 ], [ %9, %6 ]
ret i32 %18
}