#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*/ printf(char *);
long msgcnt(int ver, int aver) {
  switch (ver) {
  case 1:
    return 250;
  case 2:
    if (aver == 4)
      return 700;
    else if (aver <= 3)
      return 500;
    else
      return 600;
  case 3:
    return 700;
  case 4:
    return 900;
  }
  printf("INTERNAL ERROR: Invalid VER\n");
  return 0;
}


x86 assembly (clang, -O0):
<msgcnt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     11a9 <msgcnt+0x99>
mov    -0x18(%rbp),%rax
lea    0xec2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movq   $0xfa,-0x8(%rbp)
jmp    11bd <msgcnt+0xad>
cmpl   $0x4,-0x10(%rbp)
jne    116b <msgcnt+0x5b>
movq   $0x2bc,-0x8(%rbp)
jmp    11bd <msgcnt+0xad>
cmpl   $0x3,-0x10(%rbp)
jg     1182 <msgcnt+0x72>
movq   $0x1f4,-0x8(%rbp)
jmp    11bd <msgcnt+0xad>
movq   $0x258,-0x8(%rbp)
jmp    11bd <msgcnt+0xad>
movq   $0x2bc,-0x8(%rbp)
jmp    11bd <msgcnt+0xad>
movq   $0x384,-0x8(%rbp)
jmp    11bd <msgcnt+0xad>
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msgcnt>:
push   %rax
add    $0xffffffff,%edi
cmp    $0x3,%edi
ja     1156 <msgcnt+0x46>
mov    $0xfa,%eax
lea    0xedb(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x2bc,%eax
cmp    $0x4,%esi
je     1164 <msgcnt+0x54>
mov    $0x1f4,%ecx
mov    $0x258,%eax
cmovl  %rcx,%rax
pop    %rcx
ret
mov    $0x2bc,%eax
pop    %rcx
ret
mov    $0x384,%eax
pop    %rcx
ret
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"INTERNAL ERROR: Invalid VER\0A\00"
define i64 @msgcnt(i32 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
switch i32 %6, label %19 [
i32 1, label %7
i32 2, label %8
i32 3, label %17
i32 4, label %18
]
7: ; preds = %2
store i64 250, i64* %3
br label %21
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 4
br i1 %10, label %11, label %12
11: ; preds = %8
store i64 700, i64* %3
br label %21
12: ; preds = %8
%13 = load i32, i32* %5
%14 = icmp sle i32 %13, 3
br i1 %14, label %15, label %16
15: ; preds = %12
store i64 500, i64* %3
br label %21
16: ; preds = %12
store i64 600, i64* %3
br label %21
17: ; preds = %2
store i64 700, i64* %3
br label %21
18: ; preds = %2
store i64 900, i64* %3
br label %21
19: ; preds = %2
%20 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i64 0, i64* %3
br label %21
21: ; preds = %19, %18, %17, %16, %15, %11, %7
%22 = load i64, i64* %3
ret i64 %22
}

LLVM IR (-O2):
@str = [28 x i8] c"INTERNAL ERROR: Invalid VER\00"
define i64 @msgcnt(i32 %0, i32 %1) {
switch i32 %0, label %10 [
i32 1, label %12
i32 2, label %3
i32 3, label %8
i32 4, label %9
]
3: ; preds = %2
%4 = icmp eq i32 %1, 4
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = icmp slt i32 %1, 4
%7 = select i1 %6, i64 500, i64 600
br label %12
8: ; preds = %2
br label %12
9: ; preds = %2
br label %12
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %5, %3, %2, %10, %9, %8
%13 = phi i64 [ 0, %10 ], [ 900, %9 ], [ 700, %8 ], [ 250, %2 ], [ 700, %3 ], [ %7, %5 ]
ret i64 %13
}