#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 */
struct hostent {
  char *h_name;
};

/* Variables and functions */
char *MyBestHostname(char *, int, char *, char *);
struct hostent *gethostbyname(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *GetXUrl(char *display_name, char *auth, char *dest_url) {
  char *dpy_name, *proto = NULL;
  char *url, *ptr;
  char *name;
  struct hostent *host;
  int len, proto_len, dpy_len, name_len, auth_len;
  char hostname[256 + 1];
  len = 5;
  if (strncmp(display_name, "x11:", 4) == 0)
    dpy_name = display_name + 4;
  else
    dpy_name = display_name;
  ptr = strchr(dpy_name, '/');
  if (ptr != NULL) {
    proto = dpy_name;
    proto_len = ptr - dpy_name;
    dpy_name = ptr + 1;
    if (strncmp(proto, "local", proto_len) == 0)
      proto_len = 0;
  } else
    proto_len = 0;
  if (strncmp(dpy_name, "unix", 4) == 0)
    dpy_name += 4;
  dpy_name = MyBestHostname(hostname, 256, dpy_name, dest_url);
  host = gethostbyname(hostname);
  name = host->h_name;
  name_len = strlen(name);
  dpy_len = dpy_name == NULL ? 0 : strlen(dpy_name);
  auth_len = auth == NULL ? 0 : 6 + strlen(auth);
  len += proto_len + 1 + name_len + dpy_len + auth_len;
  url = ptr = (char *)malloc(len);
  if (url == NULL)
    return NULL;
  strcpy(ptr, "x11:");
  ptr += 4;
  if (proto_len != 0) {
    strncpy(ptr, proto, proto_len + 1);
    ptr += proto_len + 1;
  }
  if (name_len != 0) {
    strcpy(ptr, name);
    ptr += name_len;
  }
  if (dpy_len != 0) {
    strcpy(ptr, dpy_name);
    ptr += dpy_len;
  }
  if (auth_len != 0)
    sprintf(ptr, ";auth=%s", auth);
  else
    *ptr = '\0';
  return url;
}


x86 assembly (clang, -O0):
<GetXUrl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x5,-0x54(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe3f(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    11e6 <GetXUrl+0x56>
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
jmp    11ee <GetXUrl+0x5e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x2f,%esi
call   1070 <strchr@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     1256 <GetXUrl+0xc6>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x58(%rbp),%edx
lea    0xdca(%rip),%rsi
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1251 <GetXUrl+0xc1>
movl   $0x0,-0x58(%rbp)
jmp    125d <GetXUrl+0xcd>
movl   $0x0,-0x58(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xda3(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1288 <GetXUrl+0xf8>
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
lea    -0x170(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x100,%esi
call   10b0 <MyBestHostname@plt>
mov    %rax,-0x28(%rbp)
lea    -0x170(%rbp),%rdi
call   1080 <gethostbyname@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x60(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12e4 <GetXUrl+0x154>
xor    %eax,%eax
mov    %eax,-0x174(%rbp)
jmp    12f3 <GetXUrl+0x163>
mov    -0x28(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x174(%rbp)
mov    -0x174(%rbp),%eax
mov    %eax,-0x5c(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1314 <GetXUrl+0x184>
xor    %eax,%eax
mov    %eax,-0x178(%rbp)
jmp    1326 <GetXUrl+0x196>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
add    $0x6,%eax
mov    %eax,-0x178(%rbp)
mov    -0x178(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
add    -0x60(%rbp),%eax
add    -0x5c(%rbp),%eax
add    -0x64(%rbp),%eax
add    -0x54(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    136c <GetXUrl+0x1dc>
movq   $0x0,-0x8(%rbp)
jmp    143b <GetXUrl+0x2ab>
mov    -0x40(%rbp),%rdi
lea    0xc89(%rip),%rsi
call   1050 <strcpy@plt>
mov    -0x40(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x58(%rbp)
je     13b9 <GetXUrl+0x229>
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x58(%rbp),%edx
add    $0x1,%edx
call   1030 <strncpy@plt>
mov    -0x58(%rbp),%ecx
add    $0x1,%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x60(%rbp)
je     13e1 <GetXUrl+0x251>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x60(%rbp),%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x5c(%rbp)
je     1409 <GetXUrl+0x279>
mov    -0x40(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x5c(%rbp),%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x64(%rbp)
je     142c <GetXUrl+0x29c>
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xbee(%rip),%rsi
call   10a0 <sprintf@plt>
jmp    1433 <GetXUrl+0x2a3>
mov    -0x40(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetXUrl>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
mov    %rdx,%r14
mov    %rsi,%r13
mov    %rdi,%rbx
lea    0xe4f(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
lea    (%rbx,%rcx,4),%rbx
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     1212 <GetXUrl+0x82>
mov    %rax,%rbp
xor    %eax,%eax
mov    %rax,(%rsp)
mov    %ebp,%r15d
sub    %ebx,%r15d
add    $0x1,%rbp
lea    0xe12(%rip),%rsi
mov    %rbx,%rdi
mov    %r15d,%edx
call   1040 <strncmp@plt>
xor    %r12d,%r12d
test   %rax,%rax
cmovne %r15d,%r12d
mov    %rbx,0x8(%rsp)
mov    %rbp,%rbx
jmp    1222 <GetXUrl+0x92>
xor    %eax,%eax
mov    %rax,(%rsp)
xor    %r12d,%r12d
xor    %eax,%eax
mov    %rax,0x8(%rsp)
lea    0xde2(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
lea    (%rbx,%rcx,4),%rdx
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x100,%esi
mov    %r14,%rcx
call   10b0 <MyBestHostname@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1080 <gethostbyname@plt>
mov    (%rax),%rbp
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %eax,%r15d
test   %rbx,%rbx
je     1281 <GetXUrl+0xf1>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %rax,(%rsp)
test   %r13,%r13
mov    %r13,0x18(%rsp)
je     129c <GetXUrl+0x10c>
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %eax,%r13d
add    $0x6,%r13d
jmp    129f <GetXUrl+0x10f>
xor    %r13d,%r13d
lea    (%r12,%r15,1),%eax
add    (%rsp),%eax
lea    (%rax,%r13,1),%edi
add    $0x6,%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     1347 <GetXUrl+0x1b7>
mov    %rax,%r14
mov    %rbp,0x10(%rsp)
lea    0xd36(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcpy@plt>
mov    %r14,%rbp
add    $0x4,%rbp
test   %r12d,%r12d
je     12f8 <GetXUrl+0x168>
add    $0x1,%r12d
mov    %rbp,%rdi
mov    0x8(%rsp),%rsi
mov    %r12d,%edx
call   1030 <strncpy@plt>
movslq %r12d,%rax
add    %rax,%rbp
mov    %rbx,%r12
test   %r15d,%r15d
je     1313 <GetXUrl+0x183>
mov    %rbp,%rdi
mov    0x10(%rsp),%rsi
call   1050 <strcpy@plt>
movslq %r15d,%rax
add    %rax,%rbp
mov    (%rsp),%rbx
test   %ebx,%ebx
je     132c <GetXUrl+0x19c>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1050 <strcpy@plt>
movslq %ebx,%rax
add    %rax,%rbp
test   %r13d,%r13d
je     134c <GetXUrl+0x1bc>
lea    0xcd8(%rip),%rsi
mov    %rbp,%rdi
mov    0x18(%rsp),%rdx
call   10a0 <sprintf@plt>
jmp    1350 <GetXUrl+0x1c0>
xor    %r14d,%r14d
jmp    1350 <GetXUrl+0x1c0>
movb   $0x0,0x0(%rbp)
mov    %r14,%rax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.hostent = type { i8* }
@.str = [5 x i8] c"x11:\00"
@.str.1 = [6 x i8] c"local\00"
@.str.2 = [5 x i8] c"unix\00"
@.str.3 = [9 x i8] c";auth=%s\00"
define i8* @GetXUrl(i8* %0, i8* %1, i8* %2) {
%4 = alloca [257 x i8]
%5 = getelementptr inbounds [257 x i8], [257 x i8]* %4, i64 0, i64 0
%6 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i64 4, i64 0
%9 = getelementptr i8, i8* %0, i64 %8
%10 = tail call i8* @strchr(i8* dereferenceable(1) %9, i8 signext 47)
%11 = icmp eq i8* %10, null
br i1 %11, label %21, label %12
12: ; preds = %3
%13 = ptrtoint i8* %10 to i64
%14 = ptrtoint i8* %9 to i64
%15 = sub i64 %13, %14
%16 = trunc i64 %15 to i32
%17 = getelementptr inbounds i8, i8* %10, i64 1
%18 = tail call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%19 = icmp eq i64 %18, 0
%20 = select i1 %19, i32 0, i32 %16
br label %21
21: ; preds = %12, %3
%22 = phi i32 [ %20, %12 ], [ 0, %3 ]
%23 = phi i8* [ %9, %12 ], [ null, %3 ]
%24 = phi i8* [ %17, %12 ], [ %9, %3 ]
%25 = tail call i64 @strncmp(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%26 = icmp eq i64 %25, 0
%27 = select i1 %26, i64 4, i64 0
%28 = getelementptr i8, i8* %24, i64 %27
%29 = call i8* @MyBestHostname(i8* %5, i32 256, i8* %28, i8* %2)
%30 = call %struct.hostent* @gethostbyname(i8* %5)
%31 = getelementptr inbounds %struct.hostent, %struct.hostent* %30, i64 0, i32 0
%32 = load i8*, i8** %31
%33 = call i32 @strlen(i8* %32)
%34 = icmp eq i8* %29, null
br i1 %34, label %37, label %35
35: ; preds = %21
%36 = call i32 @strlen(i8* %29)
br label %37
37: ; preds = %21, %35
%38 = phi i32 [ %36, %35 ], [ 0, %21 ]
%39 = icmp eq i8* %1, null
br i1 %39, label %43, label %40
40: ; preds = %37
%41 = call i32 @strlen(i8* %1)
%42 = add nsw i32 %41, 6
br label %43
43: ; preds = %37, %40
%44 = phi i32 [ %42, %40 ], [ 0, %37 ]
%45 = add nsw i32 %22, 1
%46 = add i32 %22, 6
%47 = add i32 %46, %33
%48 = add i32 %47, %38
%49 = add i32 %48, %44
%50 = call i64 @malloc(i32 %49)
%51 = inttoptr i64 %50 to i8*
%52 = icmp eq i64 %50, 0
br i1 %52, label %81, label %53
53: ; preds = %43
%54 = call i32 @strcpy(i8* %51, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%55 = getelementptr inbounds i8, i8* %51, i64 4
%56 = icmp eq i32 %22, 0
br i1 %56, label %61, label %57
57: ; preds = %53
%58 = call i32 @strncpy(i8* %55, i8* %23, i32 %45)
%59 = sext i32 %45 to i64
%60 = getelementptr inbounds i8, i8* %55, i64 %59
br label %61
61: ; preds = %57, %53
%62 = phi i8* [ %60, %57 ], [ %55, %53 ]
%63 = icmp eq i32 %33, 0
br i1 %63, label %68, label %64
64: ; preds = %61
%65 = call i32 @strcpy(i8* %62, i8* %32)
%66 = sext i32 %33 to i64
%67 = getelementptr inbounds i8, i8* %62, i64 %66
br label %68
68: ; preds = %64, %61
%69 = phi i8* [ %67, %64 ], [ %62, %61 ]
%70 = icmp eq i32 %38, 0
br i1 %70, label %75, label %71
71: ; preds = %68
%72 = call i32 @strcpy(i8* %69, i8* %29)
%73 = sext i32 %38 to i64
%74 = getelementptr inbounds i8, i8* %69, i64 %73
br label %75
75: ; preds = %71, %68
%76 = phi i8* [ %74, %71 ], [ %69, %68 ]
%77 = icmp eq i32 %44, 0
br i1 %77, label %80, label %78
78: ; preds = %75
%79 = call i32 @sprintf(i8* dereferenceable(1) %76, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %1)
br label %81
80: ; preds = %75
store i8 0, i8* %76
br label %81
81: ; preds = %78, %80, %43
%82 = phi i8* [ null, %43 ], [ %51, %80 ], [ %51, %78 ]
ret i8* %82
}