#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 /*<<< orphan*/ free(char *);
char *nl_nid_addr(char *);
int nl_nid_parse_addr(char *);
int /*<<< orphan*/ nl_oom();
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
char *strchr(char *, char);
char *strdup(char *);
int strlen(char *);
int strtoul(char *, int /*<<< orphan*/ *, int);
void nl_strxcat(char *s, char **nids, int len) {
  int i, o, lastn = 0;
  char *base, *p, *lnet = NULL, *savedn = NULL;
  if ((p = strchr(nids[0], '@')))
    lnet = p + 1;
  base = nl_nid_addr(nids[0]);
  o = nl_nid_parse_addr(base);
  base[o] = '\0';
  for (i = 0; i < len; i++) {
    char *addr = nl_nid_addr(nids[i]);
    int n = strtoul(&addr[o], NULL, 10);
    if (i == 0)
      sprintf(s + strlen(s), "%s[%s", base, &addr[o]);
    else if (i < len) {
      if (n == lastn + 1) {
        if (savedn)
          free(savedn);
        if (!(savedn = strdup(&addr[o])))
          nl_oom();
      } else {
        if (savedn) {
          sprintf(s + strlen(s), "-%s", savedn);
          free(savedn);
          savedn = NULL;
        }
        sprintf(s + strlen(s), ",%s", &addr[o]);
      }
    }
    if (i == len - 1) {
      if (savedn) {
        sprintf(s + strlen(s), "-%s", savedn);
        free(savedn);
      }
      strcat(s, "]");
      if (lnet)
        sprintf(s + strlen(s), "@%s", lnet);
    }
    free(addr);
    lastn = n;
  }
  free(base);
}


x86 assembly (clang, -O0):
<nl_strxcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x20(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x40,%esi
call   1070 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     11f8 <nl_strxcat+0x58>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <nl_nid_addr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1080 <nl_nid_parse_addr@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1444 <nl_strxcat+0x2a4>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <nl_nid_addr@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1090 <strtoul@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    12aa <nl_strxcat+0x10a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x58(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x28(%rbp),%rdx
mov    -0x48(%rbp),%rcx
movslq -0x1c(%rbp),%rax
add    %rax,%rcx
lea    0xd62(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
jmp    138a <nl_strxcat+0x1ea>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1385 <nl_strxcat+0x1e5>
mov    -0x4c(%rbp),%eax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    1305 <nl_strxcat+0x165>
cmpq   $0x0,-0x40(%rbp)
je     12db <nl_strxcat+0x13b>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
call   10c0 <strdup@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    1300 <nl_strxcat+0x160>
mov    $0x0,%al
call   1040 <nl_oom@plt>
jmp    1380 <nl_strxcat+0x1e0>
cmpq   $0x0,-0x40(%rbp)
je     134d <nl_strxcat+0x1ad>
mov    -0x8(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x60(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x40(%rbp),%rdx
lea    0xcd1(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x68(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x48(%rbp),%rdx
movslq -0x1c(%rbp),%rax
add    %rax,%rdx
lea    0xc91(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
jmp    1385 <nl_strxcat+0x1e5>
jmp    138a <nl_strxcat+0x1ea>
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1427 <nl_strxcat+0x287>
cmpq   $0x0,-0x40(%rbp)
je     13db <nl_strxcat+0x23b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x70(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x40(%rbp),%rdx
lea    0xc3b(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
lea    0xc28(%rip),%rsi
call   10a0 <strcat@plt>
cmpq   $0x0,-0x38(%rbp)
je     1422 <nl_strxcat+0x282>
mov    -0x8(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x78(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x38(%rbp),%rdx
lea    0xbf5(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
jmp    1427 <nl_strxcat+0x287>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1227 <nl_strxcat+0x87>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nl_strxcat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %edx,%r15d
mov    %rdi,0x8(%rsp)
mov    %rsi,0x40(%rsp)
mov    (%rsi),%rbp
mov    %rbp,%rdi
mov    $0x40,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
mov    %rax,0x20(%rsp)
cmove  %rax,%rcx
mov    %rcx,0x18(%rsp)
mov    %rbp,%rdi
call   1050 <nl_nid_addr@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <nl_nid_parse_addr@plt>
cltq
mov    %rbx,0x10(%rsp)
mov    %rax,0x38(%rsp)
movb   $0x0,(%rbx,%rax,1)
test   %r15d,%r15d
jle    13be <nl_strxcat+0x21e>
lea    -0x1(%r15),%eax
mov    %rax,0x30(%rsp)
mov    %r15d,%eax
mov    %rax,0x28(%rsp)
xor    %r14d,%r14d
xor    %r12d,%r12d
xor    %r13d,%r13d
jmp    1247 <nl_strxcat+0xa7>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1030 <free@plt>
add    $0x1,%r14
cmp    %r14,0x28(%rsp)
je     13be <nl_strxcat+0x21e>
mov    0x40(%rsp),%rax
mov    (%rax,%r14,8),%rdi
call   1050 <nl_nid_addr@plt>
mov    %rax,%rbp
mov    0x38(%rsp),%rax
lea    (%rax,%rbp,1),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1090 <strtoul@plt>
test   %r14,%r14
je     12b0 <nl_strxcat+0x110>
add    $0x1,%r12d
cmp    %r12d,%eax
jne    12f0 <nl_strxcat+0x150>
mov    %eax,%r12d
test   %r13,%r13
je     128e <nl_strxcat+0xee>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   10c0 <strdup@plt>
mov    %rax,%r13
test   %rax,%rax
mov    0x8(%rsp),%rbx
jne    12dc <nl_strxcat+0x13c>
xor    %eax,%eax
call   1040 <nl_oom@plt>
jmp    1343 <nl_strxcat+0x1a3>
nop
mov    %eax,%r12d
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
lea    0xd33(%rip),%rsi
mov    0x10(%rsp),%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   10b0 <sprintf@plt>
cmp    %r14,0x30(%rsp)
jne    1230 <nl_strxcat+0x90>
jmp    1351 <nl_strxcat+0x1b1>
nopl   0x0(%rax)
mov    %eax,%r12d
test   %r13,%r13
mov    0x8(%rsp),%rbx
je     1324 <nl_strxcat+0x184>
mov    %rbx,%rdi
call   1060 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
lea    0xcf4(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
lea    0xcd1(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
xor    %r13d,%r13d
cmp    %r14,0x30(%rsp)
jne    1230 <nl_strxcat+0x90>
test   %r13,%r13
je     137d <nl_strxcat+0x1dd>
mov    %rbx,%rdi
call   1060 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
lea    0xc9b(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
lea    0xc87(%rip),%rsi
call   10a0 <strcat@plt>
cmpq   $0x0,0x20(%rsp)
je     1230 <nl_strxcat+0x90>
mov    %rbx,%rdi
call   1060 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
lea    0xc63(%rip),%rsi
mov    0x18(%rsp),%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
jmp    1230 <nl_strxcat+0x90>
mov    0x10(%rsp),%rdi
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s[%s\00"
@.str.1 = [4 x i8] c"-%s\00"
@.str.2 = [4 x i8] c",%s\00"
@.str.3 = [2 x i8] c"]\00"
@.str.4 = [4 x i8] c"@%s\00"
define void @nl_strxcat(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
store i32 0, i32* %9
store i8* null, i8** %12
store i8* null, i8** %13
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i8* @strchr(i8* %18, i8 signext 64)
store i8* %19, i8** %11
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %24
21: ; preds = %3
%22 = load i8*, i8** %11
%23 = getelementptr inbounds i8, i8* %22, i64 1
store i8* %23, i8** %12
br label %24
24: ; preds = %21, %3
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i8* @nl_nid_addr(i8* %27)
store i8* %28, i8** %10
%29 = load i8*, i8** %10
%30 = call i32 @nl_nid_parse_addr(i8* %29)
store i32 %30, i32* %8
%31 = load i8*, i8** %10
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
store i8 0, i8* %34
store i32 0, i32* %7
br label %35
35: ; preds = %152, %24
%36 = load i32, i32* %7
%37 = load i32, i32* %6
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %155
39: ; preds = %35
%40 = load i8**, i8*** %5
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = call i8* @nl_nid_addr(i8* %44)
store i8* %45, i8** %14
%46 = load i8*, i8** %14
%47 = load i32, i32* %8
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = call i32 @strtoul(i8* %49, i32* null, i32 10)
store i32 %50, i32* %15
%51 = load i32, i32* %7
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %65
53: ; preds = %39
%54 = load i8*, i8** %4
%55 = load i8*, i8** %4
%56 = call i32 @strlen(i8* %55)
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %54, i64 %57
%59 = load i8*, i8** %10
%60 = load i8*, i8** %14
%61 = load i32, i32* %8
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %60, i64 %62
%64 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %58, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %59, i8* %63)
br label %116
65: ; preds = %39
%66 = load i32, i32* %7
%67 = load i32, i32* %6
%68 = icmp slt i32 %66, %67
br i1 %68, label %69, label %115
69: ; preds = %65
%70 = load i32, i32* %15
%71 = load i32, i32* %9
%72 = add nsw i32 %71, 1
%73 = icmp eq i32 %70, %72
br i1 %73, label %74, label %90
74: ; preds = %69
%75 = load i8*, i8** %13
%76 = icmp ne i8* %75, null
br i1 %76, label %77, label %80
77: ; preds = %74
%78 = load i8*, i8** %13
%79 = call i32 @free(i8* %78)
br label %80
80: ; preds = %77, %74
%81 = load i8*, i8** %14
%82 = load i32, i32* %8
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %81, i64 %83
%85 = call i8* @strdup(i8* %84)
store i8* %85, i8** %13
%86 = icmp ne i8* %85, null
br i1 %86, label %89, label %87
87: ; preds = %80
%88 = call i32 (...) @nl_oom()
br label %89
89: ; preds = %87, %80
br label %114
90: ; preds = %69
%91 = load i8*, i8** %13
%92 = icmp ne i8* %91, null
br i1 %92, label %93, label %103
93: ; preds = %90
%94 = load i8*, i8** %4
%95 = load i8*, i8** %4
%96 = call i32 @strlen(i8* %95)
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8, i8* %94, i64 %97
%99 = load i8*, i8** %13
%100 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %98, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %99)
%101 = load i8*, i8** %13
%102 = call i32 @free(i8* %101)
store i8* null, i8** %13
br label %103
103: ; preds = %93, %90
%104 = load i8*, i8** %4
%105 = load i8*, i8** %4
%106 = call i32 @strlen(i8* %105)
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8, i8* %104, i64 %107
%109 = load i8*, i8** %14
%110 = load i32, i32* %8
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i8, i8* %109, i64 %111
%113 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %108, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %112)
br label %114
114: ; preds = %103, %89
br label %115
115: ; preds = %114, %65
br label %116
116: ; preds = %115, %53
%117 = load i32, i32* %7
%118 = load i32, i32* %6
%119 = sub nsw i32 %118, 1
%120 = icmp eq i32 %117, %119
br i1 %120, label %121, label %148
121: ; preds = %116
%122 = load i8*, i8** %13
%123 = icmp ne i8* %122, null
br i1 %123, label %124, label %134
124: ; preds = %121
%125 = load i8*, i8** %4
%126 = load i8*, i8** %4
%127 = call i32 @strlen(i8* %126)
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i8, i8* %125, i64 %128
%130 = load i8*, i8** %13
%131 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %129, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %130)
%132 = load i8*, i8** %13
%133 = call i32 @free(i8* %132)
br label %134
134: ; preds = %124, %121
%135 = load i8*, i8** %4
%136 = call i32 @strcat(i8* %135, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%137 = load i8*, i8** %12
%138 = icmp ne i8* %137, null
br i1 %138, label %139, label %147
139: ; preds = %134
%140 = load i8*, i8** %4
%141 = load i8*, i8** %4
%142 = call i32 @strlen(i8* %141)
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8, i8* %140, i64 %143
%145 = load i8*, i8** %12
%146 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %144, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %145)
br label %147
147: ; preds = %139, %134
br label %148
148: ; preds = %147, %116
%149 = load i8*, i8** %14
%150 = call i32 @free(i8* %149)
%151 = load i32, i32* %15
store i32 %151, i32* %9
br label %152
152: ; preds = %148
%153 = load i32, i32* %7
%154 = add nsw i32 %153, 1
store i32 %154, i32* %7
br label %35
155: ; preds = %35
%156 = load i8*, i8** %10
%157 = call i32 @free(i8* %156)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s[%s\00"
@.str.1 = [4 x i8] c"-%s\00"
@.str.2 = [4 x i8] c",%s\00"
@.str.3 = [2 x i8] c"]\00"
@.str.4 = [4 x i8] c"@%s\00"
define void @nl_strxcat(i8* %0, i8** nocapture %1, i32 %2) {
%4 = load i8*, i8** %1
%5 = tail call i8* @strchr(i8* dereferenceable(1) %4, i8 signext 64)
%6 = icmp eq i8* %5, null
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = select i1 %6, i8* null, i8* %7
%9 = tail call i8* @nl_nid_addr(i8* %4)
%10 = tail call i32 @nl_nid_parse_addr(i8* %9)
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
store i8 0, i8* %12
%13 = icmp sgt i32 %2, 0
br i1 %13, label %14, label %79
14: ; preds = %3
%15 = add nsw i32 %2, -1
%16 = zext i32 %15 to i64
%17 = zext i32 %2 to i64
br label %18
18: ; preds = %14, %75
%19 = phi i64 [ 0, %14 ], [ %77, %75 ]
%20 = phi i32 [ 0, %14 ], [ %26, %75 ]
%21 = phi i8* [ null, %14 ], [ %58, %75 ]
%22 = getelementptr inbounds i8*, i8** %1, i64 %19
%23 = load i8*, i8** %22
%24 = tail call i8* @nl_nid_addr(i8* %23)
%25 = getelementptr inbounds i8, i8* %24, i64 %11
%26 = tail call i32 @strtoul(i8* nocapture %25, i32* null, i32 10)
%27 = icmp eq i64 %19, 0
br i1 %27, label %28, label %33
28: ; preds = %18
%29 = tail call i32 @strlen(i8* %0)
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %0, i64 %30
%32 = tail call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %31, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %25)
br label %57
33: ; preds = %18
%34 = add nsw i32 %20, 1
%35 = icmp eq i32 %26, %34
%36 = icmp eq i8* %21, null
br i1 %35, label %37, label %45
37: ; preds = %33
br i1 %36, label %40, label %38
38: ; preds = %37
%39 = tail call i32 @free(i8* %21)
br label %40
40: ; preds = %38, %37
%41 = tail call i8* @strdup(i8* %25)
%42 = icmp eq i8* %41, null
br i1 %42, label %43, label %57
43: ; preds = %40
%44 = tail call i32 (...) @nl_oom()
br label %57
45: ; preds = %33
br i1 %36, label %52, label %46
46: ; preds = %45
%47 = tail call i32 @strlen(i8* %0)
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %0, i64 %48
%50 = tail call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %49, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%51 = tail call i32 @free(i8* %21)
br label %52
52: ; preds = %46, %45
%53 = tail call i32 @strlen(i8* %0)
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %0, i64 %54
%56 = tail call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %55, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %25)
br label %57
57: ; preds = %40, %43, %52, %28
%58 = phi i8* [ %21, %28 ], [ %41, %40 ], [ null, %43 ], [ null, %52 ]
%59 = icmp eq i64 %19, %16
br i1 %59, label %60, label %75
60: ; preds = %57
%61 = icmp eq i8* %58, null
br i1 %61, label %68, label %62
62: ; preds = %60
%63 = tail call i32 @strlen(i8* %0)
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8, i8* %0, i64 %64
%66 = tail call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %65, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %58)
%67 = tail call i32 @free(i8* %58)
br label %68
68: ; preds = %62, %60
%69 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br i1 %6, label %75, label %70
70: ; preds = %68
%71 = tail call i32 @strlen(i8* %0)
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8, i8* %0, i64 %72
%74 = tail call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %73, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %8)
br label %75
75: ; preds = %68, %70, %57
%76 = tail call i32 @free(i8* %24)
%77 = add nuw nsw i64 %19, 1
%78 = icmp eq i64 %77, %17
br i1 %78, label %79, label %18
79: ; preds = %75, %3
%80 = tail call i32 @free(i8* %9)
ret void
}