const char *http_error(int rc) {
  const char *http_errors[] = {"No error",
                               "File not found",
                               "Cannot open socket",
                               "Cannot resolve host",
                               "Connection refused",
                               "Communication error",
                               "Missing SSL/TLS support",
                               "Cannot load certificate file",
                               "Call https_init first",
                               "Unexpected HTTP result",
                               "Not connected",
                               "JPEG decoding error"};
  rc = -rc;
  if (rc >= 0 && rc < sizeof(http_errors) / sizeof(http_errors[0]))
    return http_errors[rc];
  return "Unknown error";
}


x86 assembly (clang, -O0):
<http_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0xc(%rbp)
lea    -0x70(%rbp),%rdi
lea    0x2c9a(%rip),%rsi
mov    $0x60,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1162 <http_error+0x52>
movslq -0xc(%rbp),%rax
cmp    $0xc,%rax
jae    1162 <http_error+0x52>
movslq -0xc(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rax
mov    %rax,-0x8(%rbp)
jmp    116d <http_error+0x5d>
lea    0xf81(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_error>:
lea    0xfe3(%rip),%rax
test   %edi,%edi
jg     1122 <http_error+0x22>
neg    %edi
cmp    $0xb,%edi
ja     1122 <http_error+0x22>
mov    %edi,%eax
lea    0xfdd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"No error\00"
@.str.1 = [15 x i8] c"File not found\00"
@.str.2 = [19 x i8] c"Cannot open socket\00"
@.str.3 = [20 x i8] c"Cannot resolve host\00"
@.str.4 = [19 x i8] c"Connection refused\00"
@.str.5 = [20 x i8] c"Communication error\00"
@.str.6 = [24 x i8] c"Missing SSL/TLS support\00"
@.str.7 = [29 x i8] c"Cannot load certificate file\00"
@.str.8 = [22 x i8] c"Call https_init first\00"
@.str.9 = [23 x i8] c"Unexpected HTTP result\00"
@.str.10 = [14 x i8] c"Not connected\00"
@.str.11 = [20 x i8] c"JPEG decoding error\00"
@__const.http_error.http_errors = [12 x i8*] [i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [14 x i8] c"Unknown error\00"
define i8* @http_error(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [12 x i8*]
store i32 %0, i32* %3
%5 = bitcast [12 x i8*]* %4 to i8*
%6 = load i32, i32* %3
%7 = sub nsw i32 0, %6
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %1
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = icmp ult i64 %12, 12
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [12 x i8*], [12 x i8*]* %4, i64 0, i64 %16
%18 = load i8*, i8** %17
store i8* %18, i8** %2
br label %20
19: ; preds = %10, %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %20
20: ; preds = %19, %14
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
@.str = [9 x i8] c"No error\00"
@.str.1 = [15 x i8] c"File not found\00"
@.str.2 = [19 x i8] c"Cannot open socket\00"
@.str.3 = [20 x i8] c"Cannot resolve host\00"
@.str.4 = [19 x i8] c"Connection refused\00"
@.str.5 = [20 x i8] c"Communication error\00"
@.str.6 = [24 x i8] c"Missing SSL/TLS support\00"
@.str.7 = [29 x i8] c"Cannot load certificate file\00"
@.str.8 = [22 x i8] c"Call https_init first\00"
@.str.9 = [23 x i8] c"Unexpected HTTP result\00"
@.str.10 = [14 x i8] c"Not connected\00"
@.str.11 = [20 x i8] c"JPEG decoding error\00"
@reltable.http_error = [12 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str to i64), i64 ptrtoint ([12 x i32]* @reltable.http_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.1 to i64), i64 ptrtoint ([12 x i32]* @reltable.http_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.2 to i64), i64 ptrtoint ([12 x i32]* @reltable.http_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.3 to i64), i64 ptrtoint ([12 x i32]* @reltable.http_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.4 to i64), i64 ptrtoint ([12 x i32]* @reltable.http_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.5 to i64), i64 ptrtoint ([12 x i32]* @reltable.http_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @.str.6 to i64), i64 ptrtoint ([12 x i32]* @reltable.http_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([29 x i8]* @.str.7 to i64), i64 ptrtoint ([12 x i32]* @reltable.http_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.8 to i64), i64 ptrtoint ([12 x i32]* @reltable.http_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.9 to i64), i64 ptrtoint ([12 x i32]* @reltable.http_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.10 to i64), i64 ptrtoint ([12 x i32]* @reltable.http_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.11 to i64), i64 ptrtoint ([12 x i32]* @reltable.http_error to i64)) to i32)]
@.str.12 = [14 x i8] c"Unknown error\00"
define i8* @http_error(i32 %0) {
%2 = sub nsw i32 0, %0
%3 = icmp slt i32 %0, 1
%4 = icmp ult i32 %2, 12
%5 = select i1 %3, i1 %4, i1 false
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = zext i32 %2 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([12 x i32]* @reltable.http_error to i8*), i64 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), %1 ]
ret i8* %11
}