#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void display_error(int error_code) {
  switch (error_code) {
  case 3:
    printf("too large number\n");
    break;
  case 4:
    printf("not a number\n");
    break;
  case 5:
    printf("just one cardinate\n");
    break;
  case 6:
    printf("too much cardinates\n");
    break;
  default:
    printf("ERROR\n");
    break;
  }
  printf("\nERROR %ld\n", error_code);
  exit(1);
}


x86 assembly (clang, -O0):
<display_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xfffffffd,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11a0 <display_error+0x80>
mov    -0x10(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ae <display_error+0x8e>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ae <display_error+0x8e>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ae <display_error+0x8e>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ae <display_error+0x8e>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<display_error>:
push   %rbx
mov    %edi,%ebx
lea    -0x3(%rbx),%eax
cmp    $0x3,%eax
ja     114d <display_error+0x1d>
cltq
lea    0xf14(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1154 <display_error+0x24>
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
lea    0xea0(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"too large number\0A\00"
@.str.1 = [14 x i8] c"not a number\0A\00"
@.str.2 = [20 x i8] c"just one cardinate\0A\00"
@.str.3 = [21 x i8] c"too much cardinates\0A\00"
@.str.4 = [7 x i8] c"ERROR\0A\00"
@.str.5 = [12 x i8] c"\0AERROR %ld\0A\00"
define void @display_error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %12 [
i32 3, label %4
i32 4, label %6
i32 5, label %8
i32 6, label %10
]
4: ; preds = %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %14
6: ; preds = %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %14
8: ; preds = %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %14
10: ; preds = %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %14
12: ; preds = %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %12, %10, %8, %6, %4
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %15)
%17 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str.5 = [12 x i8] c"\0AERROR %ld\0A\00"
@str = [20 x i8] c"too much cardinates\00"
@str.6 = [19 x i8] c"just one cardinate\00"
@str.7 = [13 x i8] c"not a number\00"
@str.8 = [17 x i8] c"too large number\00"
@str.9 = [6 x i8] c"ERROR\00"
@reltable.display_error = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @str.8 to i64), i64 ptrtoint ([4 x i32]* @reltable.display_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @str.7 to i64), i64 ptrtoint ([4 x i32]* @reltable.display_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @str.6 to i64), i64 ptrtoint ([4 x i32]* @reltable.display_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @str to i64), i64 ptrtoint ([4 x i32]* @reltable.display_error to i64)) to i32)]
define void @display_error(i32 %0) {
%2 = add i32 %0, -3
%3 = icmp ult i32 %2, 4
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.display_error to i8*), i64 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @str.9, i64 0, i64 0), %1 ]
%10 = tail call i32 @puts(i8* dereferenceable(1) %9)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %0)
%12 = tail call i32 @exit(i32 1)
unreachable
}