#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 *, ...);
int /*<<< orphan*/ sprintf(char *, char *, unsigned long);
int /*<<< orphan*/ strcpy(char *, char *);
void PrintErrorMessage(unsigned long nErrCode) {
  printf("Failed to obtain image. ");
  char stError[64];
  switch (nErrCode) {
  case 0:
    strcpy(stError, "OK");
    break;
  case 4306:
    strcpy(stError, "- Empty frame -");
    break;
  case (0x20000000 | (0x0001)):
    strcpy(stError, "- Movable finger -");
    break;
  case (0x20000000 | (0x0002)):
    strcpy(stError, "- Fake finger -");
    break;
  case (0x20000000 | (0x0004)):
    strcpy(stError, "- Incompatible hardware -");
    break;
  case (0x20000000 | (0x0005)):
    strcpy(stError, "- Incompatible firmware -");
    break;
  case (0x20000000 | (0x0006)):
    strcpy(stError, "- Invalid authorization code -");
    break;
  default:
    sprintf(stError, "Unknown return code - %lu", nErrCode);
  }
  printf("%s\n", stError);
}


x86 assembly (clang, -O0):
<PrintErrorMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x58(%rbp)
test   %rax,%rax
je     11de <PrintErrorMessage+0xae>
jmp    1160 <PrintErrorMessage+0x30>
mov    -0x58(%rbp),%rax
sub    $0x10d2,%rax
je     11f3 <PrintErrorMessage+0xc3>
jmp    1175 <PrintErrorMessage+0x45>
mov    -0x58(%rbp),%rax
sub    $0x20000001,%rax
je     1208 <PrintErrorMessage+0xd8>
jmp    118a <PrintErrorMessage+0x5a>
mov    -0x58(%rbp),%rax
sub    $0x20000002,%rax
je     121d <PrintErrorMessage+0xed>
jmp    119f <PrintErrorMessage+0x6f>
mov    -0x58(%rbp),%rax
sub    $0x20000004,%rax
je     1232 <PrintErrorMessage+0x102>
jmp    11b4 <PrintErrorMessage+0x84>
mov    -0x58(%rbp),%rax
sub    $0x20000005,%rax
je     1247 <PrintErrorMessage+0x117>
jmp    11c9 <PrintErrorMessage+0x99>
mov    -0x58(%rbp),%rax
sub    $0x20000006,%rax
je     125c <PrintErrorMessage+0x12c>
jmp    1271 <PrintErrorMessage+0x141>
lea    -0x50(%rbp),%rdi
lea    0xe30(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1285 <PrintErrorMessage+0x155>
lea    -0x50(%rbp),%rdi
lea    0xe1e(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1285 <PrintErrorMessage+0x155>
lea    -0x50(%rbp),%rdi
lea    0xe19(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1285 <PrintErrorMessage+0x155>
lea    -0x50(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1285 <PrintErrorMessage+0x155>
lea    -0x50(%rbp),%rdi
lea    0xe12(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1285 <PrintErrorMessage+0x155>
lea    -0x50(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1285 <PrintErrorMessage+0x155>
lea    -0x50(%rbp),%rdi
lea    0xe1c(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1285 <PrintErrorMessage+0x155>
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe22(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x50(%rbp),%rsi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintErrorMessage>:
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%rbx
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    -0x20000001(%rbx),%rax
cmp    $0x5,%rax
ja     117c <PrintErrorMessage+0x3c>
lea    0xe96(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeca(%rip),%rsi
jmp    11d2 <PrintErrorMessage+0x92>
cmp    $0x10d2,%rbx
je     11cb <PrintErrorMessage+0x8b>
test   %rbx,%rbx
jne    1193 <PrintErrorMessage+0x53>
lea    0xea0(%rip),%rsi
jmp    11d2 <PrintErrorMessage+0x92>
lea    0xf20(%rip),%rsi
mov    %rsp,%rdi
mov    %rbx,%rdx
call   1060 <sprintf@plt>
jmp    11da <PrintErrorMessage+0x9a>
lea    0xea9(%rip),%rsi
jmp    11d2 <PrintErrorMessage+0x92>
lea    0xeb0(%rip),%rsi
jmp    11d2 <PrintErrorMessage+0x92>
lea    0xec1(%rip),%rsi
jmp    11d2 <PrintErrorMessage+0x92>
lea    0xed2(%rip),%rsi
jmp    11d2 <PrintErrorMessage+0x92>
lea    0xe62(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
mov    %rsp,%rdi
call   1040 <puts@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Failed to obtain image. \00"
@.str.1 = [3 x i8] c"OK\00"
@.str.2 = [16 x i8] c"- Empty frame -\00"
@.str.3 = [19 x i8] c"- Movable finger -\00"
@.str.4 = [16 x i8] c"- Fake finger -\00"
@.str.5 = [26 x i8] c"- Incompatible hardware -\00"
@.str.6 = [26 x i8] c"- Incompatible firmware -\00"
@.str.7 = [31 x i8] c"- Invalid authorization code -\00"
@.str.8 = [26 x i8] c"Unknown return code - %lu\00"
@.str.9 = [4 x i8] c"%s\0A\00"
define void @PrintErrorMessage(i64 %0) {
%2 = alloca i64
%3 = alloca [64 x i8]
store i64 %0, i64* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = load i64, i64* %2
switch i64 %5, label %27 [
i64 0, label %6
i64 4306, label %9
i64 536870913, label %12
i64 536870914, label %15
i64 536870916, label %18
i64 536870917, label %21
i64 536870918, label %24
]
6: ; preds = %1
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %31
9: ; preds = %1
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %31
12: ; preds = %1
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%14 = call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %31
15: ; preds = %1
%16 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %31
18: ; preds = %1
%19 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
br label %31
21: ; preds = %1
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%23 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %31
24: ; preds = %1
%25 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
br label %31
27: ; preds = %1
%28 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%29 = load i64, i64* %2
%30 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i64 %29)
br label %31
31: ; preds = %27, %24, %21, %18, %15, %12, %9, %6
%32 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %32)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Failed to obtain image. \00"
@.str.1 = [3 x i8] c"OK\00"
@.str.2 = [16 x i8] c"- Empty frame -\00"
@.str.3 = [19 x i8] c"- Movable finger -\00"
@.str.4 = [16 x i8] c"- Fake finger -\00"
@.str.5 = [26 x i8] c"- Incompatible hardware -\00"
@.str.6 = [26 x i8] c"- Incompatible firmware -\00"
@.str.7 = [31 x i8] c"- Invalid authorization code -\00"
@.str.8 = [26 x i8] c"Unknown return code - %lu\00"
define void @PrintErrorMessage(i64 %0) {
%2 = alloca [64 x i8]
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
switch i64 %0, label %19 [
i64 0, label %5
i64 4306, label %7
i64 536870913, label %9
i64 536870914, label %11
i64 536870916, label %13
i64 536870917, label %15
i64 536870918, label %17
]
5: ; preds = %1
%6 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %21
7: ; preds = %1
%8 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %21
9: ; preds = %1
%10 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %21
11: ; preds = %1
%12 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %21
13: ; preds = %1
%14 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
br label %21
15: ; preds = %1
%16 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %21
17: ; preds = %1
%18 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
br label %21
19: ; preds = %1
%20 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i64 %0)
br label %21
21: ; preds = %19, %17, %15, %13, %11, %9, %7, %5
%22 = call i32 @puts(i8* %4)
ret void
}