#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 m_bit_set_error_string(int code, char **out_error_string) {
  char *error_strings[] = {"False",
                           "True",
                           "OK",
                           "One of the objects is NULL",
                           "Size of the memory is zero",
                           "Value out of range",
                           "I/O error",
                           "Unknown return code",
                           "Magic number mismatch"};
  if (out_error_string == NULL)
    return 3;
  if (code < 0 || code > 10) {
    *out_error_string = NULL;
    return 9;
  }
  *out_error_string = error_strings[code];
  return 2;
}


x86 assembly (clang, -O0):
<m_bit_set_error_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
lea    0x2ca6(%rip),%rsi
mov    $0x48,%edx
call   1030 <memcpy@plt>
cmpq   $0x0,-0x10(%rbp)
jne    114b <m_bit_set_error_string+0x3b>
movl   $0x3,-0x4(%rbp)
jmp    118d <m_bit_set_error_string+0x7d>
cmpl   $0x0,-0x8(%rbp)
jl     115f <m_bit_set_error_string+0x4f>
cmpl   $0xa,-0x8(%rbp)
jle    1176 <m_bit_set_error_string+0x66>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
movl   $0x9,-0x4(%rbp)
jmp    118d <m_bit_set_error_string+0x7d>
movslq -0x8(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_bit_set_error_string>:
test   %rsi,%rsi
je     1115 <m_bit_set_error_string+0x15>
cmp    $0xa,%edi
jbe    111b <m_bit_set_error_string+0x1b>
mov    $0x9,%eax
xor    %ecx,%ecx
mov    %rcx,(%rsi)
ret
mov    $0x3,%eax
ret
mov    %edi,%eax
lea    0xf68(%rip),%rdx
movslq (%rdx,%rax,4),%rcx
add    %rdx,%rcx
mov    $0x2,%eax
mov    %rcx,(%rsi)
ret

LLVM IR (-O0):
@.str = [6 x i8] c"False\00"
@.str.1 = [5 x i8] c"True\00"
@.str.2 = [3 x i8] c"OK\00"
@.str.3 = [27 x i8] c"One of the objects is NULL\00"
@.str.4 = [27 x i8] c"Size of the memory is zero\00"
@.str.5 = [19 x i8] c"Value out of range\00"
@.str.6 = [10 x i8] c"I/O error\00"
@.str.7 = [20 x i8] c"Unknown return code\00"
@.str.8 = [22 x i8] c"Magic number mismatch\00"
@__const.m_bit_set_error_string.error_strings = [9 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i32 0, i32 0)]
define i32 @m_bit_set_error_string(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [9 x i8*]
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [9 x i8*]* %6 to i8*
%8 = load i8**, i8*** %5
%9 = icmp eq i8** %8, null
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 3, i32* %3
br label %25
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 10
br i1 %16, label %17, label %19
17: ; preds = %14, %11
%18 = load i8**, i8*** %5
store i8* null, i8** %18
store i32 9, i32* %3
br label %25
19: ; preds = %14
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [9 x i8*], [9 x i8*]* %6, i64 0, i64 %21
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
store i8* %23, i8** %24
store i32 2, i32* %3
br label %25
25: ; preds = %19, %17, %10
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [6 x i8] c"False\00"
@.str.1 = [5 x i8] c"True\00"
@.str.2 = [3 x i8] c"OK\00"
@.str.3 = [27 x i8] c"One of the objects is NULL\00"
@.str.4 = [27 x i8] c"Size of the memory is zero\00"
@.str.5 = [19 x i8] c"Value out of range\00"
@.str.6 = [10 x i8] c"I/O error\00"
@.str.7 = [20 x i8] c"Unknown return code\00"
@.str.8 = [22 x i8] c"Magic number mismatch\00"
@reltable.m_bit_set_error_string = [9 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([9 x i32]* @reltable.m_bit_set_error_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64 ptrtoint ([9 x i32]* @reltable.m_bit_set_error_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([9 x i32]* @reltable.m_bit_set_error_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.3 to i64), i64 ptrtoint ([9 x i32]* @reltable.m_bit_set_error_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.4 to i64), i64 ptrtoint ([9 x i32]* @reltable.m_bit_set_error_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.5 to i64), i64 ptrtoint ([9 x i32]* @reltable.m_bit_set_error_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.6 to i64), i64 ptrtoint ([9 x i32]* @reltable.m_bit_set_error_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.7 to i64), i64 ptrtoint ([9 x i32]* @reltable.m_bit_set_error_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.8 to i64), i64 ptrtoint ([9 x i32]* @reltable.m_bit_set_error_string to i64)) to i32)]
define i32 @m_bit_set_error_string(i32 %0, i8** writeonly %1) {
%3 = icmp eq i8** %1, null
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = icmp ugt i32 %0, 10
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = zext i32 %0 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([9 x i32]* @reltable.m_bit_set_error_string to i8*), i64 %8)
br label %10
10: ; preds = %4, %6
%11 = phi i8* [ %9, %6 ], [ null, %4 ]
%12 = phi i32 [ 2, %6 ], [ 9, %4 ]
store i8* %11, i8** %1
br label %13
13: ; preds = %10, %2
%14 = phi i32 [ 3, %2 ], [ %12, %10 ]
ret i32 %14
}