void gsm_to8Bit(unsigned char in[], unsigned char out[], int len) {
  int i = 0;
  int inputOffset = 0;
  int outputOffset = 0;
  unsigned char *tmp;
  tmp = (unsigned char *)malloc(320);
  memset(tmp, 0, 320);
  while (inputOffset < len) {
    tmp[outputOffset] = (in[inputOffset] & (unsigned char)(pow(2, 7 - i) - 1));
    if (i == 8) {
      tmp[outputOffset] = in[inputOffset - 1] & 127;
      i = 1;
    } else {
      tmp[outputOffset] = tmp[outputOffset] << i;
      tmp[outputOffset] |= in[inputOffset - 1] >> (8 - i);
      inputOffset++;
      i++;
    }
    outputOffset++;
    if (outputOffset >= 320) {
      printf("Warnning: Function %s overflow in %s,%d\n", __FUNCTION__,
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/Onyx47/chan_extra/refs/heads/master/"
             "src/libgsmat/gsm_sms.c",
             171);
    }
  }
  const int UK = -1;
  const unsigned char EQ7BIT2ASCII[128] = {
      64,  163, 36,  165, 232, 223, 249, 236, 242, 199, 10,  216, 248, 13,  197,
      229, UK,  95,  UK,  UK,  UK,  UK,  UK,  UK,  UK,  UK,  UK,  UK,  198, 230,
      223, 201, 32,  33,  34,  35,  164, 37,  38,  39,  40,  41,  42,  43,  44,
      45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
      60,  61,  62,  63,  161, 65,  66,  67,  68,  69,  70,  71,  72,  73,  74,
      75,  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,
      90,  196, 204, 209, 220, 167, 191, 97,  98,  99,  100, 101, 102, 103, 104,
      105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
      120, 121, 122, 228, 246, 241, 252, 224};
  int j, k;
  for (j = 0, k = 0; j < len; j++, k++) {
    if (tmp[j] < 128) {
      if (tmp[j] == 0x1b && j + 1 < len) {
        switch (tmp[j + 1]) {
        case 0x0A:
          out[k] = 0x000C;
          j++;
          break;
        case 0x14:
          out[k] = 0x005E;
          j++;
          break;
        case 0x28:
          out[k] = 0x007B;
          j++;
          break;
        case 0x29:
          out[k] = 0x007D;
          j++;
          break;
        case 0x2F:
          out[k] = 0x005C;
          j++;
          break;
        case 0x3C:
          out[k] = 0x005B;
          j++;
          break;
        case 0x3D:
          out[k] = 0x007E;
          j++;
          break;
        case 0x3E:
          out[k] = 0x005D;
          j++;
          break;
        case 0x40:
          out[k] = 0x007C;
          j++;
          break;
        default:
          out[k] = EQ7BIT2ASCII[tmp[j]];
          break;
        }
      } else {
        out[k] = EQ7BIT2ASCII[tmp[j]];
      }
    } else {
      out[k] = tmp[j];
    }
  }
  free(tmp);
}


x86 assembly (clang, -O0):
<gsm_to8Bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    $0x140,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x140,%edx
call   1050 <memset@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12d9 <gsm_to8Bit+0x179>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0xbc(%rbp)
mov    -0x18(%rbp),%ecx
mov    $0x7,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe23(%rip),%xmm0
call   1080 <pow@plt>
mov    -0xbc(%rbp),%eax
movsd  0xe18(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
movzbl %cl,%ecx
and    %ecx,%eax
mov    %al,%dl
mov    -0x28(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
cmpl   $0x8,-0x18(%rbp)
jne    1241 <gsm_to8Bit+0xe1>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
and    $0x7f,%eax
mov    %al,%dl
mov    -0x28(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
movl   $0x1,-0x18(%rbp)
jmp    129d <gsm_to8Bit+0x13d>
mov    -0x28(%rbp),%rax
movslq -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%ecx
shl    %cl,%eax
mov    %al,%dl
mov    -0x28(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
mov    $0x8,%ecx
sub    -0x18(%rbp),%ecx
sar    %cl,%esi
mov    -0x28(%rbp),%rax
movslq -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
or     %esi,%edx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x140,-0x20(%rbp)
jl     12d4 <gsm_to8Bit+0x174>
lea    0xeb6(%rip),%rdi
lea    0xed8(%rip),%rsi
lea    0xedc(%rip),%rdx
mov    $0xab,%ecx
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11a9 <gsm_to8Bit+0x49>
movl   $0xffffffff,-0x2c(%rbp)
lea    -0xb0(%rbp),%rdi
lea    0xe02(%rip),%rsi
mov    $0x80,%edx
call   1060 <memcpy@plt>
movl   $0x0,-0xb4(%rbp)
movl   $0x0,-0xb8(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    156c <gsm_to8Bit+0x40c>
mov    -0x28(%rbp),%rax
movslq -0xb4(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x80,%eax
jge    1528 <gsm_to8Bit+0x3c8>
mov    -0x28(%rbp),%rax
movslq -0xb4(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x1b,%eax
jne    14ff <gsm_to8Bit+0x39f>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
cmp    -0x14(%rbp),%eax
jge    14ff <gsm_to8Bit+0x39f>
mov    -0x28(%rbp),%rcx
movslq -0xb4(%rbp),%rax
movzbl 0x1(%rax,%rcx,1),%eax
add    $0xfffffff6,%eax
mov    %eax,%ecx
mov    %rcx,-0xc8(%rbp)
sub    $0x36,%eax
ja     14d6 <gsm_to8Bit+0x376>
mov    -0xc8(%rbp),%rax
lea    0xc7e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
movb   $0xc,(%rax,%rcx,1)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    14fa <gsm_to8Bit+0x39a>
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
movb   $0x5e,(%rax,%rcx,1)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    14fa <gsm_to8Bit+0x39a>
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
movb   $0x7b,(%rax,%rcx,1)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    14fa <gsm_to8Bit+0x39a>
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
movb   $0x7d,(%rax,%rcx,1)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    14fa <gsm_to8Bit+0x39a>
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
movb   $0x5c,(%rax,%rcx,1)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    14fa <gsm_to8Bit+0x39a>
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
movb   $0x5b,(%rax,%rcx,1)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    14fa <gsm_to8Bit+0x39a>
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
movb   $0x7e,(%rax,%rcx,1)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    14fa <gsm_to8Bit+0x39a>
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
movb   $0x5d,(%rax,%rcx,1)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    14fa <gsm_to8Bit+0x39a>
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
movb   $0x7c,(%rax,%rcx,1)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    14fa <gsm_to8Bit+0x39a>
mov    -0x28(%rbp),%rax
movslq -0xb4(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0xb0(%rbp,%rax,1),%dl
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1523 <gsm_to8Bit+0x3c3>
mov    -0x28(%rbp),%rax
movslq -0xb4(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0xb0(%rbp,%rax,1),%dl
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1544 <gsm_to8Bit+0x3e4>
mov    -0x28(%rbp),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1549 <gsm_to8Bit+0x3e9>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    130c <gsm_to8Bit+0x1ac>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsm_to8Bit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%r15
mov    $0x1,%edi
mov    $0x140,%esi
call   1060 <calloc@plt>
mov    %rax,0x8(%rsp)
mov    %ebp,0x4(%rsp)
test   %ebp,%ebp
jle    12fb <gsm_to8Bit+0x1bb>
mov    %rbx,0x10(%rsp)
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %r14d,%r14d
mov    %r15,%rbx
jmp    119f <gsm_to8Bit+0x5f>
nopl   0x0(%rax)
add    $0x1,%r12
cmp    0x4(%rsp),%r14d
jge    125a <gsm_to8Bit+0x11a>
movslq %r14d,%r15
movzbl (%rbx,%r15,1),%ebp
mov    $0x7,%edi
sub    %r13d,%edi
movsd  0xe49(%rip),%xmm0
call   1040 <ldexp@plt>
cmp    $0x8,%r13d
je     1210 <gsm_to8Bit+0xd0>
addsd  0xe3e(%rip),%xmm0
cvttsd2si %xmm0,%eax
and    %ebp,%eax
mov    %r13d,%ecx
shl    %cl,%eax
movzbl -0x1(%r15,%rbx,1),%edx
mov    $0x8,%cl
sub    %r13b,%cl
shr    %cl,%edx
or     %eax,%edx
mov    0x8(%rsp),%rax
mov    %dl,(%rax,%r12,1)
add    $0x1,%r15d
add    $0x1,%r13d
mov    %r15d,%r14d
cmp    $0x13f,%r12
jb     1190 <gsm_to8Bit+0x50>
jmp    1234 <gsm_to8Bit+0xf4>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl -0x1(%r15,%rbx,1),%eax
and    $0x7f,%al
mov    0x8(%rsp),%rcx
mov    %al,(%rcx,%r12,1)
mov    $0x1,%r13d
cmp    $0x13f,%r12
jb     1190 <gsm_to8Bit+0x50>
lea    0xf35(%rip),%rdi
lea    0xf57(%rip),%rsi
lea    0xf5b(%rip),%rdx
mov    $0xab,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1190 <gsm_to8Bit+0x50>
cmpl   $0x0,0x4(%rsp)
mov    0x10(%rsp),%rbx
jle    12fb <gsm_to8Bit+0x1bb>
xor    %edi,%edi
lea    0xd9d(%rip),%rsi
lea    0xe76(%rip),%rbp
jmp    129a <gsm_to8Bit+0x15a>
nopl   0x0(%rax)
movzbl %al,%eax
movzbl (%rax,%rbp,1),%eax
mov    %edi,%edx
mov    %al,(%rbx)
add    $0x1,%edx
add    $0x1,%rbx
mov    %edx,%edi
cmp    0x4(%rsp),%edx
jge    12fb <gsm_to8Bit+0x1bb>
movslq %edi,%rdx
mov    0x8(%rsp),%rax
movzbl (%rax,%rdx,1),%eax
test   %al,%al
js     1287 <gsm_to8Bit+0x147>
cmp    $0x1b,%al
jne    1280 <gsm_to8Bit+0x140>
add    $0x1,%rdx
cmp    0x4(%rsp),%edx
jge    1280 <gsm_to8Bit+0x140>
mov    0x8(%rsp),%rax
movzbl (%rax,%rdx,1),%ecx
add    $0xf6,%cl
cmp    $0x36,%cl
ja     12db <gsm_to8Bit+0x19b>
mov    $0xc,%al
movzbl %cl,%ecx
movslq (%rsi,%rcx,4),%rcx
add    %rsi,%rcx
jmp    *%rcx
mov    $0x5e,%al
jmp    1289 <gsm_to8Bit+0x149>
mov    $0xff,%al
jmp    1287 <gsm_to8Bit+0x147>
mov    $0x7b,%al
jmp    1289 <gsm_to8Bit+0x149>
mov    $0x7d,%al
jmp    1289 <gsm_to8Bit+0x149>
mov    $0x5c,%al
jmp    1289 <gsm_to8Bit+0x149>
mov    $0x5b,%al
jmp    1289 <gsm_to8Bit+0x149>
mov    $0x7e,%al
jmp    1289 <gsm_to8Bit+0x149>
mov    $0x5d,%al
jmp    1289 <gsm_to8Bit+0x149>
mov    $0x7c,%al
jmp    1289 <gsm_to8Bit+0x149>
mov    0x8(%rsp),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Warnning: Function %s overflow in %s,%d\0A\00"
@__FUNCTION__.gsm_to8Bit = [11 x i8] c"gsm_to8Bit\00"
@.str.1 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Onyx47/chan_extra/refs/heads/master/src/libgsmat/gsm_sms.c\00"
@__const.gsm_to8Bit.EQ7BIT2ASCII = [128 x i8] c"@\A3$\A5\E8\DF\F9\EC\F2\C7\0A\D8\F8\0D\C5\E5\FF_\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\C6\E6\DF\C9 !\22#\A4%&'()*+,-./0123456789:;<=>?\A1ABCDEFGHIJKLMNOPQRSTUVWXYZ\C4\CC\D1\DC\A7\BFabcdefghijklmnopqrstuvwxyz\E4\F6\F1\FC\E0"
define void @gsm_to8Bit(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca [128 x i8]
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
%15 = call i8* @malloc(i64 320)
store i8* %15, i8** %10
%16 = load i8*, i8** %10
br label %17
17: ; preds = %100, %3
%18 = load i32, i32* %8
%19 = load i32, i32* %6
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %101
21: ; preds = %17
%22 = load i8*, i8** %4
%23 = load i32, i32* %8
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = load i32, i32* %7
%29 = sub nsw i32 7, %28
%30 = sitofp i32 %29 to double
%31 = call double @pow(double 2.000000e+00, double %30)
%32 = fsub double %31, 1.000000e+00
%33 = fptoui double %32 to i8
%34 = zext i8 %33 to i32
%35 = and i32 %27, %34
%36 = trunc i32 %35 to i8
%37 = load i8*, i8** %10
%38 = load i32, i32* %9
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
store i8 %36, i8* %40
%41 = load i32, i32* %7
%42 = icmp eq i32 %41, 8
br i1 %42, label %43, label %57
43: ; preds = %21
%44 = load i8*, i8** %4
%45 = load i32, i32* %8
%46 = sub nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %44, i64 %47
%49 = load i8, i8* %48
%50 = zext i8 %49 to i32
%51 = and i32 %50, 127
%52 = trunc i32 %51 to i8
%53 = load i8*, i8** %10
%54 = load i32, i32* %9
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
store i8 %52, i8* %56
store i32 1, i32* %7
br label %93
57: ; preds = %21
%58 = load i8*, i8** %10
%59 = load i32, i32* %9
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %58, i64 %60
%62 = load i8, i8* %61
%63 = zext i8 %62 to i32
%64 = load i32, i32* %7
%65 = shl i32 %63, %64
%66 = trunc i32 %65 to i8
%67 = load i8*, i8** %10
%68 = load i32, i32* %9
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8, i8* %67, i64 %69
store i8 %66, i8* %70
%71 = load i8*, i8** %4
%72 = load i32, i32* %8
%73 = sub nsw i32 %72, 1
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8, i8* %71, i64 %74
%76 = load i8, i8* %75
%77 = zext i8 %76 to i32
%78 = load i32, i32* %7
%79 = sub nsw i32 8, %78
%80 = ashr i32 %77, %79
%81 = load i8*, i8** %10
%82 = load i32, i32* %9
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %81, i64 %83
%85 = load i8, i8* %84
%86 = zext i8 %85 to i32
%87 = or i32 %86, %80
%88 = trunc i32 %87 to i8
store i8 %88, i8* %84
%89 = load i32, i32* %8
%90 = add nsw i32 %89, 1
store i32 %90, i32* %8
%91 = load i32, i32* %7
%92 = add nsw i32 %91, 1
store i32 %92, i32* %7
br label %93
93: ; preds = %57, %43
%94 = load i32, i32* %9
%95 = add nsw i32 %94, 1
store i32 %95, i32* %9
%96 = load i32, i32* %9
%97 = icmp sge i32 %96, 320
br i1 %97, label %98, label %100
98: ; preds = %93
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__FUNCTION__.gsm_to8Bit, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 171)
br label %100
100: ; preds = %98, %93
br label %17
101: ; preds = %17
store i32 -1, i32* %11
%102 = bitcast [128 x i8]* %12 to i8*
store i32 0, i32* %13
store i32 0, i32* %14
br label %103
103: ; preds = %238, %101
%104 = load i32, i32* %13
%105 = load i32, i32* %6
%106 = icmp slt i32 %104, %105
br i1 %106, label %107, label %243
107: ; preds = %103
%108 = load i8*, i8** %10
%109 = load i32, i32* %13
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i8, i8* %108, i64 %110
%112 = load i8, i8* %111
%113 = zext i8 %112 to i32
%114 = icmp slt i32 %113, 128
br i1 %114, label %115, label %227
115: ; preds = %107
%116 = load i8*, i8** %10
%117 = load i32, i32* %13
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8, i8* %116, i64 %118
%120 = load i8, i8* %119
%121 = zext i8 %120 to i32
%122 = icmp eq i32 %121, 27
br i1 %122, label %123, label %213
123: ; preds = %115
%124 = load i32, i32* %13
%125 = add nsw i32 %124, 1
%126 = load i32, i32* %6
%127 = icmp slt i32 %125, %126
br i1 %127, label %128, label %213
128: ; preds = %123
%129 = load i8*, i8** %10
%130 = load i32, i32* %13
%131 = add nsw i32 %130, 1
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i8, i8* %129, i64 %132
%134 = load i8, i8* %133
%135 = zext i8 %134 to i32
switch i32 %135, label %199 [
i32 10, label %136
i32 20, label %143
i32 40, label %150
i32 41, label %157
i32 47, label %164
i32 60, label %171
i32 61, label %178
i32 62, label %185
i32 64, label %192
]
136: ; preds = %128
%137 = load i8*, i8** %5
%138 = load i32, i32* %14
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds i8, i8* %137, i64 %139
store i8 12, i8* %140
%141 = load i32, i32* %13
%142 = add nsw i32 %141, 1
store i32 %142, i32* %13
br label %212
143: ; preds = %128
%144 = load i8*, i8** %5
%145 = load i32, i32* %14
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i8, i8* %144, i64 %146
store i8 94, i8* %147
%148 = load i32, i32* %13
%149 = add nsw i32 %148, 1
store i32 %149, i32* %13
br label %212
150: ; preds = %128
%151 = load i8*, i8** %5
%152 = load i32, i32* %14
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds i8, i8* %151, i64 %153
store i8 123, i8* %154
%155 = load i32, i32* %13
%156 = add nsw i32 %155, 1
store i32 %156, i32* %13
br label %212
157: ; preds = %128
%158 = load i8*, i8** %5
%159 = load i32, i32* %14
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i8, i8* %158, i64 %160
store i8 125, i8* %161
%162 = load i32, i32* %13
%163 = add nsw i32 %162, 1
store i32 %163, i32* %13
br label %212
164: ; preds = %128
%165 = load i8*, i8** %5
%166 = load i32, i32* %14
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds i8, i8* %165, i64 %167
store i8 92, i8* %168
%169 = load i32, i32* %13
%170 = add nsw i32 %169, 1
store i32 %170, i32* %13
br label %212
171: ; preds = %128
%172 = load i8*, i8** %5
%173 = load i32, i32* %14
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds i8, i8* %172, i64 %174
store i8 91, i8* %175
%176 = load i32, i32* %13
%177 = add nsw i32 %176, 1
store i32 %177, i32* %13
br label %212
178: ; preds = %128
%179 = load i8*, i8** %5
%180 = load i32, i32* %14
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds i8, i8* %179, i64 %181
store i8 126, i8* %182
%183 = load i32, i32* %13
%184 = add nsw i32 %183, 1
store i32 %184, i32* %13
br label %212
185: ; preds = %128
%186 = load i8*, i8** %5
%187 = load i32, i32* %14
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds i8, i8* %186, i64 %188
store i8 93, i8* %189
%190 = load i32, i32* %13
%191 = add nsw i32 %190, 1
store i32 %191, i32* %13
br label %212
192: ; preds = %128
%193 = load i8*, i8** %5
%194 = load i32, i32* %14
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds i8, i8* %193, i64 %195
store i8 124, i8* %196
%197 = load i32, i32* %13
%198 = add nsw i32 %197, 1
store i32 %198, i32* %13
br label %212
199: ; preds = %128
%200 = load i8*, i8** %10
%201 = load i32, i32* %13
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds i8, i8* %200, i64 %202
%204 = load i8, i8* %203
%205 = zext i8 %204 to i64
%206 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 %205
%207 = load i8, i8* %206
%208 = load i8*, i8** %5
%209 = load i32, i32* %14
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds i8, i8* %208, i64 %210
store i8 %207, i8* %211
br label %212
212: ; preds = %199, %192, %185, %178, %171, %164, %157, %150, %143, %136
br label %226
213: ; preds = %123, %115
%214 = load i8*, i8** %10
%215 = load i32, i32* %13
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds i8, i8* %214, i64 %216
%218 = load i8, i8* %217
%219 = zext i8 %218 to i64
%220 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 %219
%221 = load i8, i8* %220
%222 = load i8*, i8** %5
%223 = load i32, i32* %14
%224 = sext i32 %223 to i64
%225 = getelementptr inbounds i8, i8* %222, i64 %224
store i8 %221, i8* %225
br label %226
226: ; preds = %213, %212
br label %237
227: ; preds = %107
%228 = load i8*, i8** %10
%229 = load i32, i32* %13
%230 = sext i32 %229 to i64
%231 = getelementptr inbounds i8, i8* %228, i64 %230
%232 = load i8, i8* %231
%233 = load i8*, i8** %5
%234 = load i32, i32* %14
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds i8, i8* %233, i64 %235
store i8 %232, i8* %236
br label %237
237: ; preds = %227, %226
br label %238
238: ; preds = %237
%239 = load i32, i32* %13
%240 = add nsw i32 %239, 1
store i32 %240, i32* %13
%241 = load i32, i32* %14
%242 = add nsw i32 %241, 1
store i32 %242, i32* %14
br label %103
243: ; preds = %103
%244 = load i8*, i8** %10
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"Warnning: Function %s overflow in %s,%d\0A\00"
@__FUNCTION__.gsm_to8Bit = [11 x i8] c"gsm_to8Bit\00"
@.str.1 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Onyx47/chan_extra/refs/heads/master/src/libgsmat/gsm_sms.c\00"
@__const.gsm_to8Bit.EQ7BIT2ASCII = [128 x i8] c"@\A3$\A5\E8\DF\F9\EC\F2\C7\0A\D8\F8\0D\C5\E5\FF_\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\C6\E6\DF\C9 !\22#\A4%&'()*+,-./0123456789:;<=>?\A1ABCDEFGHIJKLMNOPQRSTUVWXYZ\C4\CC\D1\DC\A7\BFabcdefghijklmnopqrstuvwxyz\E4\F6\F1\FC\E0"
define void @gsm_to8Bit(i8* nocapture %0, i8* nocapture writeonly %1, i32 %2) {
%4 = call dereferenceable_or_null(320) i8* @calloc(i64 1, i64 320)
%5 = icmp sgt i32 %2, 0
br i1 %5, label %7, label %86
6: ; preds = %48
br i1 %5, label %50, label %86
7: ; preds = %3, %48
%8 = phi i64 [ %44, %48 ], [ 0, %3 ]
%9 = phi i32 [ %43, %48 ], [ 0, %3 ]
%10 = phi i32 [ %42, %48 ], [ 0, %3 ]
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = sub nsw i32 7, %9
%15 = tail call double @ldexp(double 1.000000e+00, i32 %14)
%16 = getelementptr inbounds i8, i8* %4, i64 %8
%17 = icmp eq i32 %9, 8
br i1 %17, label %18, label %24
18: ; preds = %7
%19 = add nsw i32 %10, -1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = load i8, i8* %21
%23 = and i8 %22, 127
store i8 %23, i8* %16
br label %41
24: ; preds = %7
%25 = fadd double %15, -1.000000e+00
%26 = fptoui double %25 to i8
%27 = and i8 %13, %26
%28 = zext i8 %27 to i32
%29 = shl i32 %28, %9
%30 = add nsw i32 %10, -1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %0, i64 %31
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
%35 = sub nsw i32 8, %9
%36 = lshr i32 %34, %35
%37 = or i32 %36, %29
%38 = trunc i32 %37 to i8
store i8 %38, i8* %16
%39 = add nsw i32 %10, 1
%40 = add nsw i32 %9, 1
br label %41
41: ; preds = %24, %18
%42 = phi i32 [ %10, %18 ], [ %39, %24 ]
%43 = phi i32 [ 1, %18 ], [ %40, %24 ]
%44 = add nuw i64 %8, 1
%45 = icmp ugt i64 %8, 318
br i1 %45, label %46, label %48
46: ; preds = %41
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__FUNCTION__.gsm_to8Bit, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 171)
br label %48
48: ; preds = %46, %41
%49 = icmp slt i32 %42, %2
br i1 %49, label %7, label %6
50: ; preds = %6, %79
%51 = phi i64 [ %84, %79 ], [ 0, %6 ]
%52 = phi i32 [ %83, %79 ], [ 0, %6 ]
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %4, i64 %53
%55 = load i8, i8* %54
%56 = icmp sgt i8 %55, -1
br i1 %56, label %57, label %79
57: ; preds = %50
%58 = icmp eq i8 %55, 27
br i1 %58, label %59, label %75
59: ; preds = %57
%60 = add nsw i32 %52, 1
%61 = icmp slt i32 %60, %2
br i1 %61, label %62, label %75
62: ; preds = %59
%63 = sext i32 %60 to i64
%64 = getelementptr inbounds i8, i8* %4, i64 %63
%65 = load i8, i8* %64
switch i8 %65, label %74 [
i8 10, label %79
i8 20, label %66
i8 40, label %67
i8 41, label %68
i8 47, label %69
i8 60, label %70
i8 61, label %71
i8 62, label %72
i8 64, label %73
]
66: ; preds = %62
br label %79
67: ; preds = %62
br label %79
68: ; preds = %62
br label %79
69: ; preds = %62
br label %79
70: ; preds = %62
br label %79
71: ; preds = %62
br label %79
72: ; preds = %62
br label %79
73: ; preds = %62
br label %79
74: ; preds = %62
br label %79
75: ; preds = %59, %57
%76 = zext i8 %55 to i64
%77 = getelementptr inbounds [128 x i8], [128 x i8]* @__const.gsm_to8Bit.EQ7BIT2ASCII, i64 0, i64 %76
%78 = load i8, i8* %77
br label %79
79: ; preds = %50, %62, %66, %67, %68, %69, %70, %71, %72, %73, %74, %75
%80 = phi i8 [ 94, %66 ], [ 123, %67 ], [ 125, %68 ], [ 92, %69 ], [ 91, %70 ], [ 126, %71 ], [ 93, %72 ], [ 124, %73 ], [ -1, %74 ], [ %78, %75 ], [ 12, %62 ], [ %55, %50 ]
%81 = phi i32 [ %60, %66 ], [ %60, %67 ], [ %60, %68 ], [ %60, %69 ], [ %60, %70 ], [ %60, %71 ], [ %60, %72 ], [ %60, %73 ], [ %52, %74 ], [ %52, %75 ], [ %60, %62 ], [ %52, %50 ]
%82 = getelementptr inbounds i8, i8* %1, i64 %51
store i8 %80, i8* %82
%83 = add nsw i32 %81, 1
%84 = add nuw i64 %51, 1
%85 = icmp slt i32 %83, %2
br i1 %85, label %50, label %86
86: ; preds = %79, %3, %6
tail call void @free(i8* %4)
ret void
}