#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 */
struct compile_state {
  int dummy;
};

/* Variables and functions */
unsigned int arch_regc_size(struct compile_state *, int);
unsigned regc_max_size(struct compile_state *state, int classes) {
  unsigned max_size;
  int i;
  max_size = 0;
  for (i = 0; i < 14; i++) {
    if (classes & (1 << i)) {
      unsigned size;
      size = arch_regc_size(state, i);
      if (size > max_size) {
        max_size = size;
      }
    }
  }
  return max_size;
}


x86 assembly (clang, -O0):
<regc_max_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xe,-0x14(%rbp)
jge    118a <regc_max_size+0x7a>
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1177 <regc_max_size+0x67>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <arch_regc_size@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jbe    1172 <regc_max_size+0x62>
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1177 <regc_max_size+0x67>
jmp    117c <regc_max_size+0x6c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <regc_max_size+0x1d>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<regc_max_size>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1138 <regc_max_size+0x28>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebx
cmp    $0xe,%ebx
je     114f <regc_max_size+0x3f>
bt     %ebx,%r15d
jae    1130 <regc_max_size+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <arch_regc_size@plt>
cmp    %ebp,%eax
cmova  %eax,%ebp
jmp    1130 <regc_max_size+0x20>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.compile_state = type { i32 }
define i32 @regc_max_size(%struct.compile_state* %0, i32 %1) {
%3 = alloca %struct.compile_state*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store %struct.compile_state* %0, %struct.compile_state** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %8
8: ; preds = %28, %2
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 14
br i1 %10, label %11, label %31
11: ; preds = %8
%12 = load i32, i32* %4
%13 = load i32, i32* %6
%14 = shl i32 1, %13
%15 = and i32 %12, %14
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %11
%18 = load %struct.compile_state*, %struct.compile_state** %3
%19 = load i32, i32* %6
%20 = call i32 @arch_regc_size(%struct.compile_state* %18, i32 %19)
store i32 %20, i32* %7
%21 = load i32, i32* %7
%22 = load i32, i32* %5
%23 = icmp ugt i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %17
%25 = load i32, i32* %7
store i32 %25, i32* %5
br label %26
26: ; preds = %24, %17
br label %27
27: ; preds = %26, %11
br label %28
28: ; preds = %27
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %8
31: ; preds = %8
%32 = load i32, i32* %5
ret i32 %32
}

LLVM IR (-O2):
%struct.compile_state = type { i32 }
define i32 @regc_max_size(%struct.compile_state* %0, i32 %1) {
br label %3
3: ; preds = %2, %13
%4 = phi i32 [ 0, %2 ], [ %14, %13 ]
%5 = phi i32 [ 0, %2 ], [ %15, %13 ]
%6 = shl nuw nsw i32 1, %5
%7 = and i32 %6, %1
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %3
%10 = tail call i32 @arch_regc_size(%struct.compile_state* %0, i32 %5)
%11 = icmp ugt i32 %10, %4
%12 = select i1 %11, i32 %10, i32 %4
br label %13
13: ; preds = %3, %9
%14 = phi i32 [ %12, %9 ], [ %4, %3 ]
%15 = add nuw nsw i32 %5, 1
%16 = icmp eq i32 %15, 14
br i1 %16, label %17, label %3
17: ; preds = %13
ret i32 %14
}