#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*/ sprintf(char *, char *);
int errCodeToMessage(int i_errCode, char *o_message) {
  switch (i_errCode) {
  case 1:
    sprintf(o_message, "error while initializing curl");
    break;
  case 2:
    sprintf(o_message, "curl error");
    break;
  case 3:
    sprintf(o_message, "wrong format");
    break;
  case 4:
    sprintf(o_message, "unexpected value");
    break;
  case 5:
    sprintf(o_message, "invalid argument");
    break;
  case 6:
    sprintf(o_message, "can't open file");
    break;
  case 7:
    sprintf(o_message, "wrong file format");
    break;
  case 8:
    sprintf(o_message, "bad image width");
    break;
  case 9:
    sprintf(o_message, "bad image height");
    break;
  case 10:
    sprintf(o_message, "incompatible type size");
    break;
  case 11:
    sprintf(o_message, "only supported color type is RGBA");
    break;
  case 12:
    sprintf(o_message, "only supported bit depth is 8");
    break;
  case 13:
    sprintf(o_message, "wrong dimensions");
    break;
  case 14:
    sprintf(o_message, "error while creating PNG image");
    break;
  case 15:
    sprintf(o_message, "value out of range");
    break;
  case 16:
    sprintf(o_message, "memory allocation failed");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<errCodeToMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xf,%eax
ja     1293 <errCodeToMessage+0x183>
mov    -0x18(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xeed(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xef6(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xeec(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xee4(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xee0(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xedc(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xed7(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xed4(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xecf(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xecb(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xecd(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xeda(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xee3(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xedf(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xee9(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <errCodeToMessage+0x183>
mov    -0x10(%rbp),%rdi
lea    0xee7(%rip),%rsi
call   1030 <sprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errCodeToMessage>:
add    $0xffffffff,%edi
cmp    $0xf,%edi
ja     124f <errCodeToMessage+0x14f>
lea    0xeed(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
movups 0xf2b(%rip),%xmm0
movups %xmm0,0xe(%rsi)
movups 0xf12(%rip),%xmm0
jmp    124c <errCodeToMessage+0x14c>
movabs $0x727265206c727563,%rax
65 72 72
mov    %rax,(%rsi)
movl   $0x726f72,0x7(%rsi)
xor    %eax,%eax
ret
movabs $0x74616d726f6620,%rax
mov    %rax,0x5(%rsi)
movabs $0x6f6620676e6f7277,%rax
20 66 6f
mov    %rax,(%rsi)
xor    %eax,%eax
ret
movups 0xf07(%rip),%xmm0
jmp    1208 <errCodeToMessage+0x108>
movups 0xf0c(%rip),%xmm0
jmp    1208 <errCodeToMessage+0x108>
movups 0xf11(%rip),%xmm0
jmp    124c <errCodeToMessage+0x14c>
movups 0xf15(%rip),%xmm0
movups %xmm0,(%rsi)
movw   $0x74,0x10(%rsi)
xor    %eax,%eax
ret
movups 0xf14(%rip),%xmm0
jmp    124c <errCodeToMessage+0x14c>
movups 0xf18(%rip),%xmm0
jmp    1208 <errCodeToMessage+0x108>
movups 0xf20(%rip),%xmm0
movups %xmm0,(%rsi)
movabs $0x657a6973206570,%rax
mov    %rax,0xf(%rsi)
xor    %eax,%eax
ret
movups 0xf2c(%rip),%xmm0
movups %xmm0,0x10(%rsi)
movups 0xf11(%rip),%xmm0
movups %xmm0,(%rsi)
movw   $0x41,0x20(%rsi)
xor    %eax,%eax
ret
movups 0xf2e(%rip),%xmm0
movups %xmm0,0xe(%rsi)
movups 0xf15(%rip),%xmm0
jmp    124c <errCodeToMessage+0x14c>
movups 0xf2a(%rip),%xmm0
movups %xmm0,(%rsi)
movb   $0x0,0x10(%rsi)
xor    %eax,%eax
ret
movups 0xf39(%rip),%xmm0
movups %xmm0,0xf(%rsi)
movups 0xf1f(%rip),%xmm0
jmp    124c <errCodeToMessage+0x14c>
movups 0xf35(%rip),%xmm0
movups %xmm0,(%rsi)
movl   $0x65676e,0xf(%rsi)
xor    %eax,%eax
ret
movups 0xf3d(%rip),%xmm0
movups %xmm0,0x9(%rsi)
movups 0xf29(%rip),%xmm0
movups %xmm0,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [30 x i8] c"error while initializing curl\00"
@.str.1 = [11 x i8] c"curl error\00"
@.str.2 = [13 x i8] c"wrong format\00"
@.str.3 = [17 x i8] c"unexpected value\00"
@.str.4 = [17 x i8] c"invalid argument\00"
@.str.5 = [16 x i8] c"can't open file\00"
@.str.6 = [18 x i8] c"wrong file format\00"
@.str.7 = [16 x i8] c"bad image width\00"
@.str.8 = [17 x i8] c"bad image height\00"
@.str.9 = [23 x i8] c"incompatible type size\00"
@.str.10 = [34 x i8] c"only supported color type is RGBA\00"
@.str.11 = [30 x i8] c"only supported bit depth is 8\00"
@.str.12 = [17 x i8] c"wrong dimensions\00"
@.str.13 = [31 x i8] c"error while creating PNG image\00"
@.str.14 = [19 x i8] c"value out of range\00"
@.str.15 = [25 x i8] c"memory allocation failed\00"
define i32 @errCodeToMessage(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
switch i32 %5, label %54 [
i32 1, label %6
i32 2, label %9
i32 3, label %12
i32 4, label %15
i32 5, label %18
i32 6, label %21
i32 7, label %24
i32 8, label %27
i32 9, label %30
i32 10, label %33
i32 11, label %36
i32 12, label %39
i32 13, label %42
i32 14, label %45
i32 15, label %48
i32 16, label %51
]
6: ; preds = %2
%7 = load i8*, i8** %4
%8 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %54
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %54
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %54
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %54
18: ; preds = %2
%19 = load i8*, i8** %4
%20 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %54
21: ; preds = %2
%22 = load i8*, i8** %4
%23 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %54
24: ; preds = %2
%25 = load i8*, i8** %4
%26 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %54
27: ; preds = %2
%28 = load i8*, i8** %4
%29 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %54
30: ; preds = %2
%31 = load i8*, i8** %4
%32 = call i32 @sprintf(i8* %31, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
br label %54
33: ; preds = %2
%34 = load i8*, i8** %4
%35 = call i32 @sprintf(i8* %34, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
br label %54
36: ; preds = %2
%37 = load i8*, i8** %4
%38 = call i32 @sprintf(i8* %37, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0))
br label %54
39: ; preds = %2
%40 = load i8*, i8** %4
%41 = call i32 @sprintf(i8* %40, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0))
br label %54
42: ; preds = %2
%43 = load i8*, i8** %4
%44 = call i32 @sprintf(i8* %43, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0))
br label %54
45: ; preds = %2
%46 = load i8*, i8** %4
%47 = call i32 @sprintf(i8* %46, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0))
br label %54
48: ; preds = %2
%49 = load i8*, i8** %4
%50 = call i32 @sprintf(i8* %49, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0))
br label %54
51: ; preds = %2
%52 = load i8*, i8** %4
%53 = call i32 @sprintf(i8* %52, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.15, i64 0, i64 0))
br label %54
54: ; preds = %2, %51, %48, %45, %42, %39, %36, %33, %30, %27, %24, %21, %18, %15, %12, %9, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"error while initializing curl\00"
@.str.1 = [11 x i8] c"curl error\00"
@.str.2 = [13 x i8] c"wrong format\00"
@.str.3 = [17 x i8] c"unexpected value\00"
@.str.4 = [17 x i8] c"invalid argument\00"
@.str.5 = [16 x i8] c"can't open file\00"
@.str.6 = [18 x i8] c"wrong file format\00"
@.str.7 = [16 x i8] c"bad image width\00"
@.str.8 = [17 x i8] c"bad image height\00"
@.str.9 = [23 x i8] c"incompatible type size\00"
@.str.10 = [34 x i8] c"only supported color type is RGBA\00"
@.str.11 = [30 x i8] c"only supported bit depth is 8\00"
@.str.12 = [17 x i8] c"wrong dimensions\00"
@.str.13 = [31 x i8] c"error while creating PNG image\00"
@.str.14 = [19 x i8] c"value out of range\00"
@.str.15 = [25 x i8] c"memory allocation failed\00"
define i32 @errCodeToMessage(i32 %0, i8* nocapture writeonly %1) {
switch i32 %0, label %19 [
i32 1, label %3
i32 2, label %4
i32 3, label %5
i32 4, label %6
i32 5, label %7
i32 6, label %8
i32 7, label %9
i32 8, label %10
i32 9, label %11
i32 10, label %12
i32 11, label %13
i32 12, label %14
i32 13, label %15
i32 14, label %16
i32 15, label %17
i32 16, label %18
]
3: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(30) %1, i8* align 1 dereferenceable(30) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i64 30, i1 false)
br label %19
4: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(11) %1, i8* align 1 dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i64 11, i1 false)
br label %19
5: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(13) %1, i8* align 1 dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i64 13, i1 false)
br label %19
6: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(17) %1, i8* align 1 dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i64 17, i1 false)
br label %19
7: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(17) %1, i8* align 1 dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i64 17, i1 false)
br label %19
8: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(16) %1, i8* align 1 dereferenceable(16) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i64 16, i1 false)
br label %19
9: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(18) %1, i8* align 1 dereferenceable(18) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i64 18, i1 false)
br label %19
10: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(16) %1, i8* align 1 dereferenceable(16) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i64 16, i1 false)
br label %19
11: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(17) %1, i8* align 1 dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i64 17, i1 false)
br label %19
12: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(23) %1, i8* align 1 dereferenceable(23) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i64 23, i1 false)
br label %19
13: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(34) %1, i8* align 1 dereferenceable(34) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), i64 34, i1 false)
br label %19
14: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(30) %1, i8* align 1 dereferenceable(30) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0), i64 30, i1 false)
br label %19
15: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(17) %1, i8* align 1 dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i64 17, i1 false)
br label %19
16: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(31) %1, i8* align 1 dereferenceable(31) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0), i64 31, i1 false)
br label %19
17: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(19) %1, i8* align 1 dereferenceable(19) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0), i64 19, i1 false)
br label %19
18: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(25) %1, i8* align 1 dereferenceable(25) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.15, i64 0, i64 0), i64 25, i1 false)
br label %19
19: ; preds = %2, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3
ret i32 0
}