#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 char argv;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(unsigned char *);
unsigned char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int strlen(char *);
int main(int argc, char **argv) {
  FILE *output_device;
  char target_phone[12];
  unsigned char *sms_string;
  int i, l, m;
  unsigned int n;
  int intext_length, sms_string_length;
  if (argc != 4) {
    printf("usage: %s </dev/device> <phone-no> <sms text>\n", argv[0]);
    exit(-1);
  }
  i = strlen((argv[2]));
  if (i == 11 && (argv[2])[0] == '0') {
    target_phone[0] = '4';
    target_phone[1] = '4';
    memcpy(target_phone + 2, (argv[2]) + 1, 10);
  } else if (i == 12) {
    memcpy(target_phone, (argv[2]), 12);
  } else if (i == 13 && (argv[2])[0] == '+') {
    memcpy(target_phone, (argv[2]) + 1, 12);
  } else {
    printf("Invalid length for phone number '%s': %i\n", (argv[2]), i);
    exit(-1);
  }
  for (i = 0; i < 12; i++) {
    if (target_phone[i] < '0' || target_phone[i] > '9') {
      if (((unsigned char)target_phone[i]) < 32 ||
          ((unsigned char)target_phone[i]) > 126)
        printf("Invalid char in phone number: 0x'%.2X'\n",
               (unsigned char)target_phone[i]);
      else
        printf("Invalid char in phone number: '%c'\n", target_phone[i]);
      exit(-1);
    }
  }
  intext_length = strlen((argv[3]));
  if (intext_length > 160) {
    printf("Text is too long at %i chars. Max is 160.\n", i);
    exit(-1);
  }
  if (intext_length < 1) {
    printf("No text supplied for the SMS.\n");
    exit(-1);
  }
  i = intext_length * 7;
  m = i % 8;
  if (m != 0)
    i += (8 - m);
  sms_string_length = i / 8;
  sms_string = malloc(sms_string_length);
  if (sms_string == NULL) {
    printf("Unable to malloc '%i' bytes for variable 'sms_string'\n",
           sms_string_length);
    exit(-1);
  }
  memset(sms_string, 0, sms_string_length);
  m = 0;
  l = 0;
  for (i = 0; i < intext_length; i++) {
    if (((unsigned char)(argv[3])[i]) < 32 ||
        ((unsigned char)(argv[3])[i]) > 126) {
      printf("Invalid character in text input: 0x'%.2X'\n",
             (unsigned char)(argv[3])[i]);
      exit(-1);
    }
    n = (argv[3])[i];
    if (n == '$') {
      n = 0x02;
    }
    n = n << l;
    *((unsigned int *)(&sms_string[m])) |= n;
    l += 7;
    if (l >= 8) {
      l -= 8;
      m++;
    }
  }
  output_device = fopen((argv[1]), "wb");
  if (output_device == NULL) {
    perror("Unable to open output device");
    exit(-1);
  }
  fprintf(output_device, "AT+CMGF=0\r\n");
  fflush(output_device);
  sleep(1);
  fprintf(output_device, "AT+CMGS=%i\r\n", 14 + sms_string_length);
  fflush(output_device);
  sleep(1);
  fprintf(output_device, "0011000C91");
  for (i = 0; i < 12; i += 2) {
    fprintf(output_device, "%c%c", target_phone[i + 1], target_phone[i]);
  }
  fprintf(output_device, "0000AA");
  fprintf(output_device, "%.2X", intext_length);
  for (i = 0; i < sms_string_length; i++)
    fprintf(output_device, "%.2X", sms_string[i]);
  sleep(1);
  fprintf(output_device, "%c", 0x1a);
  fflush(output_device);
  sleep(1);
  fclose(output_device);
  free(sms_string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     120f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xb,-0x34(%rbp)
jne    1268 <main+0x98>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    1268 <main+0x98>
movb   $0x34,-0x24(%rbp)
movb   $0x34,-0x23(%rbp)
lea    -0x24(%rbp),%rdi
add    $0x2,%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
add    $0x1,%rsi
mov    $0xa,%edx
call   1090 <memcpy@plt>
jmp    12f7 <main+0x127>
cmpl   $0xc,-0x34(%rbp)
jne    128d <main+0xbd>
lea    -0x24(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    $0xc,%edx
call   1090 <memcpy@plt>
jmp    12f2 <main+0x122>
cmpl   $0xd,-0x34(%rbp)
jne    12ca <main+0xfa>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    12ca <main+0xfa>
lea    -0x24(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
add    $0x1,%rsi
mov    $0xc,%edx
call   1090 <memcpy@plt>
jmp    12ed <main+0x11d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x34(%rbp),%edx
lea    0xd53(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
jmp    12f2 <main+0x122>
jmp    12f7 <main+0x127>
movl   $0x0,-0x34(%rbp)
cmpl   $0xc,-0x34(%rbp)
jge    13a0 <main+0x1d0>
movslq -0x34(%rbp),%rax
movsbl -0x24(%rbp,%rax,1),%eax
cmp    $0x30,%eax
jl     132c <main+0x15c>
movslq -0x34(%rbp),%rax
movsbl -0x24(%rbp,%rax,1),%eax
cmp    $0x39,%eax
jle    138d <main+0x1bd>
movslq -0x34(%rbp),%rax
movzbl -0x24(%rbp,%rax,1),%eax
cmp    $0x20,%eax
jl     1350 <main+0x180>
movslq -0x34(%rbp),%rax
movzbl -0x24(%rbp,%rax,1),%eax
cmp    $0x7e,%eax
jle    136c <main+0x19c>
movslq -0x34(%rbp),%rax
movzbl -0x24(%rbp,%rax,1),%esi
lea    0xcf9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1383 <main+0x1b3>
movslq -0x34(%rbp),%rax
movsbl -0x24(%rbp,%rax,1),%esi
lea    0xd05(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
jmp    1392 <main+0x1c2>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12fe <main+0x12e>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0xa0,-0x44(%rbp)
jle    13d8 <main+0x208>
mov    -0x34(%rbp),%esi
lea    0xcde(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
cmpl   $0x1,-0x44(%rbp)
jge    13fa <main+0x22a>
lea    0xce7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
imul   $0x7,-0x44(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     1427 <main+0x257>
mov    $0x8,%eax
sub    -0x3c(%rbp),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%edi
call   10a0 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1467 <main+0x297>
mov    -0x48(%rbp),%esi
lea    0xc99(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    -0x30(%rbp),%rdi
mov    -0x48(%rbp),%edx
xor    %esi,%esi
call   1070 <memset@plt>
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1568 <main+0x398>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movslq -0x34(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jl     14c8 <main+0x2f8>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movslq -0x34(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x7e,%eax
jle    14f0 <main+0x320>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movslq -0x34(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xc47(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x24,-0x40(%rbp)
jne    1514 <main+0x344>
movl   $0x2,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    -0x38(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%edx
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
or     (%rax,%rcx,1),%edx
mov    %edx,(%rax,%rcx,1)
mov    -0x38(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x8,-0x38(%rbp)
jl     1555 <main+0x385>
mov    -0x38(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    155a <main+0x38a>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    148a <main+0x2ba>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xbda(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    15a1 <main+0x3d1>
lea    0xbc2(%rip),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    0xbc5(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   10b0 <fflush@plt>
mov    $0x1,%edi
call   10f0 <sleep@plt>
mov    -0x18(%rbp),%rdi
mov    -0x48(%rbp),%edx
add    $0xe,%edx
lea    0xba6(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   10b0 <fflush@plt>
mov    $0x1,%edi
call   10f0 <sleep@plt>
mov    -0x18(%rbp),%rdi
lea    0xb8e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xc,-0x34(%rbp)
jge    164a <main+0x47a>
mov    -0x18(%rbp),%rdi
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x24(%rbp,%rax,1),%edx
movslq -0x34(%rbp),%rax
movsbl -0x24(%rbp,%rax,1),%ecx
lea    0xb60(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x34(%rbp)
jmp    160a <main+0x43a>
mov    -0x18(%rbp),%rdi
lea    0xb45(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x44(%rbp),%edx
lea    0xb37(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    16b0 <main+0x4e0>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xb06(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1678 <main+0x4a8>
mov    $0x1,%edi
call   10f0 <sleep@plt>
mov    -0x18(%rbp),%rdi
lea    0xad2(%rip),%rsi
mov    $0x1a,%edx
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   10b0 <fflush@plt>
mov    $0x1,%edi
call   10f0 <sleep@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
cmp    $0x4,%edi
jne    160a <main+0x40a>
mov    0x10(%r14),%rdi
call   1060 <strlen@plt>
cmp    $0xb,%eax
je     1249 <main+0x49>
cmp    $0xc,%eax
je     126d <main+0x6d>
cmp    $0xd,%eax
jne    166a <main+0x46a>
mov    0x10(%r14),%rsi
cmpb   $0x2b,(%rsi)
jne    166e <main+0x46e>
add    $0x1,%rsi
jmp    1271 <main+0x71>
mov    0x10(%r14),%rsi
cmpb   $0x30,(%rsi)
jne    166e <main+0x46e>
movw   $0x3434,0x4(%rsp)
lea    0x6(%rsp),%rdi
add    $0x1,%rsi
mov    $0xa,%edx
jmp    127b <main+0x7b>
mov    0x10(%r14),%rsi
lea    0x4(%rsp),%rdi
mov    $0xc,%edx
call   10b0 <memcpy@plt>
mov    0x4(%rsp),%al
lea    -0x3a(%rax),%ecx
cmp    $0xf5,%cl
jbe    15de <main+0x3de>
mov    0x5(%rsp),%al
lea    -0x3a(%rax),%ecx
cmp    $0xf6,%cl
jb     15de <main+0x3de>
mov    0x6(%rsp),%al
lea    -0x3a(%rax),%ecx
cmp    $0xf6,%cl
jb     15de <main+0x3de>
mov    0x7(%rsp),%al
lea    -0x3a(%rax),%ecx
cmp    $0xf6,%cl
jb     15de <main+0x3de>
mov    0x8(%rsp),%al
lea    -0x3a(%rax),%ecx
cmp    $0xf6,%cl
jb     15de <main+0x3de>
mov    0x9(%rsp),%al
lea    -0x3a(%rax),%ecx
cmp    $0xf6,%cl
jb     15de <main+0x3de>
mov    0xa(%rsp),%al
lea    -0x3a(%rax),%ecx
cmp    $0xf6,%cl
jb     15de <main+0x3de>
mov    0xb(%rsp),%al
lea    -0x3a(%rax),%ecx
cmp    $0xf6,%cl
jb     15de <main+0x3de>
mov    0xc(%rsp),%al
lea    -0x3a(%rax),%ecx
cmp    $0xf6,%cl
jb     15de <main+0x3de>
mov    0xd(%rsp),%al
lea    -0x3a(%rax),%ecx
cmp    $0xf6,%cl
jb     15de <main+0x3de>
mov    0xe(%rsp),%al
lea    -0x3a(%rax),%ecx
cmp    $0xf6,%cl
jb     15de <main+0x3de>
mov    0xf(%rsp),%al
lea    -0x3a(%rax),%ecx
cmp    $0xf6,%cl
jb     15de <main+0x3de>
mov    0x18(%r14),%rdi
call   1060 <strlen@plt>
cmp    $0xa1,%eax
jge    1625 <main+0x425>
mov    %eax,%r13d
test   %eax,%eax
jle    1633 <main+0x433>
lea    0x0(,%r13,8),%eax
sub    %r13d,%eax
mov    %eax,%ecx
and    $0x7,%ecx
mov    $0x8,%r12d
sub    %ecx,%r12d
test   %ecx,%ecx
cmove  %ecx,%r12d
add    %eax,%r12d
mov    %r12d,%ebp
shr    $0x3,%ebp
mov    %ebp,%edi
call   10c0 <malloc@plt>
test   %rax,%rax
je     1649 <main+0x449>
mov    %rax,%r15
xor    %ebx,%ebx
mov    %rax,%rdi
xor    %esi,%esi
mov    %rbp,0x10(%rsp)
mov    %ebp,%edx
call   1080 <memset@plt>
mov    0x18(%r14),%rax
mov    %r13d,%edx
mov    $0x2,%r8d
mov    $0x7,%r9d
xor    %ecx,%ecx
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rax,%rbx,1),%esi
lea    -0x7f(%rsi),%ebp
cmp    $0xa0,%bpl
jbe    15d5 <main+0x3d5>
cmp    $0x24,%sil
cmove  %r8d,%esi
shl    %cl,%esi
mov    %edi,%ebp
or     %esi,(%r15,%rbp,1)
xor    %esi,%esi
test   %ecx,%ecx
lea    -0x1(%rcx),%ecx
cmovle %r9d,%ecx
setg   %sil
add    %esi,%edi
add    $0x1,%rbx
cmp    %rbx,%rdx
jne    13d0 <main+0x1d0>
mov    %r13,%rbx
mov    0x8(%r14),%rdi
lea    0xd19(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1654 <main+0x454>
mov    %rax,%r14
lea    0xd21(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1110 <fwrite@plt>
mov    %r14,%rdi
call   10d0 <fflush@plt>
mov    $0x1,%edi
call   1120 <sleep@plt>
mov    0x10(%rsp),%rbp
lea    0xe(%rbp),%edx
lea    0xcfa(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %r14,%rdi
call   10d0 <fflush@plt>
mov    $0x1,%edi
call   1120 <sleep@plt>
lea    0xce4(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1110 <fwrite@plt>
movsbl 0x5(%rsp),%edx
movsbl 0x4(%rsp),%ecx
lea    0xccc(%rip),%r13
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
movsbl 0x7(%rsp),%edx
movsbl 0x6(%rsp),%ecx
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
movsbl 0x9(%rsp),%edx
movsbl 0x8(%rsp),%ecx
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
movsbl 0xb(%rsp),%edx
movsbl 0xa(%rsp),%ecx
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
movsbl 0xd(%rsp),%edx
movsbl 0xc(%rsp),%ecx
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
movsbl 0xf(%rsp),%edx
movsbl 0xe(%rsp),%ecx
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
lea    0xc4a(%rip),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1110 <fwrite@plt>
lea    0xc38(%rip),%rsi
mov    %r14,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
cmp    $0x8,%r12d
jb     158b <main+0x38b>
mov    %ebp,%ebp
lea    0xc1d(%rip),%r12
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%edx
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1570 <main+0x370>
mov    $0x1,%edi
call   1120 <sleep@plt>
mov    $0x1a,%edi
mov    %r14,%rsi
call   1090 <fputc@plt>
mov    %r14,%rdi
call   10d0 <fflush@plt>
mov    $0x1,%edi
call   1120 <sleep@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb2b(%rip),%rdi
jmp    15f9 <main+0x3f9>
lea    -0x7f(%rax),%ecx
cmp    $0xa1,%cl
movzbl %al,%esi
lea    0xa6b(%rip),%rax
lea    0xa8c(%rip),%rdi
cmovb  %rax,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1100 <exit@plt>
mov    (%r14),%rsi
lea    0x9ec(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1100 <exit@plt>
lea    0xa79(%rip),%rdi
mov    $0xc,%esi
jmp    15f9 <main+0x3f9>
lea    0xb4d(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   1100 <exit@plt>
lea    0xa80(%rip),%rdi
mov    %ebp,%esi
jmp    15f9 <main+0x3f9>
lea    0xada(%rip),%rdi
call   10f0 <perror@plt>
mov    $0xffffffff,%edi
call   1100 <exit@plt>
mov    0x10(%r14),%rsi
lea    0x9ba(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"usage: %s </dev/device> <phone-no> <sms text>\0A\00"
@.str.1 = [42 x i8] c"Invalid length for phone number '%s': %i\0A\00"
@.str.2 = [40 x i8] c"Invalid char in phone number: 0x'%.2X'\0A\00"
@.str.3 = [36 x i8] c"Invalid char in phone number: '%c'\0A\00"
@.str.4 = [43 x i8] c"Text is too long at %i chars. Max is 160.\0A\00"
@.str.5 = [31 x i8] c"No text supplied for the SMS.\0A\00"
@.str.6 = [55 x i8] c"Unable to malloc '%i' bytes for variable 'sms_string'\0A\00"
@.str.7 = [43 x i8] c"Invalid character in text input: 0x'%.2X'\0A\00"
@.str.8 = [3 x i8] c"wb\00"
@.str.9 = [29 x i8] c"Unable to open output device\00"
@.str.10 = [12 x i8] c"AT+CMGF=0\0D\0A\00"
@.str.11 = [13 x i8] c"AT+CMGS=%i\0D\0A\00"
@.str.12 = [11 x i8] c"0011000C91\00"
@.str.13 = [5 x i8] c"%c%c\00"
@.str.14 = [7 x i8] c"0000AA\00"
@.str.15 = [5 x i8] c"%.2X\00"
@.str.16 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [12 x i8]
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 4
br i1 %16, label %17, label %23
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 -1)
unreachable
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @strlen(i8* %26)
store i32 %27, i32* %9
%28 = load i32, i32* %9
%29 = icmp eq i32 %28, 11
br i1 %29, label %30, label %48
30: ; preds = %23
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = getelementptr inbounds i8, i8* %33, i64 0
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 48
br i1 %37, label %38, label %48
38: ; preds = %30
%39 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 0
store i8 52, i8* %39
%40 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 1
store i8 52, i8* %40
%41 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 0
%42 = getelementptr inbounds i8, i8* %41, i64 2
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 2
%45 = load i8*, i8** %44
%46 = getelementptr inbounds i8, i8* %45, i64 1
%47 = call i32 @memcpy(i8* %42, i8* %46, i32 10)
br label %84
48: ; preds = %30, %23
%49 = load i32, i32* %9
%50 = icmp eq i32 %49, 12
br i1 %50, label %51, label %57
51: ; preds = %48
%52 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 0
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 2
%55 = load i8*, i8** %54
%56 = call i32 @memcpy(i8* %52, i8* %55, i32 12)
br label %83
57: ; preds = %48
%58 = load i32, i32* %9
%59 = icmp eq i32 %58, 13
br i1 %59, label %60, label %75
60: ; preds = %57
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 2
%63 = load i8*, i8** %62
%64 = getelementptr inbounds i8, i8* %63, i64 0
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 43
br i1 %67, label %68, label %75
68: ; preds = %60
%69 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 0
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 2
%72 = load i8*, i8** %71
%73 = getelementptr inbounds i8, i8* %72, i64 1
%74 = call i32 @memcpy(i8* %69, i8* %73, i32 12)
br label %82
75: ; preds = %60, %57
%76 = load i8**, i8*** %5
%77 = getelementptr inbounds i8*, i8** %76, i64 2
%78 = load i8*, i8** %77
%79 = load i32, i32* %9
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %78, i32 %79)
%81 = call i32 @exit(i32 -1)
unreachable
82: ; preds = %68
br label %83
83: ; preds = %82, %51
br label %84
84: ; preds = %83, %38
store i32 0, i32* %9
br label %85
85: ; preds = %133, %84
%86 = load i32, i32* %9
%87 = icmp slt i32 %86, 12
br i1 %87, label %88, label %136
88: ; preds = %85
%89 = load i32, i32* %9
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 %90
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = icmp slt i32 %93, 48
br i1 %94, label %102, label %95
95: ; preds = %88
%96 = load i32, i32* %9
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 %97
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = icmp sgt i32 %100, 57
br i1 %101, label %102, label %132
102: ; preds = %95, %88
%103 = load i32, i32* %9
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 %104
%106 = load i8, i8* %105
%107 = zext i8 %106 to i32
%108 = icmp slt i32 %107, 32
br i1 %108, label %116, label %109
109: ; preds = %102
%110 = load i32, i32* %9
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 %111
%113 = load i8, i8* %112
%114 = zext i8 %113 to i32
%115 = icmp sgt i32 %114, 126
br i1 %115, label %116, label %123
116: ; preds = %109, %102
%117 = load i32, i32* %9
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 %118
%120 = load i8, i8* %119
%121 = zext i8 %120 to i32
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %121)
br label %130
123: ; preds = %109
%124 = load i32, i32* %9
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 %125
%127 = load i8, i8* %126
%128 = sext i8 %127 to i32
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %128)
br label %130
130: ; preds = %123, %116
%131 = call i32 @exit(i32 -1)
unreachable
132: ; preds = %95
br label %133
133: ; preds = %132
%134 = load i32, i32* %9
%135 = add nsw i32 %134, 1
store i32 %135, i32* %9
br label %85
136: ; preds = %85
%137 = load i8**, i8*** %5
%138 = getelementptr inbounds i8*, i8** %137, i64 3
%139 = load i8*, i8** %138
%140 = call i32 @strlen(i8* %139)
store i32 %140, i32* %13
%141 = load i32, i32* %13
%142 = icmp sgt i32 %141, 160
br i1 %142, label %143, label %147
143: ; preds = %136
%144 = load i32, i32* %9
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 %144)
%146 = call i32 @exit(i32 -1)
unreachable
147: ; preds = %136
%148 = load i32, i32* %13
%149 = icmp slt i32 %148, 1
br i1 %149, label %150, label %153
150: ; preds = %147
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%152 = call i32 @exit(i32 -1)
unreachable
153: ; preds = %147
%154 = load i32, i32* %13
%155 = mul nsw i32 %154, 7
store i32 %155, i32* %9
%156 = load i32, i32* %9
%157 = srem i32 %156, 8
store i32 %157, i32* %11
%158 = load i32, i32* %11
%159 = icmp ne i32 %158, 0
br i1 %159, label %160, label %165
160: ; preds = %153
%161 = load i32, i32* %11
%162 = sub nsw i32 8, %161
%163 = load i32, i32* %9
%164 = add nsw i32 %163, %162
store i32 %164, i32* %9
br label %165
165: ; preds = %160, %153
%166 = load i32, i32* %9
%167 = sdiv i32 %166, 8
store i32 %167, i32* %14
%168 = load i32, i32* %14
%169 = call i8* @malloc(i32 %168)
store i8* %169, i8** %8
%170 = load i8*, i8** %8
%171 = icmp eq i8* %170, null
br i1 %171, label %172, label %176
172: ; preds = %165
%173 = load i32, i32* %14
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0), i32 %173)
%175 = call i32 @exit(i32 -1)
unreachable
176: ; preds = %165
%177 = load i8*, i8** %8
%178 = load i32, i32* %14
%179 = call i32 @memset(i8* %177, i32 0, i32 %178)
store i32 0, i32* %11
store i32 0, i32* %10
store i32 0, i32* %9
br label %180
180: ; preds = %249, %176
%181 = load i32, i32* %9
%182 = load i32, i32* %13
%183 = icmp slt i32 %181, %182
br i1 %183, label %184, label %252
184: ; preds = %180
%185 = load i8**, i8*** %5
%186 = getelementptr inbounds i8*, i8** %185, i64 3
%187 = load i8*, i8** %186
%188 = load i32, i32* %9
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds i8, i8* %187, i64 %189
%191 = load i8, i8* %190
%192 = zext i8 %191 to i32
%193 = icmp slt i32 %192, 32
br i1 %193, label %204, label %194
194: ; preds = %184
%195 = load i8**, i8*** %5
%196 = getelementptr inbounds i8*, i8** %195, i64 3
%197 = load i8*, i8** %196
%198 = load i32, i32* %9
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds i8, i8* %197, i64 %199
%201 = load i8, i8* %200
%202 = zext i8 %201 to i32
%203 = icmp sgt i32 %202, 126
br i1 %203, label %204, label %215
204: ; preds = %194, %184
%205 = load i8**, i8*** %5
%206 = getelementptr inbounds i8*, i8** %205, i64 3
%207 = load i8*, i8** %206
%208 = load i32, i32* %9
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds i8, i8* %207, i64 %209
%211 = load i8, i8* %210
%212 = zext i8 %211 to i32
%213 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i32 %212)
%214 = call i32 @exit(i32 -1)
unreachable
215: ; preds = %194
%216 = load i8**, i8*** %5
%217 = getelementptr inbounds i8*, i8** %216, i64 3
%218 = load i8*, i8** %217
%219 = load i32, i32* %9
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds i8, i8* %218, i64 %220
%222 = load i8, i8* %221
%223 = sext i8 %222 to i32
store i32 %223, i32* %12
%224 = load i32, i32* %12
%225 = icmp eq i32 %224, 36
br i1 %225, label %226, label %227
226: ; preds = %215
store i32 2, i32* %12
br label %227
227: ; preds = %226, %215
%228 = load i32, i32* %12
%229 = load i32, i32* %10
%230 = shl i32 %228, %229
store i32 %230, i32* %12
%231 = load i32, i32* %12
%232 = load i8*, i8** %8
%233 = load i32, i32* %11
%234 = sext i32 %233 to i64
%235 = getelementptr inbounds i8, i8* %232, i64 %234
%236 = bitcast i8* %235 to i32*
%237 = load i32, i32* %236
%238 = or i32 %237, %231
store i32 %238, i32* %236
%239 = load i32, i32* %10
%240 = add nsw i32 %239, 7
store i32 %240, i32* %10
%241 = load i32, i32* %10
%242 = icmp sge i32 %241, 8
br i1 %242, label %243, label %248
243: ; preds = %227
%244 = load i32, i32* %10
%245 = sub nsw i32 %244, 8
store i32 %245, i32* %10
%246 = load i32, i32* %11
%247 = add nsw i32 %246, 1
store i32 %247, i32* %11
br label %248
248: ; preds = %243, %227
br label %249
249: ; preds = %248
%250 = load i32, i32* %9
%251 = add nsw i32 %250, 1
store i32 %251, i32* %9
br label %180
252: ; preds = %180
%253 = load i8**, i8*** %5
%254 = getelementptr inbounds i8*, i8** %253, i64 1
%255 = load i8*, i8** %254
%256 = call i32* @fopen(i8* %255, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
store i32* %256, i32** %6
%257 = load i32*, i32** %6
%258 = icmp eq i32* %257, null
br i1 %258, label %259, label %262
259: ; preds = %252
%260 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
%261 = call i32 @exit(i32 -1)
unreachable
262: ; preds = %252
%263 = load i32*, i32** %6
%264 = call i32 (i32*, i8*, ...) @fprintf(i32* %263, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%265 = load i32*, i32** %6
%266 = call i32 @fflush(i32* %265)
%267 = call i32 @sleep(i32 1)
%268 = load i32*, i32** %6
%269 = load i32, i32* %14
%270 = add nsw i32 14, %269
%271 = call i32 (i32*, i8*, ...) @fprintf(i32* %268, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 %270)
%272 = load i32*, i32** %6
%273 = call i32 @fflush(i32* %272)
%274 = call i32 @sleep(i32 1)
%275 = load i32*, i32** %6
%276 = call i32 (i32*, i8*, ...) @fprintf(i32* %275, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %9
br label %277
277: ; preds = %294, %262
%278 = load i32, i32* %9
%279 = icmp slt i32 %278, 12
br i1 %279, label %280, label %297
280: ; preds = %277
%281 = load i32*, i32** %6
%282 = load i32, i32* %9
%283 = add nsw i32 %282, 1
%284 = sext i32 %283 to i64
%285 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 %284
%286 = load i8, i8* %285
%287 = sext i8 %286 to i32
%288 = load i32, i32* %9
%289 = sext i32 %288 to i64
%290 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 %289
%291 = load i8, i8* %290
%292 = sext i8 %291 to i32
%293 = call i32 (i32*, i8*, ...) @fprintf(i32* %281, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 %287, i32 %292)
br label %294
294: ; preds = %280
%295 = load i32, i32* %9
%296 = add nsw i32 %295, 2
store i32 %296, i32* %9
br label %277
297: ; preds = %277
%298 = load i32*, i32** %6
%299 = call i32 (i32*, i8*, ...) @fprintf(i32* %298, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
%300 = load i32*, i32** %6
%301 = load i32, i32* %13
%302 = call i32 (i32*, i8*, ...) @fprintf(i32* %300, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 %301)
store i32 0, i32* %9
br label %303
303: ; preds = %316, %297
%304 = load i32, i32* %9
%305 = load i32, i32* %14
%306 = icmp slt i32 %304, %305
br i1 %306, label %307, label %319
307: ; preds = %303
%308 = load i32*, i32** %6
%309 = load i8*, i8** %8
%310 = load i32, i32* %9
%311 = sext i32 %310 to i64
%312 = getelementptr inbounds i8, i8* %309, i64 %311
%313 = load i8, i8* %312
%314 = zext i8 %313 to i32
%315 = call i32 (i32*, i8*, ...) @fprintf(i32* %308, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 %314)
br label %316
316: ; preds = %307
%317 = load i32, i32* %9
%318 = add nsw i32 %317, 1
store i32 %318, i32* %9
br label %303
319: ; preds = %303
%320 = call i32 @sleep(i32 1)
%321 = load i32*, i32** %6
%322 = call i32 (i32*, i8*, ...) @fprintf(i32* %321, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), i32 26)
%323 = load i32*, i32** %6
%324 = call i32 @fflush(i32* %323)
%325 = call i32 @sleep(i32 1)
%326 = load i32*, i32** %6
%327 = call i32 @fclose(i32* %326)
%328 = load i8*, i8** %8
%329 = call i32 @free(i8* %328)
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"usage: %s </dev/device> <phone-no> <sms text>\0A\00"
@.str.1 = [42 x i8] c"Invalid length for phone number '%s': %i\0A\00"
@.str.2 = [40 x i8] c"Invalid char in phone number: 0x'%.2X'\0A\00"
@.str.3 = [36 x i8] c"Invalid char in phone number: '%c'\0A\00"
@.str.4 = [43 x i8] c"Text is too long at %i chars. Max is 160.\0A\00"
@.str.6 = [55 x i8] c"Unable to malloc '%i' bytes for variable 'sms_string'\0A\00"
@.str.7 = [43 x i8] c"Invalid character in text input: 0x'%.2X'\0A\00"
@.str.8 = [3 x i8] c"wb\00"
@.str.9 = [29 x i8] c"Unable to open output device\00"
@.str.10 = [12 x i8] c"AT+CMGF=0\0D\0A\00"
@.str.11 = [13 x i8] c"AT+CMGS=%i\0D\0A\00"
@.str.12 = [11 x i8] c"0011000C91\00"
@.str.13 = [5 x i8] c"%c%c\00"
@.str.14 = [7 x i8] c"0000AA\00"
@.str.15 = [5 x i8] c"%.2X\00"
@str = [30 x i8] c"No text supplied for the SMS.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [12 x i8]
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 4
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = tail call i32 @exit(i32 -1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @strlen(i8* %12)
switch i32 %13, label %14 [
i32 11, label %16
i32 12, label %25
i32 13, label %28
]
14: ; preds = %10
%15 = load i8*, i8** %11
br label %35
16: ; preds = %10
%17 = load i8*, i8** %11
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 48
br i1 %19, label %20, label %35
20: ; preds = %16
store i8 52, i8* %4
%21 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 1
store i8 52, i8* %21
%22 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 2
%23 = getelementptr inbounds i8, i8* %17, i64 1
%24 = call i32 @memcpy(i8* %22, i8* %23, i32 10)
br label %39
25: ; preds = %10
%26 = load i8*, i8** %11
%27 = call i32 @memcpy(i8* %4, i8* %26, i32 12)
br label %39
28: ; preds = %10
%29 = load i8*, i8** %11
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 43
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = getelementptr inbounds i8, i8* %29, i64 1
%34 = call i32 @memcpy(i8* %4, i8* %33, i32 12)
br label %39
35: ; preds = %14, %16, %28
%36 = phi i8* [ %15, %14 ], [ %17, %16 ], [ %29, %28 ]
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %36, i32 %13)
%38 = tail call i32 @exit(i32 -1)
unreachable
39: ; preds = %25, %32, %20
%40 = load i8, i8* %4
%41 = add i8 %40, -58
%42 = icmp ult i8 %41, -10
br i1 %42, label %43, label %51
43: ; preds = %101, %96, %91, %86, %81, %76, %71, %66, %61, %56, %51, %39
%44 = phi i8 [ %40, %39 ], [ %53, %51 ], [ %58, %56 ], [ %63, %61 ], [ %68, %66 ], [ %73, %71 ], [ %78, %76 ], [ %83, %81 ], [ %88, %86 ], [ %93, %91 ], [ %98, %96 ], [ %103, %101 ]
%45 = add i8 %44, -127
%46 = icmp ult i8 %45, -95
%47 = zext i8 %44 to i32
%48 = select i1 %46, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %48, i32 %47)
%50 = call i32 @exit(i32 -1)
unreachable
51: ; preds = %39
%52 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 1
%53 = load i8, i8* %52
%54 = add i8 %53, -58
%55 = icmp ult i8 %54, -10
br i1 %55, label %43, label %56
56: ; preds = %51
%57 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 2
%58 = load i8, i8* %57
%59 = add i8 %58, -58
%60 = icmp ult i8 %59, -10
br i1 %60, label %43, label %61
61: ; preds = %56
%62 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 3
%63 = load i8, i8* %62
%64 = add i8 %63, -58
%65 = icmp ult i8 %64, -10
br i1 %65, label %43, label %66
66: ; preds = %61
%67 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 4
%68 = load i8, i8* %67
%69 = add i8 %68, -58
%70 = icmp ult i8 %69, -10
br i1 %70, label %43, label %71
71: ; preds = %66
%72 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 5
%73 = load i8, i8* %72
%74 = add i8 %73, -58
%75 = icmp ult i8 %74, -10
br i1 %75, label %43, label %76
76: ; preds = %71
%77 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 6
%78 = load i8, i8* %77
%79 = add i8 %78, -58
%80 = icmp ult i8 %79, -10
br i1 %80, label %43, label %81
81: ; preds = %76
%82 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 7
%83 = load i8, i8* %82
%84 = add i8 %83, -58
%85 = icmp ult i8 %84, -10
br i1 %85, label %43, label %86
86: ; preds = %81
%87 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 8
%88 = load i8, i8* %87
%89 = add i8 %88, -58
%90 = icmp ult i8 %89, -10
br i1 %90, label %43, label %91
91: ; preds = %86
%92 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 9
%93 = load i8, i8* %92
%94 = add i8 %93, -58
%95 = icmp ult i8 %94, -10
br i1 %95, label %43, label %96
96: ; preds = %91
%97 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 10
%98 = load i8, i8* %97
%99 = add i8 %98, -58
%100 = icmp ult i8 %99, -10
br i1 %100, label %43, label %101
101: ; preds = %96
%102 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 11
%103 = load i8, i8* %102
%104 = add i8 %103, -58
%105 = icmp ult i8 %104, -10
br i1 %105, label %43, label %106
106: ; preds = %101
%107 = getelementptr inbounds i8*, i8** %1, i64 3
%108 = load i8*, i8** %107
%109 = call i32 @strlen(i8* %108)
%110 = icmp sgt i32 %109, 160
br i1 %110, label %111, label %114
111: ; preds = %106
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 12)
%113 = call i32 @exit(i32 -1)
unreachable
114: ; preds = %106
%115 = icmp slt i32 %109, 1
br i1 %115, label %116, label %119
116: ; preds = %114
%117 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%118 = call i32 @exit(i32 -1)
unreachable
119: ; preds = %114
%120 = mul nuw nsw i32 %109, 7
%121 = and i32 %120, 7
%122 = icmp eq i32 %121, 0
%123 = sub nuw nsw i32 8, %121
%124 = select i1 %122, i32 0, i32 %123
%125 = add nuw nsw i32 %124, %120
%126 = lshr i32 %125, 3
%127 = call i8* @malloc(i32 %126)
%128 = icmp eq i8* %127, null
br i1 %128, label %129, label %132
129: ; preds = %119
%130 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0), i32 %126)
%131 = call i32 @exit(i32 -1)
unreachable
132: ; preds = %119
%133 = call i32 @memset(i8* %127, i32 0, i32 %126)
%134 = load i8*, i8** %107
%135 = zext i32 %109 to i64
br label %136
136: ; preds = %132, %148
%137 = phi i64 [ 0, %132 ], [ %163, %148 ]
%138 = phi i32 [ 0, %132 ], [ %162, %148 ]
%139 = phi i32 [ 0, %132 ], [ %161, %148 ]
%140 = getelementptr inbounds i8, i8* %134, i64 %137
%141 = load i8, i8* %140
%142 = add i8 %141, -127
%143 = icmp ult i8 %142, -95
br i1 %143, label %144, label %148
144: ; preds = %136
%145 = zext i8 %141 to i32
%146 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i32 %145)
%147 = call i32 @exit(i32 -1)
unreachable
148: ; preds = %136
%149 = icmp eq i8 %141, 36
%150 = select i1 %149, i8 2, i8 %141
%151 = zext i8 %150 to i32
%152 = shl i32 %151, %138
%153 = zext i32 %139 to i64
%154 = getelementptr inbounds i8, i8* %127, i64 %153
%155 = bitcast i8* %154 to i32*
%156 = load i32, i32* %155
%157 = or i32 %156, %152
store i32 %157, i32* %155
%158 = icmp sgt i32 %138, 0
%159 = add nsw i32 %138, -1
%160 = zext i1 %158 to i32
%161 = add nuw nsw i32 %139, %160
%162 = select i1 %158, i32 %159, i32 7
%163 = add nuw nsw i64 %137, 1
%164 = icmp eq i64 %163, %135
br i1 %164, label %165, label %136
165: ; preds = %148
%166 = getelementptr inbounds i8*, i8** %1, i64 1
%167 = load i8*, i8** %166
%168 = call i32* @fopen(i8* %167, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%169 = icmp eq i32* %168, null
br i1 %169, label %170, label %173
170: ; preds = %165
%171 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
%172 = call i32 @exit(i32 -1)
unreachable
173: ; preds = %165
%174 = call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i64 11, i64 1, i32* %168)
%175 = call i32 @fflush(i32* %168)
%176 = call i32 @sleep(i32 1)
%177 = add nuw nsw i32 %126, 14
%178 = call i32 (i32*, i8*, ...) @fprintf(i32* %168, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 %177)
%179 = call i32 @fflush(i32* %168)
%180 = call i32 @sleep(i32 1)
%181 = call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i64 10, i64 1, i32* %168)
%182 = load i8, i8* %52
%183 = sext i8 %182 to i32
%184 = load i8, i8* %4
%185 = sext i8 %184 to i32
%186 = call i32 (i32*, i8*, ...) @fprintf(i32* %168, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 %183, i32 %185)
%187 = load i8, i8* %62
%188 = sext i8 %187 to i32
%189 = load i8, i8* %57
%190 = sext i8 %189 to i32
%191 = call i32 (i32*, i8*, ...) @fprintf(i32* %168, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 %188, i32 %190)
%192 = load i8, i8* %72
%193 = sext i8 %192 to i32
%194 = load i8, i8* %67
%195 = sext i8 %194 to i32
%196 = call i32 (i32*, i8*, ...) @fprintf(i32* %168, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 %193, i32 %195)
%197 = load i8, i8* %82
%198 = sext i8 %197 to i32
%199 = load i8, i8* %77
%200 = sext i8 %199 to i32
%201 = call i32 (i32*, i8*, ...) @fprintf(i32* %168, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 %198, i32 %200)
%202 = load i8, i8* %92
%203 = sext i8 %202 to i32
%204 = load i8, i8* %87
%205 = sext i8 %204 to i32
%206 = call i32 (i32*, i8*, ...) @fprintf(i32* %168, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 %203, i32 %205)
%207 = load i8, i8* %102
%208 = sext i8 %207 to i32
%209 = load i8, i8* %97
%210 = sext i8 %209 to i32
%211 = call i32 (i32*, i8*, ...) @fprintf(i32* %168, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 %208, i32 %210)
%212 = call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i64 6, i64 1, i32* %168)
%213 = call i32 (i32*, i8*, ...) @fprintf(i32* %168, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 %109)
%214 = icmp ult i32 %125, 8
br i1 %214, label %225, label %215
215: ; preds = %173
%216 = zext i32 %126 to i64
br label %217
217: ; preds = %215, %217
%218 = phi i64 [ 0, %215 ], [ %223, %217 ]
%219 = getelementptr inbounds i8, i8* %127, i64 %218
%220 = load i8, i8* %219
%221 = zext i8 %220 to i32
%222 = call i32 (i32*, i8*, ...) @fprintf(i32* %168, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 %221)
%223 = add nuw nsw i64 %218, 1
%224 = icmp eq i64 %223, %216
br i1 %224, label %225, label %217
225: ; preds = %217, %173
%226 = call i32 @sleep(i32 1)
%227 = call i32 @fputc(i32 26, i32* %168)
%228 = call i32 @fflush(i32* %168)
%229 = call i32 @sleep(i32 1)
%230 = call i32 @fclose(i32* %168)
%231 = call i32 @free(i8* %127)
ret i32 0
}