#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 /*<<< orphan*/ cpuinfo(int, int *, int *, int *, int *);
int get_cache_size() {
  int eax = 0, ebx = 0, ecx = 0, edx = 0;
  cpuinfo(0x80000000, &eax, &ebx, &ecx, &edx);
  if ((eax & 0xFF) < 6) {
    return 64;
  }
  cpuinfo(0x80000006, &eax, &ebx, &ecx, &edx);
  return (ecx >> 16) & 0xFFFF;
}


x86 assembly (clang, -O0):
<get_cache_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x80000000,%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <cpuinfo@plt>
mov    -0x8(%rbp),%eax
and    $0xff,%eax
cmp    $0x6,%eax
jge    116b <get_cache_size+0x5b>
movl   $0x40,-0x4(%rbp)
jmp    1193 <get_cache_size+0x83>
mov    $0x80000006,%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <cpuinfo@plt>
mov    -0x10(%rbp),%eax
sar    $0x10,%eax
and    $0xffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cache_size>:
sub    $0x18,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
lea    0xc(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x10(%rsp),%r8
mov    $0x80000000,%edi
call   1030 <cpuinfo@plt>
mov    $0xfe,%ecx
and    0xc(%rsp),%ecx
mov    $0x40,%eax
cmp    $0x6,%ecx
jb     1188 <get_cache_size+0x78>
lea    0xc(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x10(%rsp),%r8
mov    $0x80000006,%edi
call   1030 <cpuinfo@plt>
movzwl 0xa(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @get_cache_size() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = call i32 @cpuinfo(i32 -2147483648, i32* %2, i32* %3, i32* %4, i32* %5)
%7 = load i32, i32* %2
%8 = and i32 %7, 255
%9 = icmp slt i32 %8, 6
br i1 %9, label %10, label %11
10: ; preds = %0
store i32 64, i32* %1
br label %16
11: ; preds = %0
%12 = call i32 @cpuinfo(i32 -2147483642, i32* %2, i32* %3, i32* %4, i32* %5)
%13 = load i32, i32* %4
%14 = ashr i32 %13, 16
%15 = and i32 %14, 65535
store i32 %15, i32* %1
br label %16
16: ; preds = %11, %10
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
define i32 @get_cache_size() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = call i32 @cpuinfo(i32 -2147483648, i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %1
%11 = and i32 %10, 254
%12 = icmp ult i32 %11, 6
br i1 %12, label %17, label %13
13: ; preds = %0
%14 = call i32 @cpuinfo(i32 -2147483642, i32* %1, i32* %2, i32* %3, i32* %4)
%15 = load i32, i32* %3
%16 = lshr i32 %15, 16
br label %17
17: ; preds = %0, %13
%18 = phi i32 [ %16, %13 ], [ 64, %0 ]
ret i32 %18
}