#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int atoi(char *);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
scalar_t__ isdigit(int);
int /*<<< orphan*/ isspace(int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strpbrk(char *, char *);
char *strrchr(char *, char);
int expandf(char *strin, int len) {
  char *stringt, *string;
  char *lp;
  char *np;
  char *rp;
  char ascnum[16];
  char c2[2];
  int c, i, k, l;
  int len2;
  int level;
  int num;
  int status;
  int debug = 0;
  if (!strlen(strin))
    return 0;
  status = 0;
  memset(c2, '\0', 2);
  len2 = len * 2;
  stringt = (char *)calloc(len2 + 1, sizeof(char));
  string = (char *)calloc(len2 + 1, sizeof(char));
  if (!stringt || !string) {
    fprintf(stderr, "expandf: memory allocation error\n");
    exit(-1);
  }
  if (debug)
    printf("expandf: len=%d\n", len);
  rp = strin;
  lp = string;
  while (c = *rp++)
    if (!isspace(c))
      *lp++ = c;
  *lp = '\0';
  if (debug) {
    l = strlen(string);
    printf("%s\t%d\n", string, l);
  }
  rp = stringt;
  lp = string;
  stringt[len2] = '\xff';
  while (c = *lp++) {
    switch (c) {
    case 'C':
    case 'c':
    case 'S':
    case 's':
      np = ascnum;
      k = 0;
      while (k < 16 && isdigit(*lp)) {
        *np++ = *lp++;
        k++;
      }
      *np = '\0';
      k = atoi(ascnum) - 1;
      *rp++ = '(';
      if (*rp == '\xff')
        goto ABORT;
      for (i = 0; i < k; i++) {
        *rp++ = c;
        if (*rp == '\xff')
          goto ABORT;
      }
      *rp++ = '~';
      if (*rp == '\xff')
        goto ABORT;
      *rp++ = ')';
      if (*rp == '\xff')
        goto ABORT;
      break;
    default:
      *rp++ = c;
      if (*rp == '\xff')
        goto ABORT;
      break;
    }
  }
  *lp = '\0';
  stringt[len2] = '\0';
  strncpy(string, stringt, len2);
  if (debug) {
    l = strlen(string);
    printf("%s\t%d\n", string, l);
  }
  level = 0;
  while (rp = strrchr(string, ')')) {
    *rp = '\0';
    lp = rp;
    while (lp > string && isdigit(c = *(lp - 1)))
      *--lp = '\0';
    level++;
    while ((level > 0) && (lp > string)) {
      lp--;
      if (*lp == ')')
        level++;
      if (*lp == '(')
        level--;
    }
    if (level) {
      printf("expandf error: unbalanced parentheses\n");
      status = 1;
      goto DONE;
    }
    *lp = '\0';
    num = 1;
    np = lp;
    while (np > string && isdigit(c = *(np - 1)))
      np--;
    if (strlen(np) > 0) {
      num = atoi(np);
      *np = '\0';
    }
    strncpy(stringt, string, len2);
    if (strlen(stringt) + num * strlen(lp + 1) > len2)
      goto ABORT;
    for (k = 0; k < num; k++)
      strcat(stringt, lp + 1);
    if (strlen(stringt) + strlen(rp + 1) > len2)
      goto ABORT;
    strcat(stringt, rp + 1);
    strncpy(string, stringt, len2);
  }
  if (strrchr(string, '(')) {
    printf("expandf error: unbalanced parentheses\n");
    status = 1;
    goto DONE;
  }
  if (debug) {
    l = strlen(string);
    printf("%s\t%d\n", string, l);
  }
  while (np = strpbrk(string, "0123456789")) {
    rp = np;
    while (isdigit(c = *++rp))
      ;
    strncpy(c2, rp, 1);
    *rp = '\0';
    num = atoi(np);
    *np = '\0';
    strncpy(stringt, string, len2);
    if (strlen(stringt) + num > len2)
      goto ABORT;
    for (k = 0; k < num; k++)
      strcat(stringt, c2);
    if (strlen(stringt) + strlen(rp + 1) > len2)
      goto ABORT;
    strcat(stringt, rp + 1);
    strncpy(string, stringt, len2);
  }
  if (debug) {
    l = strlen(string);
    printf("%s\t%d\n", string, l);
  }
DONE:
  l = strlen(string);
  if (l >= len) {
    fprintf(stderr,
            "expandf error: expanded format length exceeds allocated buffer "
            "size (%d)\n",
            len);
    status = 1;
  }
  string[len - 1] = '\0';
  if (!status)
    strcpy(strin, string);
  free(string);
  free(stringt);
  return (status);
ABORT:
  status = -1;
  goto DONE;
}


x86 assembly (clang, -O0):
<expandf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x78(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%eax
jne    1227 <expandf+0x37>
movl   $0x0,-0x4(%rbp)
jmp    1a7f <expandf+0x88f>
movl   $0x0,-0x74(%rbp)
lea    -0x52(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   10a0 <memset@plt>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10c0 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x68(%rbp),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10c0 <calloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1285 <expandf+0x95>
cmpq   $0x0,-0x28(%rbp)
jne    12a6 <expandf+0xb6>
mov    0x2d54(%rip),%rax
mov    (%rax),%edi
lea    0xd6b(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>
cmpl   $0x0,-0x78(%rbp)
je     12c1 <expandf+0xd1>
mov    -0x14(%rbp),%esi
lea    0xd68(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x58(%rbp)
cmp    $0x0,%eax
je     131b <expandf+0x12b>
mov    -0x58(%rbp),%edi
call   10b0 <isspace@plt>
cmp    $0x0,%eax
jne    1316 <expandf+0x126>
mov    -0x58(%rbp),%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x30(%rbp)
mov    %cl,(%rax)
jmp    12d1 <expandf+0xe1>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
cmpl   $0x0,-0x78(%rbp)
je     134d <expandf+0x15d>
mov    -0x28(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x64(%rbp),%edx
lea    0xced(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x68(%rbp),%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x58(%rbp)
cmp    $0x0,%eax
je     1558 <expandf+0x368>
mov    -0x58(%rbp),%eax
mov    %eax,-0x7c(%rbp)
sub    $0x43,%eax
je     13ce <expandf+0x1de>
jmp    139b <expandf+0x1ab>
mov    -0x7c(%rbp),%eax
sub    $0x53,%eax
je     13ce <expandf+0x1de>
jmp    13ac <expandf+0x1bc>
mov    -0x7c(%rbp),%eax
sub    $0x63,%eax
je     13ce <expandf+0x1de>
jmp    13bd <expandf+0x1cd>
mov    -0x7c(%rbp),%eax
sub    $0x73,%eax
jne    1523 <expandf+0x333>
jmp    13ce <expandf+0x1de>
lea    -0x50(%rbp),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x60(%rbp)
xor    %eax,%eax
cmpl   $0x10,-0x60(%rbp)
mov    %al,-0x7d(%rbp)
jge    1402 <expandf+0x212>
mov    -0x30(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x7d(%rbp)
mov    -0x7d(%rbp),%al
test   $0x1,%al
jne    1412 <expandf+0x222>
jmp    1442 <expandf+0x252>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
mov    (%rax),%cl
mov    -0x38(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x38(%rbp)
mov    %cl,(%rax)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    13dd <expandf+0x1ed>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x50(%rbp),%rdi
call   10f0 <atoi@plt>
sub    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
movb   $0x28,(%rax)
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xffffffff,%eax
jne    147f <expandf+0x28f>
jmp    1a73 <expandf+0x883>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x60(%rbp),%eax
jge    14d0 <expandf+0x2e0>
mov    -0x58(%rbp),%eax
mov    %al,%cl
mov    -0x40(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
mov    %cl,(%rax)
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xffffffff,%eax
jne    14bd <expandf+0x2cd>
jmp    1a73 <expandf+0x883>
jmp    14c2 <expandf+0x2d2>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1486 <expandf+0x296>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
movb   $0x7e,(%rax)
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xffffffff,%eax
jne    14f7 <expandf+0x307>
jmp    1a73 <expandf+0x883>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
movb   $0x29,(%rax)
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xffffffff,%eax
jne    151e <expandf+0x32e>
jmp    1a73 <expandf+0x883>
jmp    1553 <expandf+0x363>
mov    -0x58(%rbp),%eax
mov    %al,%cl
mov    -0x40(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x40(%rbp)
mov    %cl,(%rax)
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xffffffff,%eax
jne    154e <expandf+0x35e>
jmp    1a73 <expandf+0x883>
jmp    1553 <expandf+0x363>
jmp    1369 <expandf+0x179>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movslq -0x68(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x68(%rbp),%edx
call   1040 <strncpy@plt>
cmpl   $0x0,-0x78(%rbp)
je     15a6 <expandf+0x3b6>
mov    -0x28(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x64(%rbp),%edx
lea    0xa94(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x0,-0x6c(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x29,%esi
call   1090 <strrchr@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
je     1835 <expandf+0x645>
mov    -0x40(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x40(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rcx
xor    %eax,%eax
cmp    -0x28(%rbp),%rcx
mov    %al,-0x7e(%rbp)
jbe    1605 <expandf+0x415>
mov    -0x30(%rbp),%rax
movsbl -0x1(%rax),%edi
mov    %edi,-0x58(%rbp)
call   1050 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x7e(%rbp)
mov    -0x7e(%rbp),%al
test   $0x1,%al
jne    1615 <expandf+0x425>
jmp    162d <expandf+0x43d>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x30(%rbp)
movb   $0x0,-0x1(%rax)
jmp    15d8 <expandf+0x3e8>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x6c(%rbp)
mov    %al,-0x7f(%rbp)
jle    1653 <expandf+0x463>
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
seta   %al
mov    %al,-0x7f(%rbp)
mov    -0x7f(%rbp),%al
test   $0x1,%al
jne    1663 <expandf+0x473>
jmp    16a6 <expandf+0x4b6>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x29,%eax
jne    1688 <expandf+0x498>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x28,%eax
jne    16a1 <expandf+0x4b1>
mov    -0x6c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x6c(%rbp)
jmp    1636 <expandf+0x446>
cmpl   $0x0,-0x6c(%rbp)
je     16ca <expandf+0x4da>
lea    0x983(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x1,-0x74(%rbp)
jmp    19f5 <expandf+0x805>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x1,-0x70(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rcx
xor    %eax,%eax
cmp    -0x28(%rbp),%rcx
mov    %al,-0x80(%rbp)
jbe    170d <expandf+0x51d>
mov    -0x38(%rbp),%rax
movsbl -0x1(%rax),%edi
mov    %edi,-0x58(%rbp)
call   1050 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x80(%rbp)
mov    -0x80(%rbp),%al
test   $0x1,%al
jne    171d <expandf+0x52d>
jmp    172e <expandf+0x53e>
mov    -0x38(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x38(%rbp)
jmp    16e0 <expandf+0x4f0>
mov    -0x38(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%eax
jle    1753 <expandf+0x563>
mov    -0x38(%rbp),%rdi
call   10f0 <atoi@plt>
mov    %eax,-0x70(%rbp)
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x68(%rbp),%edx
call   1040 <strncpy@plt>
mov    -0x20(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x84(%rbp)
mov    -0x70(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    -0x30(%rbp),%rdi
add    $0x1,%rdi
call   1070 <strlen@plt>
mov    -0x88(%rbp),%ecx
mov    %eax,%edx
mov    -0x84(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
cmp    -0x68(%rbp),%eax
jle    17a9 <expandf+0x5b9>
jmp    1a73 <expandf+0x883>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    17db <expandf+0x5eb>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
add    $0x1,%rsi
call   1100 <strcat@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    17b0 <expandf+0x5c0>
mov    -0x20(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x8c(%rbp)
mov    -0x40(%rbp),%rdi
add    $0x1,%rdi
call   1070 <strlen@plt>
mov    %eax,%ecx
mov    -0x8c(%rbp),%eax
add    %ecx,%eax
cmp    -0x68(%rbp),%eax
jle    180f <expandf+0x61f>
jmp    1a73 <expandf+0x883>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
add    $0x1,%rsi
call   1100 <strcat@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x68(%rbp),%edx
call   1040 <strncpy@plt>
jmp    15ad <expandf+0x3bd>
mov    -0x28(%rbp),%rdi
mov    $0x28,%esi
call   1090 <strrchr@plt>
cmp    $0x0,%rax
je     1867 <expandf+0x677>
lea    0x7e6(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x1,-0x74(%rbp)
jmp    19f5 <expandf+0x805>
cmpl   $0x0,-0x78(%rbp)
je     1892 <expandf+0x6a2>
mov    -0x28(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x64(%rbp),%edx
lea    0x7a8(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    1897 <expandf+0x6a7>
mov    -0x28(%rbp),%rdi
lea    0x7bf(%rip),%rsi
call   10e0 <strpbrk@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
je     19c5 <expandf+0x7d5>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
movsbl 0x1(%rax),%edi
mov    %edi,-0x58(%rbp)
call   1050 <isdigit@plt>
cmp    $0x0,%rax
je     18e7 <expandf+0x6f7>
jmp    18bd <expandf+0x6cd>
lea    -0x52(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    $0x1,%edx
call   1040 <strncpy@plt>
mov    -0x40(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x38(%rbp),%rdi
call   10f0 <atoi@plt>
mov    %eax,-0x70(%rbp)
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x68(%rbp),%edx
call   1040 <strncpy@plt>
mov    -0x20(%rbp),%rdi
call   1070 <strlen@plt>
add    -0x70(%rbp),%eax
cmp    -0x68(%rbp),%eax
jle    193d <expandf+0x74d>
jmp    1a73 <expandf+0x883>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    196b <expandf+0x77b>
mov    -0x20(%rbp),%rdi
lea    -0x52(%rbp),%rsi
call   1100 <strcat@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1944 <expandf+0x754>
mov    -0x20(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x90(%rbp)
mov    -0x40(%rbp),%rdi
add    $0x1,%rdi
call   1070 <strlen@plt>
mov    %eax,%ecx
mov    -0x90(%rbp),%eax
add    %ecx,%eax
cmp    -0x68(%rbp),%eax
jle    199f <expandf+0x7af>
jmp    1a73 <expandf+0x883>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
add    $0x1,%rsi
call   1100 <strcat@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x68(%rbp),%edx
call   1040 <strncpy@plt>
jmp    1897 <expandf+0x6a7>
cmpl   $0x0,-0x78(%rbp)
je     19f0 <expandf+0x800>
mov    -0x28(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x64(%rbp),%edx
lea    0x64a(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    19f5 <expandf+0x805>
mov    -0x28(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     1a2e <expandf+0x83e>
mov    0x25cc(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0x64c(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0x1,-0x74(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
cmpl   $0x0,-0x74(%rbp)
jne    1a56 <expandf+0x866>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <strcpy@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x74(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1a7f <expandf+0x88f>
movl   $0xffffffff,-0x74(%rbp)
jmp    19f5 <expandf+0x805>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expandf>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %esi,%r14d
mov    %rdi,%rbp
call   1080 <strlen@plt>
test   %eax,%eax
je     12a1 <expandf+0xb1>
lea    0x1e(%rsp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   10a0 <memset@plt>
movslq %r14d,%rax
mov    %rax,0x38(%rsp)
lea    (%rax,%rax,1),%r15
lea    0x1(%r15),%ebx
mov    %ebx,%edi
mov    $0x1,%esi
call   10c0 <calloc@plt>
mov    %rax,%r12
mov    %ebx,%edi
mov    $0x1,%esi
call   10c0 <calloc@plt>
test   %r12,%r12
je     195a <expandf+0x76a>
mov    %rax,%r13
test   %rax,%rax
je     195a <expandf+0x76a>
mov    %r14d,0x30(%rsp)
mov    0x0(%rbp),%bl
test   %bl,%bl
mov    %rbp,0x40(%rsp)
je     12a8 <expandf+0xb8>
add    $0x1,%rbp
mov    %r13,%r14
jmp    128c <expandf+0x9c>
nopl   0x0(%rax)
movzbl 0x0(%rbp),%ebx
add    $0x1,%rbp
test   %bl,%bl
je     12ab <expandf+0xbb>
movsbl %bl,%edi
call   10b0 <isspace@plt>
test   %eax,%eax
jne    1280 <expandf+0x90>
mov    %bl,(%r14)
add    $0x1,%r14
jmp    1280 <expandf+0x90>
xor    %ebx,%ebx
jmp    1938 <expandf+0x748>
mov    %r13,%r14
movb   $0x0,(%r14)
mov    %r15,0x20(%rsp)
movb   $0xff,(%r12,%r15,1)
lea    0x1(%r13),%rbx
mov    0x0(%r13),%r15b
test   %r15b,%r15b
mov    %r12,0x28(%rsp)
je     15e5 <expandf+0x3f5>
lea    0x1(%rsp),%rbp
mov    %rsp,%r14
jmp    12f0 <expandf+0x100>
nopl   0x0(%rax)
mov    (%rbx),%r15b
add    $0x1,%rbx
test   %r15b,%r15b
je     15e5 <expandf+0x3f5>
movsbl %r15b,%eax
add    $0xffffffbd,%eax
rol    $0x1c,%eax
cmp    $0x3,%eax
ja     14a0 <expandf+0x2b0>
movsbl (%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     14b9 <expandf+0x2c9>
mov    (%rbx),%al
mov    %al,(%rsp)
movsbl 0x1(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     14c4 <expandf+0x2d4>
mov    0x1(%rbx),%al
mov    %al,0x1(%rsp)
movsbl 0x2(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     14d0 <expandf+0x2e0>
mov    0x2(%rbx),%al
mov    %al,0x2(%rsp)
movsbl 0x3(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     14de <expandf+0x2ee>
mov    0x3(%rbx),%al
mov    %al,0x3(%rsp)
movsbl 0x4(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     14ec <expandf+0x2fc>
mov    0x4(%rbx),%al
mov    %al,0x4(%rsp)
movsbl 0x5(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     14f7 <expandf+0x307>
mov    0x5(%rbx),%al
mov    %al,0x5(%rsp)
movsbl 0x6(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     1502 <expandf+0x312>
mov    0x6(%rbx),%al
mov    %al,0x6(%rsp)
movsbl 0x7(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     150d <expandf+0x31d>
mov    0x7(%rbx),%al
mov    %al,0x7(%rsp)
movsbl 0x8(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     1518 <expandf+0x328>
mov    0x8(%rbx),%al
mov    %al,0x8(%rsp)
movsbl 0x9(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     1523 <expandf+0x333>
mov    0x9(%rbx),%al
mov    %al,0x9(%rsp)
movsbl 0xa(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     152e <expandf+0x33e>
mov    0xa(%rbx),%al
mov    %al,0xa(%rsp)
movsbl 0xb(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     1539 <expandf+0x349>
mov    0xb(%rbx),%al
mov    %al,0xb(%rsp)
movsbl 0xc(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     1544 <expandf+0x354>
mov    0xc(%rbx),%al
mov    %al,0xc(%rsp)
movsbl 0xd(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     154f <expandf+0x35f>
mov    0xd(%rbx),%al
mov    %al,0xd(%rsp)
movsbl 0xe(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     155a <expandf+0x36a>
mov    0xe(%rbx),%al
mov    %al,0xe(%rsp)
movsbl 0xf(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     1565 <expandf+0x375>
mov    0xf(%rbx),%al
add    $0x10,%rbx
mov    %al,0xf(%rsp)
lea    0x10(%rsp),%rax
jmp    1570 <expandf+0x380>
xchg   %ax,%ax
mov    %r15b,(%r12)
cmpb   $0xff,0x1(%r12)
je     1949 <expandf+0x759>
add    $0x1,%r12
jmp    12e0 <expandf+0xf0>
mov    %r14,%rdi
mov    %r14,%rax
jmp    1573 <expandf+0x383>
add    $0x1,%rbx
mov    %rbp,%rax
jmp    1570 <expandf+0x380>
add    $0x2,%rbx
lea    0x2(%rsp),%rax
jmp    1570 <expandf+0x380>
add    $0x3,%rbx
lea    0x3(%rsp),%rax
jmp    1570 <expandf+0x380>
add    $0x4,%rbx
lea    0x4(%rsp),%rax
jmp    1570 <expandf+0x380>
add    $0x5,%rbx
lea    0x5(%rsp),%rax
jmp    1570 <expandf+0x380>
add    $0x6,%rbx
lea    0x6(%rsp),%rax
jmp    1570 <expandf+0x380>
add    $0x7,%rbx
lea    0x7(%rsp),%rax
jmp    1570 <expandf+0x380>
add    $0x8,%rbx
lea    0x8(%rsp),%rax
jmp    1570 <expandf+0x380>
add    $0x9,%rbx
lea    0x9(%rsp),%rax
jmp    1570 <expandf+0x380>
add    $0xa,%rbx
lea    0xa(%rsp),%rax
jmp    1570 <expandf+0x380>
add    $0xb,%rbx
lea    0xb(%rsp),%rax
jmp    1570 <expandf+0x380>
add    $0xc,%rbx
lea    0xc(%rsp),%rax
jmp    1570 <expandf+0x380>
add    $0xd,%rbx
lea    0xd(%rsp),%rax
jmp    1570 <expandf+0x380>
add    $0xe,%rbx
lea    0xe(%rsp),%rax
jmp    1570 <expandf+0x380>
add    $0xf,%rbx
lea    0xf(%rsp),%rax
xchg   %ax,%ax
mov    %r14,%rdi
movb   $0x0,(%rax)
call   10f0 <atoi@plt>
movb   $0x28,(%r12)
cmpb   $0xff,0x1(%r12)
je     18c7 <expandf+0x6d7>
add    $0x1,%r12
cmp    $0x2,%eax
jl     15b9 <expandf+0x3c9>
add    $0xffffffff,%eax
nopl   0x0(%rax,%rax,1)
mov    %r15b,(%r12)
cmpb   $0xff,0x1(%r12)
je     18c7 <expandf+0x6d7>
add    $0x1,%r12
add    $0xffffffff,%eax
jne    15a0 <expandf+0x3b0>
movb   $0x7e,(%r12)
cmpb   $0xff,0x1(%r12)
je     18c7 <expandf+0x6d7>
movb   $0x29,0x1(%r12)
cmpb   $0xff,0x2(%r12)
je     18c7 <expandf+0x6d7>
add    $0x2,%r12
jmp    12e0 <expandf+0xf0>
movb   $0x0,(%rbx)
mov    0x28(%rsp),%r12
mov    0x20(%rsp),%rdx
movb   $0x0,(%r12,%rdx,1)
mov    %r13,%rdi
mov    %r12,%rsi
call   1040 <strncpy@plt>
mov    %r13,%rdi
mov    $0x29,%esi
call   1090 <strrchr@plt>
test   %rax,%rax
je     1786 <expandf+0x596>
mov    %rax,%r14
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%r14)
mov    %r14,%rbx
cmp    %r13,%r14
jbe    164b <expandf+0x45b>
mov    %r14,%rbx
nop
movsbl -0x1(%rbx),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     164b <expandf+0x45b>
movb   $0x0,-0x1(%rbx)
add    $0xffffffffffffffff,%rbx
cmp    %r13,%rbx
ja     1630 <expandf+0x440>
cmp    %r13,%rbx
jbe    1798 <expandf+0x5a8>
mov    $0x1,%eax
nopl   0x0(%rax)
movzbl -0x1(%rbx),%ecx
add    $0xffffffffffffffff,%rbx
xor    %edx,%edx
cmp    $0x29,%cl
sete   %dl
add    %edx,%eax
xor    %edx,%edx
cmp    $0x28,%cl
sete   %dl
sub    %edx,%eax
je     1683 <expandf+0x493>
cmp    %r13,%rbx
ja     1660 <expandf+0x470>
test   %eax,%eax
jne    1798 <expandf+0x5a8>
mov    %rbx,%r15
add    $0x1,%r15
movb   $0x0,(%rbx)
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rbp
cmp    %r13,%rbx
jbe    16ba <expandf+0x4ca>
lea    -0x1(%rbp),%rbx
movsbl -0x1(%rbp),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
jne    16a0 <expandf+0x4b0>
mov    %rbp,%rdi
call   1080 <strlen@plt>
test   %eax,%eax
jle    16e0 <expandf+0x4f0>
mov    %rbp,%rdi
call   10f0 <atoi@plt>
mov    %eax,%ebx
movb   $0x0,0x0(%rbp)
jmp    16e5 <expandf+0x4f5>
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%ebx
mov    %r12,%rdi
mov    %r13,%rsi
mov    0x20(%rsp),%rbp
mov    %ebp,%edx
call   1040 <strncpy@plt>
mov    %r12,%rdi
call   1080 <strlen@plt>
mov    %eax,0x34(%rsp)
mov    %r15,%rdi
call   1080 <strlen@plt>
imul   %ebx,%eax
add    0x34(%rsp),%eax
cmp    %ebp,%eax
jg     18c7 <expandf+0x6d7>
test   %ebx,%ebx
jle    1730 <expandf+0x540>
xchg   %ax,%ax
mov    %r12,%rdi
mov    %r15,%rsi
call   1100 <strcat@plt>
add    $0xffffffff,%ebx
jne    1720 <expandf+0x530>
mov    %r12,%rdi
call   1080 <strlen@plt>
mov    %eax,%ebx
add    $0x1,%r14
mov    %r14,%rdi
call   1080 <strlen@plt>
add    %ebx,%eax
mov    0x20(%rsp),%rbx
cmp    %ebx,%eax
jg     18c7 <expandf+0x6d7>
mov    %r12,%rdi
mov    %r14,%rsi
call   1100 <strcat@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1040 <strncpy@plt>
mov    %r13,%rdi
mov    $0x29,%esi
call   1090 <strrchr@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1620 <expandf+0x430>
mov    %r13,%rdi
mov    $0x28,%esi
call   1090 <strrchr@plt>
test   %rax,%rax
je     17b0 <expandf+0x5c0>
lea    0x8d8(%rip),%rdi
call   1070 <puts@plt>
mov    $0x1,%ebx
xor    %ebp,%ebp
jmp    18ce <expandf+0x6de>
lea    0x86b(%rip),%rsi
mov    %r13,%rdi
call   10e0 <strpbrk@plt>
mov    $0x1,%bpl
test   %rax,%rax
je     1953 <expandf+0x763>
mov    %rax,%rbx
lea    0x1e(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%rbx),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%r15),%edi
call   1050 <isdigit@plt>
add    $0x1,%r15
test   %rax,%rax
jne    17f0 <expandf+0x600>
lea    -0x1(%r15),%rsi
mov    %r14,%rdi
mov    $0x1,%edx
call   1040 <strncpy@plt>
movb   $0x0,-0x1(%r15)
mov    %rbx,%rdi
call   10f0 <atoi@plt>
mov    %eax,%ebp
movb   $0x0,(%rbx)
mov    0x28(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
mov    0x20(%rsp),%r12
mov    %r12d,%edx
call   1040 <strncpy@plt>
mov    %rbx,%rdi
call   1080 <strlen@plt>
add    %ebp,%eax
mov    $0xffffffff,%ebx
cmp    %r12d,%eax
jg     17a9 <expandf+0x5b9>
test   %ebp,%ebp
mov    0x28(%rsp),%r12
jle    1870 <expandf+0x680>
xchg   %ax,%ax
mov    %r12,%rdi
mov    %r14,%rsi
call   1100 <strcat@plt>
add    $0xffffffff,%ebp
jne    1860 <expandf+0x670>
mov    %r12,%rdi
call   1080 <strlen@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1080 <strlen@plt>
add    %ebx,%eax
mov    0x20(%rsp),%rbx
cmp    %ebx,%eax
jg     18c7 <expandf+0x6d7>
mov    %r12,%rdi
mov    %r15,%rsi
call   1100 <strcat@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1040 <strncpy@plt>
mov    %r13,%rdi
lea    0x773(%rip),%rsi
call   10e0 <strpbrk@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    17e0 <expandf+0x5f0>
xor    %ebx,%ebx
mov    $0x1,%bpl
jmp    18ce <expandf+0x6de>
xor    %ebp,%ebp
mov    $0xffffffff,%ebx
mov    %r13,%rdi
call   1080 <strlen@plt>
mov    0x30(%rsp),%edx
cmp    %edx,%eax
mov    0x40(%rsp),%rdi
jge    18ff <expandf+0x70f>
mov    0x38(%rsp),%rax
movb   $0x0,-0x1(%rax,%r13,1)
test   %bpl,%bpl
je     1926 <expandf+0x736>
mov    %r13,%rsi
call   1060 <strcpy@plt>
xor    %ebx,%ebx
jmp    1926 <expandf+0x736>
mov    0x26da(%rip),%rax
mov    (%rax),%edi
lea    0x71e(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    0x38(%rsp),%rax
movb   $0x0,-0x1(%rax,%r13,1)
mov    $0x1,%ebx
mov    %r13,%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    %ebx,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xffffffff,%ebx
jmp    17a9 <expandf+0x5b9>
xor    %ebx,%ebx
jmp    18ce <expandf+0x6de>
mov    0x267f(%rip),%rax
mov    (%rax),%edi
lea    0x696(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"expandf: memory allocation error\0A\00"
@.str.1 = [17 x i8] c"expandf: len=%d\0A\00"
@.str.2 = [7 x i8] c"%s\09%d\0A\00"
@.str.3 = [39 x i8] c"expandf error: unbalanced parentheses\0A\00"
@.str.4 = [11 x i8] c"0123456789\00"
@.str.5 = [74 x i8] c"expandf error: expanded format length exceeds allocated buffer size (%d)\0A\00"
define i32 @expandf(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [16 x i8]
%12 = alloca [2 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 0, i32* %21
%22 = load i8*, i8** %4
%23 = call i32 @strlen(i8* %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %2
store i32 0, i32* %3
br label %451
26: ; preds = %2
store i32 0, i32* %20
%27 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 0
%28 = call i32 @memset(i8* %27, i8 signext 0, i32 2)
%29 = load i32, i32* %5
%30 = mul nsw i32 %29, 2
store i32 %30, i32* %17
%31 = load i32, i32* %17
%32 = add nsw i32 %31, 1
%33 = call i64 @calloc(i32 %32, i32 1)
%34 = inttoptr i64 %33 to i8*
store i8* %34, i8** %6
%35 = load i32, i32* %17
%36 = add nsw i32 %35, 1
%37 = call i64 @calloc(i32 %36, i32 1)
%38 = inttoptr i64 %37 to i8*
store i8* %38, i8** %7
%39 = load i8*, i8** %6
%40 = icmp ne i8* %39, null
br i1 %40, label %41, label %44
41: ; preds = %26
%42 = load i8*, i8** %7
%43 = icmp ne i8* %42, null
br i1 %43, label %48, label %44
44: ; preds = %41, %26
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%47 = call i32 @exit(i32 -1)
unreachable
48: ; preds = %41
%49 = load i32, i32* %21
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = load i32, i32* %5
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %52)
br label %54
54: ; preds = %51, %48
%55 = load i8*, i8** %4
store i8* %55, i8** %10
%56 = load i8*, i8** %7
store i8* %56, i8** %8
br label %57
57: ; preds = %72, %54
%58 = load i8*, i8** %10
%59 = getelementptr inbounds i8, i8* %58, i32 1
store i8* %59, i8** %10
%60 = load i8, i8* %58
%61 = sext i8 %60 to i32
store i32 %61, i32* %13
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %73
63: ; preds = %57
%64 = load i32, i32* %13
%65 = call i32 @isspace(i32 %64)
%66 = icmp ne i32 %65, 0
br i1 %66, label %72, label %67
67: ; preds = %63
%68 = load i32, i32* %13
%69 = trunc i32 %68 to i8
%70 = load i8*, i8** %8
%71 = getelementptr inbounds i8, i8* %70, i32 1
store i8* %71, i8** %8
store i8 %69, i8* %70
br label %72
72: ; preds = %67, %63
br label %57
73: ; preds = %57
%74 = load i8*, i8** %8
store i8 0, i8* %74
%75 = load i32, i32* %21
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %83
77: ; preds = %73
%78 = load i8*, i8** %7
%79 = call i32 @strlen(i8* %78)
store i32 %79, i32* %16
%80 = load i8*, i8** %7
%81 = load i32, i32* %16
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %80, i32 %81)
br label %83
83: ; preds = %77, %73
%84 = load i8*, i8** %6
store i8* %84, i8** %10
%85 = load i8*, i8** %7
store i8* %85, i8** %8
%86 = load i8*, i8** %6
%87 = load i32, i32* %17
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %86, i64 %88
store i8 -1, i8* %89
br label %90
90: ; preds = %178, %83
%91 = load i8*, i8** %8
%92 = getelementptr inbounds i8, i8* %91, i32 1
store i8* %92, i8** %8
%93 = load i8, i8* %91
%94 = sext i8 %93 to i32
store i32 %94, i32* %13
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %179
96: ; preds = %90
%97 = load i32, i32* %13
switch i32 %97, label %167 [
i32 67, label %98
i32 99, label %98
i32 83, label %98
i32 115, label %98
]
98: ; preds = %96, %96, %96, %96
%99 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
store i8* %99, i8** %9
store i32 0, i32* %15
br label %100
100: ; preds = %111, %98
%101 = load i32, i32* %15
%102 = icmp slt i32 %101, 16
br i1 %102, label %103, label %109
103: ; preds = %100
%104 = load i8*, i8** %8
%105 = load i8, i8* %104
%106 = sext i8 %105 to i32
%107 = call i64 @isdigit(i32 %106)
%108 = icmp ne i64 %107, 0
br label %109
109: ; preds = %103, %100
%110 = phi i1 [ false, %100 ], [ %108, %103 ]
br i1 %110, label %111, label %119
111: ; preds = %109
%112 = load i8*, i8** %8
%113 = getelementptr inbounds i8, i8* %112, i32 1
store i8* %113, i8** %8
%114 = load i8, i8* %112
%115 = load i8*, i8** %9
%116 = getelementptr inbounds i8, i8* %115, i32 1
store i8* %116, i8** %9
store i8 %114, i8* %115
%117 = load i32, i32* %15
%118 = add nsw i32 %117, 1
store i32 %118, i32* %15
br label %100
119: ; preds = %109
%120 = load i8*, i8** %9
store i8 0, i8* %120
%121 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%122 = call i32 @atoi(i8* %121)
%123 = sub nsw i32 %122, 1
store i32 %123, i32* %15
%124 = load i8*, i8** %10
%125 = getelementptr inbounds i8, i8* %124, i32 1
store i8* %125, i8** %10
store i8 40, i8* %124
%126 = load i8*, i8** %10
%127 = load i8, i8* %126
%128 = sext i8 %127 to i32
%129 = icmp eq i32 %128, -1
br i1 %129, label %130, label %131
130: ; preds = %119
br label %450
131: ; preds = %119
store i32 0, i32* %14
br label %132
132: ; preds = %147, %131
%133 = load i32, i32* %14
%134 = load i32, i32* %15
%135 = icmp slt i32 %133, %134
br i1 %135, label %136, label %150
136: ; preds = %132
%137 = load i32, i32* %13
%138 = trunc i32 %137 to i8
%139 = load i8*, i8** %10
%140 = getelementptr inbounds i8, i8* %139, i32 1
store i8* %140, i8** %10
store i8 %138, i8* %139
%141 = load i8*, i8** %10
%142 = load i8, i8* %141
%143 = sext i8 %142 to i32
%144 = icmp eq i32 %143, -1
br i1 %144, label %145, label %146
145: ; preds = %136
br label %450
146: ; preds = %136
br label %147
147: ; preds = %146
%148 = load i32, i32* %14
%149 = add nsw i32 %148, 1
store i32 %149, i32* %14
br label %132
150: ; preds = %132
%151 = load i8*, i8** %10
%152 = getelementptr inbounds i8, i8* %151, i32 1
store i8* %152, i8** %10
store i8 126, i8* %151
%153 = load i8*, i8** %10
%154 = load i8, i8* %153
%155 = sext i8 %154 to i32
%156 = icmp eq i32 %155, -1
br i1 %156, label %157, label %158
157: ; preds = %150
br label %450
158: ; preds = %150
%159 = load i8*, i8** %10
%160 = getelementptr inbounds i8, i8* %159, i32 1
store i8* %160, i8** %10
store i8 41, i8* %159
%161 = load i8*, i8** %10
%162 = load i8, i8* %161
%163 = sext i8 %162 to i32
%164 = icmp eq i32 %163, -1
br i1 %164, label %165, label %166
165: ; preds = %158
br label %450
166: ; preds = %158
br label %178
167: ; preds = %96
%168 = load i32, i32* %13
%169 = trunc i32 %168 to i8
%170 = load i8*, i8** %10
%171 = getelementptr inbounds i8, i8* %170, i32 1
store i8* %171, i8** %10
store i8 %169, i8* %170
%172 = load i8*, i8** %10
%173 = load i8, i8* %172
%174 = sext i8 %173 to i32
%175 = icmp eq i32 %174, -1
br i1 %175, label %176, label %177
176: ; preds = %167
br label %450
177: ; preds = %167
br label %178
178: ; preds = %177, %166
br label %90
179: ; preds = %90
%180 = load i8*, i8** %8
store i8 0, i8* %180
%181 = load i8*, i8** %6
%182 = load i32, i32* %17
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds i8, i8* %181, i64 %183
store i8 0, i8* %184
%185 = load i8*, i8** %7
%186 = load i8*, i8** %6
%187 = load i32, i32* %17
%188 = call i32 @strncpy(i8* %185, i8* %186, i32 %187)
%189 = load i32, i32* %21
%190 = icmp ne i32 %189, 0
br i1 %190, label %191, label %197
191: ; preds = %179
%192 = load i8*, i8** %7
%193 = call i32 @strlen(i8* %192)
store i32 %193, i32* %16
%194 = load i8*, i8** %7
%195 = load i32, i32* %16
%196 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %194, i32 %195)
br label %197
197: ; preds = %191, %179
store i32 0, i32* %18
br label %198
198: ; preds = %323, %197
%199 = load i8*, i8** %7
%200 = call i8* @strrchr(i8* %199, i8 signext 41)
store i8* %200, i8** %10
%201 = icmp ne i8* %200, null
br i1 %201, label %202, label %332
202: ; preds = %198
%203 = load i8*, i8** %10
store i8 0, i8* %203
%204 = load i8*, i8** %10
store i8* %204, i8** %8
br label %205
205: ; preds = %218, %202
%206 = load i8*, i8** %8
%207 = load i8*, i8** %7
%208 = icmp ugt i8* %206, %207
br i1 %208, label %209, label %216
209: ; preds = %205
%210 = load i8*, i8** %8
%211 = getelementptr inbounds i8, i8* %210, i64 -1
%212 = load i8, i8* %211
%213 = sext i8 %212 to i32
store i32 %213, i32* %13
%214 = call i64 @isdigit(i32 %213)
%215 = icmp ne i64 %214, 0
br label %216
216: ; preds = %209, %205
%217 = phi i1 [ false, %205 ], [ %215, %209 ]
br i1 %217, label %218, label %221
218: ; preds = %216
%219 = load i8*, i8** %8
%220 = getelementptr inbounds i8, i8* %219, i32 -1
store i8* %220, i8** %8
store i8 0, i8* %220
br label %205
221: ; preds = %216
%222 = load i32, i32* %18
%223 = add nsw i32 %222, 1
store i32 %223, i32* %18
br label %224
224: ; preds = %251, %221
%225 = load i32, i32* %18
%226 = icmp sgt i32 %225, 0
br i1 %226, label %227, label %231
227: ; preds = %224
%228 = load i8*, i8** %8
%229 = load i8*, i8** %7
%230 = icmp ugt i8* %228, %229
br label %231
231: ; preds = %227, %224
%232 = phi i1 [ false, %224 ], [ %230, %227 ]
br i1 %232, label %233, label %252
233: ; preds = %231
%234 = load i8*, i8** %8
%235 = getelementptr inbounds i8, i8* %234, i32 -1
store i8* %235, i8** %8
%236 = load i8*, i8** %8
%237 = load i8, i8* %236
%238 = sext i8 %237 to i32
%239 = icmp eq i32 %238, 41
br i1 %239, label %240, label %243
240: ; preds = %233
%241 = load i32, i32* %18
%242 = add nsw i32 %241, 1
store i32 %242, i32* %18
br label %243
243: ; preds = %240, %233
%244 = load i8*, i8** %8
%245 = load i8, i8* %244
%246 = sext i8 %245 to i32
%247 = icmp eq i32 %246, 40
br i1 %247, label %248, label %251
248: ; preds = %243
%249 = load i32, i32* %18
%250 = add nsw i32 %249, -1
store i32 %250, i32* %18
br label %251
251: ; preds = %248, %243
br label %224
252: ; preds = %231
%253 = load i32, i32* %18
%254 = icmp ne i32 %253, 0
br i1 %254, label %255, label %257
255: ; preds = %252
%256 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %20
br label %422
257: ; preds = %252
%258 = load i8*, i8** %8
store i8 0, i8* %258
store i32 1, i32* %19
%259 = load i8*, i8** %8
store i8* %259, i8** %9
br label %260
260: ; preds = %273, %257
%261 = load i8*, i8** %9
%262 = load i8*, i8** %7
%263 = icmp ugt i8* %261, %262
br i1 %263, label %264, label %271
264: ; preds = %260
%265 = load i8*, i8** %9
%266 = getelementptr inbounds i8, i8* %265, i64 -1
%267 = load i8, i8* %266
%268 = sext i8 %267 to i32
store i32 %268, i32* %13
%269 = call i64 @isdigit(i32 %268)
%270 = icmp ne i64 %269, 0
br label %271
271: ; preds = %264, %260
%272 = phi i1 [ false, %260 ], [ %270, %264 ]
br i1 %272, label %273, label %276
273: ; preds = %271
%274 = load i8*, i8** %9
%275 = getelementptr inbounds i8, i8* %274, i32 -1
store i8* %275, i8** %9
br label %260
276: ; preds = %271
%277 = load i8*, i8** %9
%278 = call i32 @strlen(i8* %277)
%279 = icmp sgt i32 %278, 0
br i1 %279, label %280, label %284
280: ; preds = %276
%281 = load i8*, i8** %9
%282 = call i32 @atoi(i8* %281)
store i32 %282, i32* %19
%283 = load i8*, i8** %9
store i8 0, i8* %283
br label %284
284: ; preds = %280, %276
%285 = load i8*, i8** %6
%286 = load i8*, i8** %7
%287 = load i32, i32* %17
%288 = call i32 @strncpy(i8* %285, i8* %286, i32 %287)
%289 = load i8*, i8** %6
%290 = call i32 @strlen(i8* %289)
%291 = load i32, i32* %19
%292 = load i8*, i8** %8
%293 = getelementptr inbounds i8, i8* %292, i64 1
%294 = call i32 @strlen(i8* %293)
%295 = mul nsw i32 %291, %294
%296 = add nsw i32 %290, %295
%297 = load i32, i32* %17
%298 = icmp sgt i32 %296, %297
br i1 %298, label %299, label %300
299: ; preds = %284
br label %450
300: ; preds = %284
store i32 0, i32* %15
br label %301
301: ; preds = %310, %300
%302 = load i32, i32* %15
%303 = load i32, i32* %19
%304 = icmp slt i32 %302, %303
br i1 %304, label %305, label %313
305: ; preds = %301
%306 = load i8*, i8** %6
%307 = load i8*, i8** %8
%308 = getelementptr inbounds i8, i8* %307, i64 1
%309 = call i32 @strcat(i8* %306, i8* %308)
br label %310
310: ; preds = %305
%311 = load i32, i32* %15
%312 = add nsw i32 %311, 1
store i32 %312, i32* %15
br label %301
313: ; preds = %301
%314 = load i8*, i8** %6
%315 = call i32 @strlen(i8* %314)
%316 = load i8*, i8** %10
%317 = getelementptr inbounds i8, i8* %316, i64 1
%318 = call i32 @strlen(i8* %317)
%319 = add nsw i32 %315, %318
%320 = load i32, i32* %17
%321 = icmp sgt i32 %319, %320
br i1 %321, label %322, label %323
322: ; preds = %313
br label %450
323: ; preds = %313
%324 = load i8*, i8** %6
%325 = load i8*, i8** %10
%326 = getelementptr inbounds i8, i8* %325, i64 1
%327 = call i32 @strcat(i8* %324, i8* %326)
%328 = load i8*, i8** %7
%329 = load i8*, i8** %6
%330 = load i32, i32* %17
%331 = call i32 @strncpy(i8* %328, i8* %329, i32 %330)
br label %198
332: ; preds = %198
%333 = load i8*, i8** %7
%334 = call i8* @strrchr(i8* %333, i8 signext 40)
%335 = icmp ne i8* %334, null
br i1 %335, label %336, label %338
336: ; preds = %332
%337 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %20
br label %422
338: ; preds = %332
%339 = load i32, i32* %21
%340 = icmp ne i32 %339, 0
br i1 %340, label %341, label %347
341: ; preds = %338
%342 = load i8*, i8** %7
%343 = call i32 @strlen(i8* %342)
store i32 %343, i32* %16
%344 = load i8*, i8** %7
%345 = load i32, i32* %16
%346 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %344, i32 %345)
br label %347
347: ; preds = %341, %338
br label %348
348: ; preds = %403, %347
%349 = load i8*, i8** %7
%350 = call i8* @strpbrk(i8* %349, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
store i8* %350, i8** %9
%351 = icmp ne i8* %350, null
br i1 %351, label %352, label %412
352: ; preds = %348
%353 = load i8*, i8** %9
store i8* %353, i8** %10
br label %354
354: ; preds = %361, %352
%355 = load i8*, i8** %10
%356 = getelementptr inbounds i8, i8* %355, i32 1
store i8* %356, i8** %10
%357 = load i8, i8* %356
%358 = sext i8 %357 to i32
store i32 %358, i32* %13
%359 = call i64 @isdigit(i32 %358)
%360 = icmp ne i64 %359, 0
br i1 %360, label %361, label %362
361: ; preds = %354
br label %354
362: ; preds = %354
%363 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 0
%364 = load i8*, i8** %10
%365 = call i32 @strncpy(i8* %363, i8* %364, i32 1)
%366 = load i8*, i8** %10
store i8 0, i8* %366
%367 = load i8*, i8** %9
%368 = call i32 @atoi(i8* %367)
store i32 %368, i32* %19
%369 = load i8*, i8** %9
store i8 0, i8* %369
%370 = load i8*, i8** %6
%371 = load i8*, i8** %7
%372 = load i32, i32* %17
%373 = call i32 @strncpy(i8* %370, i8* %371, i32 %372)
%374 = load i8*, i8** %6
%375 = call i32 @strlen(i8* %374)
%376 = load i32, i32* %19
%377 = add nsw i32 %375, %376
%378 = load i32, i32* %17
%379 = icmp sgt i32 %377, %378
br i1 %379, label %380, label %381
380: ; preds = %362
br label %450
381: ; preds = %362
store i32 0, i32* %15
br label %382
382: ; preds = %390, %381
%383 = load i32, i32* %15
%384 = load i32, i32* %19
%385 = icmp slt i32 %383, %384
br i1 %385, label %386, label %393
386: ; preds = %382
%387 = load i8*, i8** %6
%388 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 0
%389 = call i32 @strcat(i8* %387, i8* %388)
br label %390
390: ; preds = %386
%391 = load i32, i32* %15
%392 = add nsw i32 %391, 1
store i32 %392, i32* %15
br label %382
393: ; preds = %382
%394 = load i8*, i8** %6
%395 = call i32 @strlen(i8* %394)
%396 = load i8*, i8** %10
%397 = getelementptr inbounds i8, i8* %396, i64 1
%398 = call i32 @strlen(i8* %397)
%399 = add nsw i32 %395, %398
%400 = load i32, i32* %17
%401 = icmp sgt i32 %399, %400
br i1 %401, label %402, label %403
402: ; preds = %393
br label %450
403: ; preds = %393
%404 = load i8*, i8** %6
%405 = load i8*, i8** %10
%406 = getelementptr inbounds i8, i8* %405, i64 1
%407 = call i32 @strcat(i8* %404, i8* %406)
%408 = load i8*, i8** %7
%409 = load i8*, i8** %6
%410 = load i32, i32* %17
%411 = call i32 @strncpy(i8* %408, i8* %409, i32 %410)
br label %348
412: ; preds = %348
%413 = load i32, i32* %21
%414 = icmp ne i32 %413, 0
br i1 %414, label %415, label %421
415: ; preds = %412
%416 = load i8*, i8** %7
%417 = call i32 @strlen(i8* %416)
store i32 %417, i32* %16
%418 = load i8*, i8** %7
%419 = load i32, i32* %16
%420 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %418, i32 %419)
br label %421
421: ; preds = %415, %412
br label %422
422: ; preds = %450, %421, %336, %255
%423 = load i8*, i8** %7
%424 = call i32 @strlen(i8* %423)
store i32 %424, i32* %16
%425 = load i32, i32* %16
%426 = load i32, i32* %5
%427 = icmp sge i32 %425, %426
br i1 %427, label %428, label %432
428: ; preds = %422
%429 = load i32, i32* @stderr
%430 = load i32, i32* %5
%431 = call i32 (i32, i8*, ...) @fprintf(i32 %429, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.5, i64 0, i64 0), i32 %430)
store i32 1, i32* %20
br label %432
432: ; preds = %428, %422
%433 = load i8*, i8** %7
%434 = load i32, i32* %5
%435 = sub nsw i32 %434, 1
%436 = sext i32 %435 to i64
%437 = getelementptr inbounds i8, i8* %433, i64 %436
store i8 0, i8* %437
%438 = load i32, i32* %20
%439 = icmp ne i32 %438, 0
br i1 %439, label %444, label %440
440: ; preds = %432
%441 = load i8*, i8** %4
%442 = load i8*, i8** %7
%443 = call i32 @strcpy(i8* %441, i8* %442)
br label %444
444: ; preds = %440, %432
%445 = load i8*, i8** %7
%446 = call i32 @free(i8* %445)
%447 = load i8*, i8** %6
%448 = call i32 @free(i8* %447)
%449 = load i32, i32* %20
store i32 %449, i32* %3
br label %451
450: ; preds = %402, %380, %322, %299, %176, %165, %157, %145, %130
store i32 -1, i32* %20
br label %422
451: ; preds = %444, %25
%452 = load i32, i32* %3
ret i32 %452
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"expandf: memory allocation error\0A\00"
@.str.4 = [11 x i8] c"0123456789\00"
@.str.5 = [74 x i8] c"expandf error: expanded format length exceeds allocated buffer size (%d)\0A\00"
@str.6 = [38 x i8] c"expandf error: unbalanced parentheses\00"
define i32 @expandf(i8* %0, i32 %1) {
%3 = alloca [16 x i8]
%4 = alloca [2 x i8]
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @strlen(i8* %0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %365, label %9
9: ; preds = %2
%10 = call i32 @memset(i8* %6, i8 signext 0, i32 2)
%11 = shl nsw i32 %1, 1
%12 = or i32 %11, 1
%13 = call i64 @calloc(i32 %12, i32 1)
%14 = inttoptr i64 %13 to i8*
%15 = call i64 @calloc(i32 %12, i32 1)
%16 = inttoptr i64 %15 to i8*
%17 = icmp ne i64 %13, 0
%18 = icmp ne i64 %15, 0
%19 = select i1 %17, i1 %18, i1 false
br i1 %19, label %20, label %23
20: ; preds = %9
%21 = load i8, i8* %0
%22 = icmp eq i8 %21, 0
br i1 %22, label %41, label %27
23: ; preds = %9
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @exit(i32 -1)
unreachable
27: ; preds = %20, %37
%28 = phi i8 [ %39, %37 ], [ %21, %20 ]
%29 = phi i8* [ %31, %37 ], [ %0, %20 ]
%30 = phi i8* [ %38, %37 ], [ %16, %20 ]
%31 = getelementptr inbounds i8, i8* %29, i64 1
%32 = sext i8 %28 to i32
%33 = call i32 @isspace(i32 %32)
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %27
%36 = getelementptr inbounds i8, i8* %30, i64 1
store i8 %28, i8* %30
br label %37
37: ; preds = %35, %27
%38 = phi i8* [ %30, %27 ], [ %36, %35 ]
%39 = load i8, i8* %31
%40 = icmp eq i8 %39, 0
br i1 %40, label %41, label %27
41: ; preds = %37, %20
%42 = phi i8* [ %16, %20 ], [ %38, %37 ]
store i8 0, i8* %42
%43 = sext i32 %11 to i64
%44 = getelementptr inbounds i8, i8* %14, i64 %43
store i8 -1, i8* %44
%45 = getelementptr inbounds i8, i8* %16, i64 1
%46 = load i8, i8* %16
%47 = icmp eq i8 %46, 0
br i1 %47, label %224, label %48
48: ; preds = %41
%49 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 1
%50 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 2
%51 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 3
%52 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 4
%53 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 5
%54 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 6
%55 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 7
%56 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 8
%57 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 9
%58 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 10
%59 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 11
%60 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 12
%61 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 13
%62 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 14
%63 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 15
%64 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 16
br label %65
65: ; preds = %48, %218
%66 = phi i8 [ %222, %218 ], [ %46, %48 ]
%67 = phi i8* [ %221, %218 ], [ %45, %48 ]
%68 = phi i8* [ %219, %218 ], [ %14, %48 ]
%69 = sext i8 %66 to i32
%70 = add nsw i32 %69, -67
%71 = call i32 @llvm.fshl.i32(i32 %70, i32 %70, i32 28)
%72 = icmp ult i32 %71, 4
br i1 %72, label %73, label %214
73: ; preds = %65
%74 = load i8, i8* %67
%75 = sext i8 %74 to i32
%76 = call i64 @isdigit(i32 %75)
%77 = icmp eq i64 %76, 0
br i1 %77, label %186, label %78
78: ; preds = %73
%79 = getelementptr inbounds i8, i8* %67, i64 1
%80 = load i8, i8* %67
store i8 %80, i8* %5
%81 = load i8, i8* %79
%82 = sext i8 %81 to i32
%83 = call i64 @isdigit(i32 %82)
%84 = icmp eq i64 %83, 0
br i1 %84, label %186, label %85
85: ; preds = %78
%86 = getelementptr inbounds i8, i8* %67, i64 2
%87 = load i8, i8* %79
store i8 %87, i8* %49
%88 = load i8, i8* %86
%89 = sext i8 %88 to i32
%90 = call i64 @isdigit(i32 %89)
%91 = icmp eq i64 %90, 0
br i1 %91, label %186, label %92
92: ; preds = %85
%93 = getelementptr inbounds i8, i8* %67, i64 3
%94 = load i8, i8* %86
store i8 %94, i8* %50
%95 = load i8, i8* %93
%96 = sext i8 %95 to i32
%97 = call i64 @isdigit(i32 %96)
%98 = icmp eq i64 %97, 0
br i1 %98, label %186, label %99
99: ; preds = %92
%100 = getelementptr inbounds i8, i8* %67, i64 4
%101 = load i8, i8* %93
store i8 %101, i8* %51
%102 = load i8, i8* %100
%103 = sext i8 %102 to i32
%104 = call i64 @isdigit(i32 %103)
%105 = icmp eq i64 %104, 0
br i1 %105, label %186, label %106
106: ; preds = %99
%107 = getelementptr inbounds i8, i8* %67, i64 5
%108 = load i8, i8* %100
store i8 %108, i8* %52
%109 = load i8, i8* %107
%110 = sext i8 %109 to i32
%111 = call i64 @isdigit(i32 %110)
%112 = icmp eq i64 %111, 0
br i1 %112, label %186, label %113
113: ; preds = %106
%114 = getelementptr inbounds i8, i8* %67, i64 6
%115 = load i8, i8* %107
store i8 %115, i8* %53
%116 = load i8, i8* %114
%117 = sext i8 %116 to i32
%118 = call i64 @isdigit(i32 %117)
%119 = icmp eq i64 %118, 0
br i1 %119, label %186, label %120
120: ; preds = %113
%121 = getelementptr inbounds i8, i8* %67, i64 7
%122 = load i8, i8* %114
store i8 %122, i8* %54
%123 = load i8, i8* %121
%124 = sext i8 %123 to i32
%125 = call i64 @isdigit(i32 %124)
%126 = icmp eq i64 %125, 0
br i1 %126, label %186, label %127
127: ; preds = %120
%128 = getelementptr inbounds i8, i8* %67, i64 8
%129 = load i8, i8* %121
store i8 %129, i8* %55
%130 = load i8, i8* %128
%131 = sext i8 %130 to i32
%132 = call i64 @isdigit(i32 %131)
%133 = icmp eq i64 %132, 0
br i1 %133, label %186, label %134
134: ; preds = %127
%135 = getelementptr inbounds i8, i8* %67, i64 9
%136 = load i8, i8* %128
store i8 %136, i8* %56
%137 = load i8, i8* %135
%138 = sext i8 %137 to i32
%139 = call i64 @isdigit(i32 %138)
%140 = icmp eq i64 %139, 0
br i1 %140, label %186, label %141
141: ; preds = %134
%142 = getelementptr inbounds i8, i8* %67, i64 10
%143 = load i8, i8* %135
store i8 %143, i8* %57
%144 = load i8, i8* %142
%145 = sext i8 %144 to i32
%146 = call i64 @isdigit(i32 %145)
%147 = icmp eq i64 %146, 0
br i1 %147, label %186, label %148
148: ; preds = %141
%149 = getelementptr inbounds i8, i8* %67, i64 11
%150 = load i8, i8* %142
store i8 %150, i8* %58
%151 = load i8, i8* %149
%152 = sext i8 %151 to i32
%153 = call i64 @isdigit(i32 %152)
%154 = icmp eq i64 %153, 0
br i1 %154, label %186, label %155
155: ; preds = %148
%156 = getelementptr inbounds i8, i8* %67, i64 12
%157 = load i8, i8* %149
store i8 %157, i8* %59
%158 = load i8, i8* %156
%159 = sext i8 %158 to i32
%160 = call i64 @isdigit(i32 %159)
%161 = icmp eq i64 %160, 0
br i1 %161, label %186, label %162
162: ; preds = %155
%163 = getelementptr inbounds i8, i8* %67, i64 13
%164 = load i8, i8* %156
store i8 %164, i8* %60
%165 = load i8, i8* %163
%166 = sext i8 %165 to i32
%167 = call i64 @isdigit(i32 %166)
%168 = icmp eq i64 %167, 0
br i1 %168, label %186, label %169
169: ; preds = %162
%170 = getelementptr inbounds i8, i8* %67, i64 14
%171 = load i8, i8* %163
store i8 %171, i8* %61
%172 = load i8, i8* %170
%173 = sext i8 %172 to i32
%174 = call i64 @isdigit(i32 %173)
%175 = icmp eq i64 %174, 0
br i1 %175, label %186, label %176
176: ; preds = %169
%177 = getelementptr inbounds i8, i8* %67, i64 15
%178 = load i8, i8* %170
store i8 %178, i8* %62
%179 = load i8, i8* %177
%180 = sext i8 %179 to i32
%181 = call i64 @isdigit(i32 %180)
%182 = icmp eq i64 %181, 0
br i1 %182, label %186, label %183
183: ; preds = %176
%184 = getelementptr inbounds i8, i8* %67, i64 16
%185 = load i8, i8* %177
store i8 %185, i8* %63
br label %186
186: ; preds = %183, %176, %169, %162, %155, %148, %141, %134, %127, %120, %113, %106, %99, %92, %85, %78, %73
%187 = phi i8* [ %5, %73 ], [ %49, %78 ], [ %50, %85 ], [ %51, %92 ], [ %52, %99 ], [ %53, %106 ], [ %54, %113 ], [ %55, %120 ], [ %56, %127 ], [ %57, %134 ], [ %58, %141 ], [ %59, %148 ], [ %60, %155 ], [ %61, %162 ], [ %62, %169 ], [ %63, %176 ], [ %64, %183 ]
%188 = phi i8* [ %67, %73 ], [ %79, %78 ], [ %86, %85 ], [ %93, %92 ], [ %100, %99 ], [ %107, %106 ], [ %114, %113 ], [ %121, %120 ], [ %128, %127 ], [ %135, %134 ], [ %142, %141 ], [ %149, %148 ], [ %156, %155 ], [ %163, %162 ], [ %170, %169 ], [ %177, %176 ], [ %184, %183 ]
store i8 0, i8* %187
%189 = call i32 @atoi(i8* %5)
%190 = add i32 %189, -1
%191 = getelementptr inbounds i8, i8* %68, i64 1
store i8 40, i8* %68
%192 = load i8, i8* %191
%193 = icmp eq i8 %192, -1
br i1 %193, label %344, label %194
194: ; preds = %186
%195 = icmp sgt i32 %189, 1
br i1 %195, label %198, label %205
196: ; preds = %198
%197 = icmp eq i32 %204, %190
br i1 %197, label %205, label %198
198: ; preds = %194, %196
%199 = phi i32 [ %204, %196 ], [ 0, %194 ]
%200 = phi i8* [ %201, %196 ], [ %191, %194 ]
%201 = getelementptr inbounds i8, i8* %200, i64 1
store i8 %66, i8* %200
%202 = load i8, i8* %201
%203 = icmp eq i8 %202, -1
%204 = add nuw nsw i32 %199, 1
br i1 %203, label %344, label %196
205: ; preds = %196, %194
%206 = phi i8* [ %191, %194 ], [ %201, %196 ]
%207 = getelementptr inbounds i8, i8* %206, i64 1
store i8 126, i8* %206
%208 = load i8, i8* %207
%209 = icmp eq i8 %208, -1
br i1 %209, label %344, label %210
210: ; preds = %205
%211 = getelementptr inbounds i8, i8* %206, i64 2
store i8 41, i8* %207
%212 = load i8, i8* %211
%213 = icmp eq i8 %212, -1
br i1 %213, label %344, label %218
214: ; preds = %65
%215 = getelementptr inbounds i8, i8* %68, i64 1
store i8 %66, i8* %68
%216 = load i8, i8* %215
%217 = icmp eq i8 %216, -1
br i1 %217, label %344, label %218
218: ; preds = %214, %210
%219 = phi i8* [ %215, %214 ], [ %211, %210 ]
%220 = phi i8* [ %67, %214 ], [ %188, %210 ]
%221 = getelementptr inbounds i8, i8* %220, i64 1
%222 = load i8, i8* %220
%223 = icmp eq i8 %222, 0
br i1 %223, label %224, label %65
224: ; preds = %218, %41
%225 = phi i8* [ %45, %41 ], [ %221, %218 ]
store i8 0, i8* %225
store i8 0, i8* %44
%226 = call i32 @strncpy(i8* %16, i8* %14, i32 %11)
%227 = call i8* @strrchr(i8* %16, i8 signext 41)
%228 = icmp eq i8* %227, null
br i1 %228, label %301, label %229
229: ; preds = %224, %296
%230 = phi i8* [ %299, %296 ], [ %227, %224 ]
store i8 0, i8* %230
%231 = icmp ugt i8* %230, %16
br i1 %231, label %232, label %241
232: ; preds = %229, %239
%233 = phi i8* [ %234, %239 ], [ %230, %229 ]
%234 = getelementptr inbounds i8, i8* %233, i64 -1
%235 = load i8, i8* %234
%236 = sext i8 %235 to i32
%237 = call i64 @isdigit(i32 %236)
%238 = icmp eq i64 %237, 0
br i1 %238, label %241, label %239
239: ; preds = %232
store i8 0, i8* %234
%240 = icmp ugt i8* %234, %16
br i1 %240, label %232, label %241
241: ; preds = %232, %239, %229
%242 = phi i8* [ %230, %229 ], [ %234, %239 ], [ %233, %232 ]
%243 = icmp ugt i8* %242, %16
br i1 %243, label %244, label %341
244: ; preds = %241, %244
%245 = phi i32 [ %254, %244 ], [ 1, %241 ]
%246 = phi i8* [ %247, %244 ], [ %242, %241 ]
%247 = getelementptr inbounds i8, i8* %246, i64 -1
%248 = load i8, i8* %247
%249 = icmp eq i8 %248, 41
%250 = zext i1 %249 to i32
%251 = add nuw nsw i32 %245, %250
%252 = icmp eq i8 %248, 40
%253 = sext i1 %252 to i32
%254 = add nsw i32 %251, %253
%255 = icmp ne i32 %254, 0
%256 = icmp ugt i8* %247, %16
%257 = select i1 %255, i1 %256, i1 false
br i1 %257, label %244, label %258
258: ; preds = %244
%259 = icmp eq i32 %254, 0
br i1 %259, label %260, label %341
260: ; preds = %258
store i8 0, i8* %247
br label %261
261: ; preds = %264, %260
%262 = phi i8* [ %247, %260 ], [ %265, %264 ]
%263 = icmp ugt i8* %262, %16
br i1 %263, label %264, label %270
264: ; preds = %261
%265 = getelementptr inbounds i8, i8* %262, i64 -1
%266 = load i8, i8* %265
%267 = sext i8 %266 to i32
%268 = call i64 @isdigit(i32 %267)
%269 = icmp eq i64 %268, 0
br i1 %269, label %270, label %261
270: ; preds = %261, %264
%271 = call i32 @strlen(i8* %262)
%272 = icmp sgt i32 %271, 0
br i1 %272, label %273, label %275
273: ; preds = %270
%274 = call i32 @atoi(i8* %262)
store i8 0, i8* %262
br label %275
275: ; preds = %273, %270
%276 = phi i32 [ %274, %273 ], [ 1, %270 ]
%277 = call i32 @strncpy(i8* %14, i8* %16, i32 %11)
%278 = call i32 @strlen(i8* %14)
%279 = call i32 @strlen(i8* %246)
%280 = mul nsw i32 %279, %276
%281 = add nsw i32 %280, %278
%282 = icmp sgt i32 %281, %11
br i1 %282, label %344, label %283
283: ; preds = %275
%284 = icmp sgt i32 %276, 0
br i1 %284, label %285, label %290
285: ; preds = %283, %285
%286 = phi i32 [ %288, %285 ], [ 0, %283 ]
%287 = call i32 @strcat(i8* %14, i8* %246)
%288 = add nuw nsw i32 %286, 1
%289 = icmp eq i32 %288, %276
br i1 %289, label %290, label %285
290: ; preds = %285, %283
%291 = call i32 @strlen(i8* %14)
%292 = getelementptr inbounds i8, i8* %230, i64 1
%293 = call i32 @strlen(i8* %292)
%294 = add nsw i32 %293, %291
%295 = icmp sgt i32 %294, %11
br i1 %295, label %344, label %296
296: ; preds = %290
%297 = call i32 @strcat(i8* %14, i8* %292)
%298 = call i32 @strncpy(i8* %16, i8* %14, i32 %11)
%299 = call i8* @strrchr(i8* %16, i8 signext 41)
%300 = icmp eq i8* %299, null
br i1 %300, label %301, label %229
301: ; preds = %296, %224
%302 = call i8* @strrchr(i8* %16, i8 signext 40)
%303 = icmp eq i8* %302, null
br i1 %303, label %304, label %341
304: ; preds = %301
%305 = call i8* @strpbrk(i8* %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%306 = icmp eq i8* %305, null
br i1 %306, label %344, label %307
307: ; preds = %304, %336
%308 = phi i8* [ %339, %336 ], [ %305, %304 ]
br label %309
309: ; preds = %307, %309
%310 = phi i8* [ %311, %309 ], [ %308, %307 ]
%311 = getelementptr inbounds i8, i8* %310, i64 1
%312 = load i8, i8* %311
%313 = sext i8 %312 to i32
%314 = call i64 @isdigit(i32 %313)
%315 = icmp eq i64 %314, 0
br i1 %315, label %316, label %309
316: ; preds = %309
%317 = call i32 @strncpy(i8* %6, i8* %311, i32 1)
store i8 0, i8* %311
%318 = call i32 @atoi(i8* %308)
store i8 0, i8* %308
%319 = call i32 @strncpy(i8* %14, i8* %16, i32 %11)
%320 = call i32 @strlen(i8* %14)
%321 = add nsw i32 %320, %318
%322 = icmp sgt i32 %321, %11
br i1 %322, label %344, label %323
323: ; preds = %316
%324 = icmp sgt i32 %318, 0
br i1 %324, label %325, label %330
325: ; preds = %323, %325
%326 = phi i32 [ %328, %325 ], [ 0, %323 ]
%327 = call i32 @strcat(i8* %14, i8* %6)
%328 = add nuw nsw i32 %326, 1
%329 = icmp eq i32 %328, %318
br i1 %329, label %330, label %325
330: ; preds = %325, %323
%331 = call i32 @strlen(i8* %14)
%332 = getelementptr inbounds i8, i8* %310, i64 2
%333 = call i32 @strlen(i8* %332)
%334 = add nsw i32 %333, %331
%335 = icmp sgt i32 %334, %11
br i1 %335, label %344, label %336
336: ; preds = %330
%337 = call i32 @strcat(i8* %14, i8* %332)
%338 = call i32 @strncpy(i8* %16, i8* %14, i32 %11)
%339 = call i8* @strpbrk(i8* %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%340 = icmp eq i8* %339, null
br i1 %340, label %344, label %307
341: ; preds = %258, %241, %301
%342 = phi i8* [ getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0), %301 ], [ getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0), %241 ], [ getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0), %258 ]
%343 = call i32 @puts(i8* dereferenceable(1) %342)
br label %344
344: ; preds = %186, %205, %210, %214, %198, %275, %290, %336, %330, %316, %341, %304
%345 = phi i1 [ true, %304 ], [ false, %341 ], [ true, %336 ], [ false, %330 ], [ false, %316 ], [ false, %290 ], [ false, %275 ], [ false, %198 ], [ false, %214 ], [ false, %210 ], [ false, %205 ], [ false, %186 ]
%346 = phi i32 [ 0, %304 ], [ 1, %341 ], [ 0, %336 ], [ -1, %330 ], [ -1, %316 ], [ -1, %290 ], [ -1, %275 ], [ -1, %198 ], [ -1, %214 ], [ -1, %210 ], [ -1, %205 ], [ -1, %186 ]
%347 = call i32 @strlen(i8* %16)
%348 = icmp slt i32 %347, %1
br i1 %348, label %355, label %349
349: ; preds = %344
%350 = load i32, i32* @stderr
%351 = call i32 (i32, i8*, ...) @fprintf(i32 %350, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.5, i64 0, i64 0), i32 %1)
%352 = add nsw i32 %1, -1
%353 = sext i32 %352 to i64
%354 = getelementptr inbounds i8, i8* %16, i64 %353
store i8 0, i8* %354
br label %361
355: ; preds = %344
%356 = add nsw i32 %1, -1
%357 = sext i32 %356 to i64
%358 = getelementptr inbounds i8, i8* %16, i64 %357
store i8 0, i8* %358
br i1 %345, label %359, label %361
359: ; preds = %355
%360 = call i32 @strcpy(i8* %0, i8* %16)
br label %361
361: ; preds = %349, %359, %355
%362 = phi i32 [ 1, %349 ], [ 0, %359 ], [ %346, %355 ]
%363 = call i32 @free(i8* %16)
%364 = call i32 @free(i8* %14)
br label %365
365: ; preds = %2, %361
%366 = phi i32 [ %362, %361 ], [ 0, %2 ]
ret i32 %366
}