#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void display_status(int verbose, const int level, int error) {
  if (verbose >= level) {
    switch (error) {
    case 0:
      fprintf(stdout, "Download Success\n");
      break;
    case 9:
      fprintf(stdout, "ERROR : device name option missing \"-d\"\n");
      break;
    case 8:
      fprintf(stderr, "ERROR : device autodetection failed\n");
      break;
    case 7:
      fprintf(stderr, "ERROR : File not found\n");
      break;
    case 6:
      fprintf(stderr, "ERROR : Device not found\n");
      break;
    case 5:
      fprintf(stderr, "ERROR : At command\n");
      break;
    case 4:
      fprintf(stderr, "ERROR : Error during download\n");
      break;
    case 2:
      fprintf(stderr, "ERROR : Block size out of bound\n");
      break;
    case 1:
      fprintf(stderr, "ERROR : Usage error\n");
      break;
    default:
      fprintf(stderr, "ERROR : Unknow Error\n");
    }
  }
}


x86 assembly (clang, -O0):
<display_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1256 <display_status+0x146>
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x9,%rax
ja     123c <display_status+0x12c>
mov    -0x18(%rbp),%rax
lea    0xeb7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1251 <display_status+0x141>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1251 <display_status+0x141>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1251 <display_status+0x141>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xed8(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1251 <display_status+0x141>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
lea    0xed6(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1251 <display_status+0x141>
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
lea    0xed6(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1251 <display_status+0x141>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1251 <display_status+0x141>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
lea    0xed5(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1251 <display_status+0x141>
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1251 <display_status+0x141>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
lea    0xed7(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1256 <display_status+0x146>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_status>:
cmp    %esi,%edi
jge    1115 <display_status+0x5>
ret
cmp    $0x9,%edx
ja     113d <display_status+0x2d>
movslq %edx,%rcx
lea    0x2ca4(%rip),%rax
mov    (%rax,%rcx,8),%rax
lea    0xfe5(%rip),%rdx
movslq (%rdx,%rcx,4),%rsi
add    %rdx,%rsi
mov    (%rax),%edi
jmp    1030 <fprintf@plt>
lea    0xfb7(%rip),%rsi
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [18 x i8] c"Download Success\0A\00"
@.str.1 = [41 x i8] c"ERROR : device name option missing \22-d\22\0A\00"
@stderr = global i32 0
@.str.2 = [37 x i8] c"ERROR : device autodetection failed\0A\00"
@.str.3 = [24 x i8] c"ERROR : File not found\0A\00"
@.str.4 = [26 x i8] c"ERROR : Device not found\0A\00"
@.str.5 = [20 x i8] c"ERROR : At command\0A\00"
@.str.6 = [31 x i8] c"ERROR : Error during download\0A\00"
@.str.7 = [33 x i8] c"ERROR : Block size out of bound\0A\00"
@.str.8 = [21 x i8] c"ERROR : Usage error\0A\00"
@.str.9 = [22 x i8] c"ERROR : Unknow Error\0A\00"
define void @display_status(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = icmp sge i32 %7, %8
br i1 %9, label %10, label %43
10: ; preds = %3
%11 = load i32, i32* %6
switch i32 %11, label %39 [
i32 0, label %12
i32 9, label %15
i32 8, label %18
i32 7, label %21
i32 6, label %24
i32 5, label %27
i32 4, label %30
i32 2, label %33
i32 1, label %36
]
12: ; preds = %10
%13 = load i32, i32* @stdout
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %42
15: ; preds = %10
%16 = load i32, i32* @stdout
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %42
18: ; preds = %10
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %42
21: ; preds = %10
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %42
24: ; preds = %10
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %42
27: ; preds = %10
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %42
30: ; preds = %10
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
br label %42
33: ; preds = %10
%34 = load i32, i32* @stderr
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
br label %42
36: ; preds = %10
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
br label %42
39: ; preds = %10
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
br label %42
42: ; preds = %39, %36, %33, %30, %27, %24, %21, %18, %15, %12
br label %43
43: ; preds = %42, %3
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [18 x i8] c"Download Success\0A\00"
@.str.1 = [41 x i8] c"ERROR : device name option missing \22-d\22\0A\00"
@stderr = global i32 0
@.str.2 = [37 x i8] c"ERROR : device autodetection failed\0A\00"
@.str.3 = [24 x i8] c"ERROR : File not found\0A\00"
@.str.4 = [26 x i8] c"ERROR : Device not found\0A\00"
@.str.5 = [20 x i8] c"ERROR : At command\0A\00"
@.str.6 = [31 x i8] c"ERROR : Error during download\0A\00"
@.str.7 = [33 x i8] c"ERROR : Block size out of bound\0A\00"
@.str.8 = [21 x i8] c"ERROR : Usage error\0A\00"
@.str.9 = [22 x i8] c"ERROR : Unknow Error\0A\00"
@switch.table.display_status = [10 x i32*] [i32* @stdout, i32* @stderr, i32* @stderr, i32* @stderr, i32* @stderr, i32* @stderr, i32* @stderr, i32* @stderr, i32* @stderr, i32* @stdout]
@reltable.display_status = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str to i64), i64 ptrtoint ([10 x i32]* @reltable.display_status to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.8 to i64), i64 ptrtoint ([10 x i32]* @reltable.display_status to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([33 x i8]* @.str.7 to i64), i64 ptrtoint ([10 x i32]* @reltable.display_status to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.9 to i64), i64 ptrtoint ([10 x i32]* @reltable.display_status to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([31 x i8]* @.str.6 to i64), i64 ptrtoint ([10 x i32]* @reltable.display_status to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.5 to i64), i64 ptrtoint ([10 x i32]* @reltable.display_status to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.4 to i64), i64 ptrtoint ([10 x i32]* @reltable.display_status to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @.str.3 to i64), i64 ptrtoint ([10 x i32]* @reltable.display_status to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([37 x i8]* @.str.2 to i64), i64 ptrtoint ([10 x i32]* @reltable.display_status to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([41 x i8]* @.str.1 to i64), i64 ptrtoint ([10 x i32]* @reltable.display_status to i64)) to i32)]
define void @display_status(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
br i1 %4, label %19, label %5
5: ; preds = %3
%6 = icmp ult i32 %2, 10
br i1 %6, label %7, label %14
7: ; preds = %5
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds [10 x i32*], [10 x i32*]* @switch.table.display_status, i64 0, i64 %8
%10 = load i32*, i32** %9
%11 = sext i32 %2 to i64
%12 = shl i64 %11, 2
%13 = call i8* @llvm.load.relative.i64(i8* bitcast ([10 x i32]* @reltable.display_status to i8*), i64 %12)
br label %14
14: ; preds = %5, %7
%15 = phi i32* [ %10, %7 ], [ @stderr, %5 ]
%16 = phi i8* [ %13, %7 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), %5 ]
%17 = load i32, i32* %15
%18 = tail call i32 @fprintf(i32 %17, i8* %16)
br label %19
19: ; preds = %14, %3
ret void
}