#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 */
typedef int /*<<< orphan*/ sm_errors;
typedef int /*<<< orphan*/ rdr_errors;
typedef int /*<<< orphan*/ p15i_errors;
typedef int /*<<< orphan*/ misc_errors;
typedef int /*<<< orphan*/ int_errors;
typedef int /*<<< orphan*/ card_errors;
typedef int /*<<< orphan*/ arg_errors;

/* Variables and functions */
const char *sc_strerror(int error) {
  const char *rdr_errors[] = {
      "Generic reader error",
      "No readers found",
      "UNUSED",
      "UNUSED",
      "Card not present",
      "Card removed",
      "Card reset",
      "Transmit failed",
      "Timed out while waiting for user input",
      "Input operation cancelled by user",
      "The two PINs did not match",
      "Message too long (keypad)",
      "Timeout while waiting for event from card reader",
      "Unresponsive card (correctly inserted?)",
      "Reader detached",
      "Reader reattached",
      "Reader in use by another application"};
  const int rdr_base = - -1100;
  const char *card_errors[] = {
      "Card command failed",
      "File not found",
      "Record not found",
      "Unsupported CLA byte in APDU",
      "Unsupported INS byte in APDU",
      "Incorrect parameters in APDU",
      "Wrong length",
      "Card memory failure",
      "Card does not support the requested operation",
      "Not allowed",
      "Card is invalid or cannot be handled",
      "Security status not satisfied",
      "Authentication method blocked",
      "Unknown data received from card",
      "PIN code or key incorrect",
      "File already exists",
      "Data object not found",
      "Not enough memory on card",
      "Part of returned data may be corrupted",
      "End of file/record reached before reading Le bytes",
      "Reference data not usable"};
  const int card_base = - -1200;
  const char *arg_errors[] = {
      "Invalid arguments",  "UNUSED",       "UNUSED", "Buffer too small",
      "Invalid PIN length", "Invalid data",
  };
  const int arg_base = - -1300;
  const char *int_errors[] = {
      "Internal error",
      "Invalid ASN.1 object",
      "Required ASN.1 object not found",
      "Premature end of ASN.1 stream",
      "Out of memory",
      "Too many objects",
      "Object not valid",
      "Requested object not found",
      "Not supported",
      "Passphrase required",
      "Inconsistent configuration",
      "Decryption failed",
      "Wrong padding",
      "Unsupported card",
      "Unable to load external module",
      "EF offset too large",
      "Not implemented",
      "Invalid Simple TLV object",
      "Premature end of Simple TLV stream",
  };
  const int int_base = - -1400;
  const char *p15i_errors[] = {
      "Generic PKCS#15 initialization error",
      "Syntax error",
      "Inconsistent or incomplete PKCS#15 profile",
      "Key length/algorithm not supported by card",
      "No default (transport) key available",
      "Non unique object ID",
      "Unable to load key and certificate(s) from file",
      "UNUSED",
      "File template not found",
      "Invalid PIN reference",
      "File too small",
  };
  const int p15i_base = - -1500;
  const char *sm_errors[] = {"Generic Secure Messaging error",
                             "Data enciphering error",
                             "Invalid secure messaging level",
                             "No session keys",
                             "Invalid session keys",
                             "Secure Messaging not initialized",
                             "Cannot authenticate card",
                             "Random generation error",
                             "Secure messaging keyset not found",
                             "IFD data missing",
                             "SM not applied",
                             "SM session already active",
                             "Invalid checksum"};
  const int sm_base = - -1600;
  const char *misc_errors[] = {
      "Unknown error",
      "PKCS#15 compatible smart card not found",
  };
  const int misc_base = - -1900;
  const char *no_errors = "Success";
  const char **errors = NULL;
  int count = 0, err_base = 0;
  if (!error)
    return no_errors;
  if (error < 0)
    error = -error;
  if (error >= misc_base) {
    errors = misc_errors;
    count = (sizeof(misc_errors) / (sizeof((misc_errors)[0])));
    err_base = misc_base;
  } else if (error >= sm_base) {
    errors = sm_errors;
    count = (sizeof(sm_errors) / (sizeof((sm_errors)[0])));
    err_base = sm_base;
  } else if (error >= p15i_base) {
    errors = p15i_errors;
    count = (sizeof(p15i_errors) / (sizeof((p15i_errors)[0])));
    err_base = p15i_base;
  } else if (error >= int_base) {
    errors = int_errors;
    count = (sizeof(int_errors) / (sizeof((int_errors)[0])));
    err_base = int_base;
  } else if (error >= arg_base) {
    errors = arg_errors;
    count = (sizeof(arg_errors) / (sizeof((arg_errors)[0])));
    err_base = arg_base;
  } else if (error >= card_base) {
    errors = card_errors;
    count = (sizeof(card_errors) / (sizeof((card_errors)[0])));
    err_base = card_base;
  } else if (error >= rdr_base) {
    errors = rdr_errors;
    count = (sizeof(rdr_errors) / (sizeof((rdr_errors)[0])));
    err_base = rdr_base;
  }
  error -= err_base;
  if (error >= count || count == 0)
    return misc_errors[0];
  return errors[error];
}


x86 assembly (clang, -O0):
<sc_strerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
mov    %edi,-0xc(%rbp)
lea    -0xa0(%rbp),%rdi
lea    0x2a24(%rip),%rsi
mov    $0x88,%edx
call   1040 <memcpy@plt>
movl   $0x44c,-0xa4(%rbp)
lea    -0x150(%rbp),%rdi
lea    0x2a92(%rip),%rsi
mov    $0xa8,%edx
call   1040 <memcpy@plt>
movl   $0x4b0,-0x154(%rbp)
lea    -0x190(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
lea    0x1231(%rip),%rax
mov    %rax,-0x190(%rbp)
lea    0xe8c(%rip),%rax
mov    %rax,-0x188(%rbp)
lea    0xe7e(%rip),%rax
mov    %rax,-0x180(%rbp)
lea    0x1219(%rip),%rax
mov    %rax,-0x178(%rbp)
lea    0x121c(%rip),%rax
mov    %rax,-0x170(%rbp)
lea    0x1221(%rip),%rax
mov    %rax,-0x168(%rbp)
movl   $0x514,-0x194(%rbp)
lea    -0x230(%rbp),%rdi
lea    0x2aaf(%rip),%rsi
mov    $0x98,%edx
call   1040 <memcpy@plt>
movl   $0x578,-0x234(%rbp)
lea    -0x290(%rbp),%rdi
lea    0x2b2d(%rip),%rsi
mov    $0x58,%edx
call   1040 <memcpy@plt>
movl   $0x5dc,-0x294(%rbp)
lea    -0x300(%rbp),%rdi
lea    0x2b6b(%rip),%rsi
mov    $0x68,%edx
call   1040 <memcpy@plt>
movl   $0x640,-0x304(%rbp)
mov    0x2bc0(%rip),%rax
mov    %rax,-0x320(%rbp)
mov    0x2bba(%rip),%rax
mov    %rax,-0x318(%rbp)
movl   $0x76c,-0x324(%rbp)
lea    0x15c3(%rip),%rax
mov    %rax,-0x330(%rbp)
movq   $0x0,-0x338(%rbp)
movl   $0x0,-0x33c(%rbp)
movl   $0x0,-0x340(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    12b6 <sc_strerror+0x196>
mov    -0x330(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    149a <sc_strerror+0x37a>
cmpl   $0x0,-0xc(%rbp)
jge    12c8 <sc_strerror+0x1a8>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x76c,-0xc(%rbp)
jl     12fc <sc_strerror+0x1dc>
lea    -0x320(%rbp),%rax
mov    %rax,-0x338(%rbp)
movl   $0x2,-0x33c(%rbp)
movl   $0x76c,-0x340(%rbp)
jmp    144d <sc_strerror+0x32d>
cmpl   $0x640,-0xc(%rbp)
jl     1330 <sc_strerror+0x210>
lea    -0x300(%rbp),%rax
mov    %rax,-0x338(%rbp)
movl   $0xd,-0x33c(%rbp)
movl   $0x640,-0x340(%rbp)
jmp    1448 <sc_strerror+0x328>
cmpl   $0x5dc,-0xc(%rbp)
jl     1364 <sc_strerror+0x244>
lea    -0x290(%rbp),%rax
mov    %rax,-0x338(%rbp)
movl   $0xb,-0x33c(%rbp)
movl   $0x5dc,-0x340(%rbp)
jmp    1443 <sc_strerror+0x323>
cmpl   $0x578,-0xc(%rbp)
jl     1398 <sc_strerror+0x278>
lea    -0x230(%rbp),%rax
mov    %rax,-0x338(%rbp)
movl   $0x13,-0x33c(%rbp)
movl   $0x578,-0x340(%rbp)
jmp    143e <sc_strerror+0x31e>
cmpl   $0x514,-0xc(%rbp)
jl     13cc <sc_strerror+0x2ac>
lea    -0x190(%rbp),%rax
mov    %rax,-0x338(%rbp)
movl   $0x6,-0x33c(%rbp)
movl   $0x514,-0x340(%rbp)
jmp    1439 <sc_strerror+0x319>
cmpl   $0x4b0,-0xc(%rbp)
jl     1400 <sc_strerror+0x2e0>
lea    -0x150(%rbp),%rax
mov    %rax,-0x338(%rbp)
movl   $0x15,-0x33c(%rbp)
movl   $0x4b0,-0x340(%rbp)
jmp    1434 <sc_strerror+0x314>
cmpl   $0x44c,-0xc(%rbp)
jl     142f <sc_strerror+0x30f>
lea    -0xa0(%rbp),%rax
mov    %rax,-0x338(%rbp)
movl   $0x11,-0x33c(%rbp)
movl   $0x44c,-0x340(%rbp)
jmp    1434 <sc_strerror+0x314>
jmp    1439 <sc_strerror+0x319>
jmp    143e <sc_strerror+0x31e>
jmp    1443 <sc_strerror+0x323>
jmp    1448 <sc_strerror+0x328>
jmp    144d <sc_strerror+0x32d>
mov    -0x340(%rbp),%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x33c(%rbp),%eax
jge    1477 <sc_strerror+0x357>
cmpl   $0x0,-0x33c(%rbp)
jne    1487 <sc_strerror+0x367>
mov    -0x320(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    149a <sc_strerror+0x37a>
mov    -0x338(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sc_strerror>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x2e8,%rsp
mov    %edi,%ebp
lea    0x2a3a(%rip),%rsi
lea    0x110(%rsp),%r14
mov    $0x88,%edx
mov    %r14,%rdi
call   1030 <memcpy@plt>
lea    0x2aae(%rip),%rsi
lea    0x240(%rsp),%r15
mov    $0xa8,%edx
mov    %r15,%rdi
call   1030 <memcpy@plt>
lea    0x125f(%rip),%rax
mov    %rax,(%rsp)
lea    0xebd(%rip),%rax
mov    %rax,0x8(%rsp)
mov    %rax,0x10(%rsp)
lea    0x1255(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0x125a(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0x1261(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0x2b02(%rip),%rsi
lea    0x1a0(%rsp),%rbx
mov    $0x98,%edx
mov    %rbx,%rdi
call   1030 <memcpy@plt>
mov    0x2bd6(%rip),%rax
mov    %rax,0x90(%rsp)
movaps 0x2bb7(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0x2b98(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0x2b7c(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0x2b60(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0x2b44(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
mov    0x2bf8(%rip),%rax
mov    %rax,0x100(%rsp)
movaps 0x2bd9(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps 0x2bba(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movaps 0x2b9b(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0x2b7c(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0x2b5d(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0x2b3e(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0x2b9f(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
test   %ebp,%ebp
je     129c <sc_strerror+0x18c>
mov    %ebp,%eax
neg    %eax
cmovs  %ebp,%eax
cmp    $0x76c,%eax
jb     12a8 <sc_strerror+0x198>
mov    $0xfffff894,%ecx
mov    $0x2,%edx
lea    0x30(%rsp),%rbx
jmp    132e <sc_strerror+0x21e>
lea    0x1596(%rip),%rax
jmp    1344 <sc_strerror+0x234>
cmp    $0x640,%eax
jb     12c3 <sc_strerror+0x1b3>
mov    $0xfffff9c0,%ecx
mov    $0xd,%edx
lea    0xa0(%rsp),%rbx
jmp    132e <sc_strerror+0x21e>
cmp    $0x5dc,%eax
jb     12db <sc_strerror+0x1cb>
mov    $0xfffffa24,%ecx
mov    $0xb,%edx
lea    0x40(%rsp),%rbx
jmp    132e <sc_strerror+0x21e>
cmp    $0x578,%eax
jb     12ee <sc_strerror+0x1de>
mov    $0xfffffa88,%ecx
mov    $0x13,%edx
jmp    132e <sc_strerror+0x21e>
cmp    $0x513,%eax
jbe    1304 <sc_strerror+0x1f4>
mov    %rsp,%rbx
mov    $0xfffffaec,%ecx
mov    $0x6,%edx
jmp    132e <sc_strerror+0x21e>
cmp    $0x4b0,%eax
jb     131a <sc_strerror+0x20a>
mov    $0xfffffb50,%ecx
mov    $0x15,%edx
mov    %r15,%rbx
jmp    132e <sc_strerror+0x21e>
cmp    $0x44c,%eax
jb     133d <sc_strerror+0x22d>
mov    $0xfffffbb4,%ecx
mov    $0x11,%edx
mov    %r14,%rbx
add    %eax,%ecx
cmp    %edx,%ecx
jge    133d <sc_strerror+0x22d>
movslq %ecx,%rax
mov    (%rbx,%rax,8),%rax
jmp    1344 <sc_strerror+0x234>
lea    0x14bf(%rip),%rax
add    $0x2e8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Generic reader error\00"
@.str.1 = [17 x i8] c"No readers found\00"
@.str.2 = [7 x i8] c"UNUSED\00"
@.str.3 = [17 x i8] c"Card not present\00"
@.str.4 = [13 x i8] c"Card removed\00"
@.str.5 = [11 x i8] c"Card reset\00"
@.str.6 = [16 x i8] c"Transmit failed\00"
@.str.7 = [39 x i8] c"Timed out while waiting for user input\00"
@.str.8 = [34 x i8] c"Input operation cancelled by user\00"
@.str.9 = [27 x i8] c"The two PINs did not match\00"
@.str.10 = [26 x i8] c"Message too long (keypad)\00"
@.str.11 = [49 x i8] c"Timeout while waiting for event from card reader\00"
@.str.12 = [40 x i8] c"Unresponsive card (correctly inserted?)\00"
@.str.13 = [16 x i8] c"Reader detached\00"
@.str.14 = [18 x i8] c"Reader reattached\00"
@.str.15 = [37 x i8] c"Reader in use by another application\00"
@__const.sc_strerror.rdr_errors = [17 x i8*] [i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.15, i32 0, i32 0)]
@.str.16 = [20 x i8] c"Card command failed\00"
@.str.17 = [15 x i8] c"File not found\00"
@.str.18 = [17 x i8] c"Record not found\00"
@.str.19 = [29 x i8] c"Unsupported CLA byte in APDU\00"
@.str.20 = [29 x i8] c"Unsupported INS byte in APDU\00"
@.str.21 = [29 x i8] c"Incorrect parameters in APDU\00"
@.str.22 = [13 x i8] c"Wrong length\00"
@.str.23 = [20 x i8] c"Card memory failure\00"
@.str.24 = [46 x i8] c"Card does not support the requested operation\00"
@.str.25 = [12 x i8] c"Not allowed\00"
@.str.26 = [37 x i8] c"Card is invalid or cannot be handled\00"
@.str.27 = [30 x i8] c"Security status not satisfied\00"
@.str.28 = [30 x i8] c"Authentication method blocked\00"
@.str.29 = [32 x i8] c"Unknown data received from card\00"
@.str.30 = [26 x i8] c"PIN code or key incorrect\00"
@.str.31 = [20 x i8] c"File already exists\00"
@.str.32 = [22 x i8] c"Data object not found\00"
@.str.33 = [26 x i8] c"Not enough memory on card\00"
@.str.34 = [39 x i8] c"Part of returned data may be corrupted\00"
@.str.35 = [51 x i8] c"End of file/record reached before reading Le bytes\00"
@.str.36 = [26 x i8] c"Reference data not usable\00"
@__const.sc_strerror.card_errors = [21 x i8*] [i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.31, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.32, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.33, i32 0, i32 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.34, i32 0, i32 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.35, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.36, i32 0, i32 0)]
@.str.37 = [18 x i8] c"Invalid arguments\00"
@.str.38 = [17 x i8] c"Buffer too small\00"
@.str.39 = [19 x i8] c"Invalid PIN length\00"
@.str.40 = [13 x i8] c"Invalid data\00"
@.str.41 = [15 x i8] c"Internal error\00"
@.str.42 = [21 x i8] c"Invalid ASN.1 object\00"
@.str.43 = [32 x i8] c"Required ASN.1 object not found\00"
@.str.44 = [30 x i8] c"Premature end of ASN.1 stream\00"
@.str.45 = [14 x i8] c"Out of memory\00"
@.str.46 = [17 x i8] c"Too many objects\00"
@.str.47 = [17 x i8] c"Object not valid\00"
@.str.48 = [27 x i8] c"Requested object not found\00"
@.str.49 = [14 x i8] c"Not supported\00"
@.str.50 = [20 x i8] c"Passphrase required\00"
@.str.51 = [27 x i8] c"Inconsistent configuration\00"
@.str.52 = [18 x i8] c"Decryption failed\00"
@.str.53 = [14 x i8] c"Wrong padding\00"
@.str.54 = [17 x i8] c"Unsupported card\00"
@.str.55 = [31 x i8] c"Unable to load external module\00"
@.str.56 = [20 x i8] c"EF offset too large\00"
@.str.57 = [16 x i8] c"Not implemented\00"
@.str.58 = [26 x i8] c"Invalid Simple TLV object\00"
@.str.59 = [35 x i8] c"Premature end of Simple TLV stream\00"
@__const.sc_strerror.int_errors = [19 x i8*] [i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.41, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.42, i32 0, i32 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.43, i32 0, i32 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.44, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.45, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.46, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.47, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.48, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.49, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.50, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.51, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.52, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.53, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.54, i32 0, i32 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.55, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.56, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.57, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.58, i32 0, i32 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.59, i32 0, i32 0)]
@.str.60 = [37 x i8] c"Generic PKCS initialization error\00"
@.str.61 = [13 x i8] c"Syntax error\00"
@.str.62 = [43 x i8] c"Inconsistent or incomplete PKCS profile\00"
@.str.63 = [43 x i8] c"Key length/algorithm not supported by card\00"
@.str.64 = [37 x i8] c"No default (transport) key available\00"
@.str.65 = [21 x i8] c"Non unique object ID\00"
@.str.66 = [48 x i8] c"Unable to load key and certificate(s) from file\00"
@.str.67 = [24 x i8] c"File template not found\00"
@.str.68 = [22 x i8] c"Invalid PIN reference\00"
@.str.69 = [15 x i8] c"File too small\00"
@__const.sc_strerror.p15i_errors = [11 x i8*] [i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.60, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.61, i32 0, i32 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.62, i32 0, i32 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.63, i32 0, i32 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.64, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.65, i32 0, i32 0), i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.66, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.67, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.68, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.69, i32 0, i32 0)]
@.str.70 = [31 x i8] c"Generic Secure Messaging error\00"
@.str.71 = [23 x i8] c"Data enciphering error\00"
@.str.72 = [31 x i8] c"Invalid secure messaging level\00"
@.str.73 = [16 x i8] c"No session keys\00"
@.str.74 = [21 x i8] c"Invalid session keys\00"
@.str.75 = [33 x i8] c"Secure Messaging not initialized\00"
@.str.76 = [25 x i8] c"Cannot authenticate card\00"
@.str.77 = [24 x i8] c"Random generation error\00"
@.str.78 = [34 x i8] c"Secure messaging keyset not found\00"
@.str.79 = [17 x i8] c"IFD data missing\00"
@.str.80 = [15 x i8] c"SM not applied\00"
@.str.81 = [26 x i8] c"SM session already active\00"
@.str.82 = [17 x i8] c"Invalid checksum\00"
@__const.sc_strerror.sm_errors = [13 x i8*] [i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.70, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.71, i32 0, i32 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.72, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.73, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.74, i32 0, i32 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.75, i32 0, i32 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.76, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.77, i32 0, i32 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.78, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.79, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.80, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.81, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.82, i32 0, i32 0)]
@.str.83 = [14 x i8] c"Unknown error\00"
@.str.84 = [40 x i8] c"PKCS compatible smart card not found\00"
@__const.sc_strerror.misc_errors = [2 x i8*] [i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.83, i32 0, i32 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.84, i32 0, i32 0)]
@.str.85 = [8 x i8] c"Success\00"
define i8* @sc_strerror(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [17 x i8*]
%5 = alloca i32
%6 = alloca [21 x i8*]
%7 = alloca i32
%8 = alloca [6 x i8*]
%9 = alloca i32
%10 = alloca [19 x i8*]
%11 = alloca i32
%12 = alloca [11 x i8*]
%13 = alloca i32
%14 = alloca [13 x i8*]
%15 = alloca i32
%16 = alloca [2 x i8*]
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i8**
%20 = alloca i32
%21 = alloca i32
store i32 %0, i32* %3
%22 = bitcast [17 x i8*]* %4 to i8*
store i32 1100, i32* %5
%23 = bitcast [21 x i8*]* %6 to i8*
store i32 1200, i32* %7
%24 = bitcast [6 x i8*]* %8 to i8*
%25 = bitcast i8* %24 to [6 x i8*]*
%26 = getelementptr inbounds [6 x i8*], [6 x i8*]* %25, i32 0, i32 0
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.37, i32 0, i32 0), i8** %26
%27 = getelementptr inbounds [6 x i8*], [6 x i8*]* %25, i32 0, i32 1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8** %27
%28 = getelementptr inbounds [6 x i8*], [6 x i8*]* %25, i32 0, i32 2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8** %28
%29 = getelementptr inbounds [6 x i8*], [6 x i8*]* %25, i32 0, i32 3
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.38, i32 0, i32 0), i8** %29
%30 = getelementptr inbounds [6 x i8*], [6 x i8*]* %25, i32 0, i32 4
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.39, i32 0, i32 0), i8** %30
%31 = getelementptr inbounds [6 x i8*], [6 x i8*]* %25, i32 0, i32 5
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.40, i32 0, i32 0), i8** %31
store i32 1300, i32* %9
%32 = bitcast [19 x i8*]* %10 to i8*
store i32 1400, i32* %11
%33 = bitcast [11 x i8*]* %12 to i8*
store i32 1500, i32* %13
%34 = bitcast [13 x i8*]* %14 to i8*
store i32 1600, i32* %15
%35 = bitcast [2 x i8*]* %16 to i8*
store i32 1900, i32* %17
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.85, i64 0, i64 0), i8** %18
store i8** null, i8*** %19
store i32 0, i32* %20
store i32 0, i32* %21
%36 = load i32, i32* %3
%37 = icmp ne i32 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %1
%39 = load i8*, i8** %18
store i8* %39, i8** %2
br label %106
40: ; preds = %1
%41 = load i32, i32* %3
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i32, i32* %3
%45 = sub nsw i32 0, %44
store i32 %45, i32* %3
br label %46
46: ; preds = %43, %40
%47 = load i32, i32* %3
%48 = icmp sge i32 %47, 1900
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = getelementptr inbounds [2 x i8*], [2 x i8*]* %16, i64 0, i64 0
store i8** %50, i8*** %19
store i32 2, i32* %20
store i32 1900, i32* %21
br label %87
51: ; preds = %46
%52 = load i32, i32* %3
%53 = icmp sge i32 %52, 1600
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = getelementptr inbounds [13 x i8*], [13 x i8*]* %14, i64 0, i64 0
store i8** %55, i8*** %19
store i32 13, i32* %20
store i32 1600, i32* %21
br label %86
56: ; preds = %51
%57 = load i32, i32* %3
%58 = icmp sge i32 %57, 1500
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = getelementptr inbounds [11 x i8*], [11 x i8*]* %12, i64 0, i64 0
store i8** %60, i8*** %19
store i32 11, i32* %20
store i32 1500, i32* %21
br label %85
61: ; preds = %56
%62 = load i32, i32* %3
%63 = icmp sge i32 %62, 1400
br i1 %63, label %64, label %66
64: ; preds = %61
%65 = getelementptr inbounds [19 x i8*], [19 x i8*]* %10, i64 0, i64 0
store i8** %65, i8*** %19
store i32 19, i32* %20
store i32 1400, i32* %21
br label %84
66: ; preds = %61
%67 = load i32, i32* %3
%68 = icmp sge i32 %67, 1300
br i1 %68, label %69, label %71
69: ; preds = %66
%70 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i64 0, i64 0
store i8** %70, i8*** %19
store i32 6, i32* %20
store i32 1300, i32* %21
br label %83
71: ; preds = %66
%72 = load i32, i32* %3
%73 = icmp sge i32 %72, 1200
br i1 %73, label %74, label %76
74: ; preds = %71
%75 = getelementptr inbounds [21 x i8*], [21 x i8*]* %6, i64 0, i64 0
store i8** %75, i8*** %19
store i32 21, i32* %20
store i32 1200, i32* %21
br label %82
76: ; preds = %71
%77 = load i32, i32* %3
%78 = icmp sge i32 %77, 1100
br i1 %78, label %79, label %81
79: ; preds = %76
%80 = getelementptr inbounds [17 x i8*], [17 x i8*]* %4, i64 0, i64 0
store i8** %80, i8*** %19
store i32 17, i32* %20
store i32 1100, i32* %21
br label %81
81: ; preds = %79, %76
br label %82
82: ; preds = %81, %74
br label %83
83: ; preds = %82, %69
br label %84
84: ; preds = %83, %64
br label %85
85: ; preds = %84, %59
br label %86
86: ; preds = %85, %54
br label %87
87: ; preds = %86, %49
%88 = load i32, i32* %21
%89 = load i32, i32* %3
%90 = sub nsw i32 %89, %88
store i32 %90, i32* %3
%91 = load i32, i32* %3
%92 = load i32, i32* %20
%93 = icmp sge i32 %91, %92
br i1 %93, label %97, label %94
94: ; preds = %87
%95 = load i32, i32* %20
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %100
97: ; preds = %94, %87
%98 = getelementptr inbounds [2 x i8*], [2 x i8*]* %16, i64 0, i64 0
%99 = load i8*, i8** %98
store i8* %99, i8** %2
br label %106
100: ; preds = %94
%101 = load i8**, i8*** %19
%102 = load i32, i32* %3
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i8*, i8** %101, i64 %103
%105 = load i8*, i8** %104
store i8* %105, i8** %2
br label %106
106: ; preds = %100, %97, %38
%107 = load i8*, i8** %2
ret i8* %107
}

LLVM IR (-O2):
@.str = [21 x i8] c"Generic reader error\00"
@.str.1 = [17 x i8] c"No readers found\00"
@.str.2 = [7 x i8] c"UNUSED\00"
@.str.3 = [17 x i8] c"Card not present\00"
@.str.4 = [13 x i8] c"Card removed\00"
@.str.5 = [11 x i8] c"Card reset\00"
@.str.6 = [16 x i8] c"Transmit failed\00"
@.str.7 = [39 x i8] c"Timed out while waiting for user input\00"
@.str.8 = [34 x i8] c"Input operation cancelled by user\00"
@.str.9 = [27 x i8] c"The two PINs did not match\00"
@.str.10 = [26 x i8] c"Message too long (keypad)\00"
@.str.11 = [49 x i8] c"Timeout while waiting for event from card reader\00"
@.str.12 = [40 x i8] c"Unresponsive card (correctly inserted?)\00"
@.str.13 = [16 x i8] c"Reader detached\00"
@.str.14 = [18 x i8] c"Reader reattached\00"
@.str.15 = [37 x i8] c"Reader in use by another application\00"
@__const.sc_strerror.rdr_errors = [17 x i8*] [i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.15, i32 0, i32 0)]
@.str.16 = [20 x i8] c"Card command failed\00"
@.str.17 = [15 x i8] c"File not found\00"
@.str.18 = [17 x i8] c"Record not found\00"
@.str.19 = [29 x i8] c"Unsupported CLA byte in APDU\00"
@.str.20 = [29 x i8] c"Unsupported INS byte in APDU\00"
@.str.21 = [29 x i8] c"Incorrect parameters in APDU\00"
@.str.22 = [13 x i8] c"Wrong length\00"
@.str.23 = [20 x i8] c"Card memory failure\00"
@.str.24 = [46 x i8] c"Card does not support the requested operation\00"
@.str.25 = [12 x i8] c"Not allowed\00"
@.str.26 = [37 x i8] c"Card is invalid or cannot be handled\00"
@.str.27 = [30 x i8] c"Security status not satisfied\00"
@.str.28 = [30 x i8] c"Authentication method blocked\00"
@.str.29 = [32 x i8] c"Unknown data received from card\00"
@.str.30 = [26 x i8] c"PIN code or key incorrect\00"
@.str.31 = [20 x i8] c"File already exists\00"
@.str.32 = [22 x i8] c"Data object not found\00"
@.str.33 = [26 x i8] c"Not enough memory on card\00"
@.str.34 = [39 x i8] c"Part of returned data may be corrupted\00"
@.str.35 = [51 x i8] c"End of file/record reached before reading Le bytes\00"
@.str.36 = [26 x i8] c"Reference data not usable\00"
@__const.sc_strerror.card_errors = [21 x i8*] [i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.31, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.32, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.33, i32 0, i32 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.34, i32 0, i32 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.35, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.36, i32 0, i32 0)]
@.str.37 = [18 x i8] c"Invalid arguments\00"
@.str.38 = [17 x i8] c"Buffer too small\00"
@.str.39 = [19 x i8] c"Invalid PIN length\00"
@.str.40 = [13 x i8] c"Invalid data\00"
@.str.41 = [15 x i8] c"Internal error\00"
@.str.42 = [21 x i8] c"Invalid ASN.1 object\00"
@.str.43 = [32 x i8] c"Required ASN.1 object not found\00"
@.str.44 = [30 x i8] c"Premature end of ASN.1 stream\00"
@.str.45 = [14 x i8] c"Out of memory\00"
@.str.46 = [17 x i8] c"Too many objects\00"
@.str.47 = [17 x i8] c"Object not valid\00"
@.str.48 = [27 x i8] c"Requested object not found\00"
@.str.49 = [14 x i8] c"Not supported\00"
@.str.50 = [20 x i8] c"Passphrase required\00"
@.str.51 = [27 x i8] c"Inconsistent configuration\00"
@.str.52 = [18 x i8] c"Decryption failed\00"
@.str.53 = [14 x i8] c"Wrong padding\00"
@.str.54 = [17 x i8] c"Unsupported card\00"
@.str.55 = [31 x i8] c"Unable to load external module\00"
@.str.56 = [20 x i8] c"EF offset too large\00"
@.str.57 = [16 x i8] c"Not implemented\00"
@.str.58 = [26 x i8] c"Invalid Simple TLV object\00"
@.str.59 = [35 x i8] c"Premature end of Simple TLV stream\00"
@__const.sc_strerror.int_errors = [19 x i8*] [i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.41, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.42, i32 0, i32 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.43, i32 0, i32 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.44, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.45, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.46, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.47, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.48, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.49, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.50, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.51, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.52, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.53, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.54, i32 0, i32 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.55, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.56, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.57, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.58, i32 0, i32 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.59, i32 0, i32 0)]
@.str.60 = [37 x i8] c"Generic PKCS initialization error\00"
@.str.61 = [13 x i8] c"Syntax error\00"
@.str.62 = [43 x i8] c"Inconsistent or incomplete PKCS profile\00"
@.str.63 = [43 x i8] c"Key length/algorithm not supported by card\00"
@.str.64 = [37 x i8] c"No default (transport) key available\00"
@.str.65 = [21 x i8] c"Non unique object ID\00"
@.str.66 = [48 x i8] c"Unable to load key and certificate(s) from file\00"
@.str.67 = [24 x i8] c"File template not found\00"
@.str.68 = [22 x i8] c"Invalid PIN reference\00"
@.str.69 = [15 x i8] c"File too small\00"
@__const.sc_strerror.p15i_errors = [11 x i8*] [i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.60, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.61, i32 0, i32 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.62, i32 0, i32 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.63, i32 0, i32 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.64, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.65, i32 0, i32 0), i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.66, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.67, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.68, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.69, i32 0, i32 0)]
@.str.70 = [31 x i8] c"Generic Secure Messaging error\00"
@.str.71 = [23 x i8] c"Data enciphering error\00"
@.str.72 = [31 x i8] c"Invalid secure messaging level\00"
@.str.73 = [16 x i8] c"No session keys\00"
@.str.74 = [21 x i8] c"Invalid session keys\00"
@.str.75 = [33 x i8] c"Secure Messaging not initialized\00"
@.str.76 = [25 x i8] c"Cannot authenticate card\00"
@.str.77 = [24 x i8] c"Random generation error\00"
@.str.78 = [34 x i8] c"Secure messaging keyset not found\00"
@.str.79 = [17 x i8] c"IFD data missing\00"
@.str.80 = [15 x i8] c"SM not applied\00"
@.str.81 = [26 x i8] c"SM session already active\00"
@.str.82 = [17 x i8] c"Invalid checksum\00"
@__const.sc_strerror.sm_errors = [13 x i8*] [i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.70, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.71, i32 0, i32 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.72, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.73, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.74, i32 0, i32 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.75, i32 0, i32 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.76, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.77, i32 0, i32 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.78, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.79, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.80, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.81, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.82, i32 0, i32 0)]
@.str.83 = [14 x i8] c"Unknown error\00"
@.str.84 = [40 x i8] c"PKCS compatible smart card not found\00"
@__const.sc_strerror.misc_errors = [2 x i8*] [i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.83, i32 0, i32 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.84, i32 0, i32 0)]
@.str.85 = [8 x i8] c"Success\00"
define i8* @sc_strerror(i32 %0) {
%2 = alloca [17 x i8*]
%3 = alloca [21 x i8*]
%4 = alloca [6 x i8*]
%5 = alloca [19 x i8*]
%6 = alloca [11 x i8*]
%7 = alloca [13 x i8*]
%8 = alloca [2 x i8*]
%9 = bitcast [17 x i8*]* %2 to i8*
%10 = bitcast [21 x i8*]* %3 to i8*
%11 = bitcast [6 x i8*]* %4 to i8*
%12 = getelementptr inbounds [6 x i8*], [6 x i8*]* %4, i64 0, i64 0
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.37, i64 0, i64 0), i8** %12
%13 = getelementptr inbounds [6 x i8*], [6 x i8*]* %4, i64 0, i64 1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %13
%14 = getelementptr inbounds [6 x i8*], [6 x i8*]* %4, i64 0, i64 2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %14
%15 = getelementptr inbounds [6 x i8*], [6 x i8*]* %4, i64 0, i64 3
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.38, i64 0, i64 0), i8** %15
%16 = getelementptr inbounds [6 x i8*], [6 x i8*]* %4, i64 0, i64 4
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.39, i64 0, i64 0), i8** %16
%17 = getelementptr inbounds [6 x i8*], [6 x i8*]* %4, i64 0, i64 5
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.40, i64 0, i64 0), i8** %17
%18 = bitcast [19 x i8*]* %5 to i8*
%19 = bitcast [11 x i8*]* %6 to i8*
%20 = bitcast [13 x i8*]* %7 to i8*
%21 = bitcast [2 x i8*]* %8 to i8*
%22 = icmp eq i32 %0, 0
br i1 %22, label %60, label %23
23: ; preds = %1
%24 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%25 = icmp ugt i32 %24, 1899
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = getelementptr inbounds [2 x i8*], [2 x i8*]* %8, i64 0, i64 0
br label %50
28: ; preds = %23
%29 = icmp ugt i32 %24, 1599
br i1 %29, label %30, label %32
30: ; preds = %28
%31 = getelementptr inbounds [13 x i8*], [13 x i8*]* %7, i64 0, i64 0
br label %50
32: ; preds = %28
%33 = icmp ugt i32 %24, 1499
br i1 %33, label %34, label %36
34: ; preds = %32
%35 = getelementptr inbounds [11 x i8*], [11 x i8*]* %6, i64 0, i64 0
br label %50
36: ; preds = %32
%37 = icmp ugt i32 %24, 1399
br i1 %37, label %38, label %40
38: ; preds = %36
%39 = getelementptr inbounds [19 x i8*], [19 x i8*]* %5, i64 0, i64 0
br label %50
40: ; preds = %36
%41 = icmp ugt i32 %24, 1299
br i1 %41, label %50, label %42
42: ; preds = %40
%43 = icmp ugt i32 %24, 1199
br i1 %43, label %44, label %46
44: ; preds = %42
%45 = getelementptr inbounds [21 x i8*], [21 x i8*]* %3, i64 0, i64 0
br label %50
46: ; preds = %42
%47 = icmp ugt i32 %24, 1099
br i1 %47, label %48, label %60
48: ; preds = %46
%49 = getelementptr inbounds [17 x i8*], [17 x i8*]* %2, i64 0, i64 0
br label %50
50: ; preds = %40, %30, %38, %44, %48, %34, %26
%51 = phi i8** [ %27, %26 ], [ %31, %30 ], [ %35, %34 ], [ %39, %38 ], [ %45, %44 ], [ %49, %48 ], [ %12, %40 ]
%52 = phi i32 [ 2, %26 ], [ 13, %30 ], [ 11, %34 ], [ 19, %38 ], [ 21, %44 ], [ 17, %48 ], [ 6, %40 ]
%53 = phi i32 [ -1900, %26 ], [ -1600, %30 ], [ -1500, %34 ], [ -1400, %38 ], [ -1200, %44 ], [ -1100, %48 ], [ -1300, %40 ]
%54 = add nsw i32 %53, %24
%55 = icmp slt i32 %54, %52
br i1 %55, label %56, label %60
56: ; preds = %50
%57 = sext i32 %54 to i64
%58 = getelementptr inbounds i8*, i8** %51, i64 %57
%59 = load i8*, i8** %58
br label %60
60: ; preds = %50, %46, %1, %56
%61 = phi i8* [ %59, %56 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.85, i64 0, i64 0), %1 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.83, i64 0, i64 0), %46 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.83, i64 0, i64 0), %50 ]
ret i8* %61
}