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

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ temp;

/* Variables and functions */
int /*<<< orphan*/ F_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
char *insert_suffix(char *, char *);
int is_server_exist(char *, int);
int /*<<< orphan*/ memset(char *, char, int);
char *my_malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int strlen(char *);
char *change_same_name(char *localpath, int index, int flag) {
  printf("###################change same name...##################\n");
  int i = 1;
  char *filename = NULL;
  char *new_path = NULL;
  char *path = NULL;
  char temp[256] = {0};
  char suffix[6] = {0};
  char *p = localpath;
  p = p + strlen(localpath);
  while (p[0] != '/' && strlen(p) < strlen(localpath))
    p--;
  filename = my_malloc(strlen(p) + 1);
  sprintf(filename, "%s", p + 1);
  path = my_malloc(strlen(localpath) - strlen(p) + 1);
  snprintf(path, strlen(localpath) - strlen(p) + 1, "%s", localpath);
  int exit = 1;
  while (exit) {
    int n = i;
    int j = 0;
    while ((n = (n / 10))) {
      j++;
    }
    memset(temp, '\0', sizeof(temp));
    snprintf(temp, 252 - j, "%s", filename);
    sprintf(suffix, "(%d)", i);
    char *new_name = insert_suffix(temp, suffix);
    i++;
    new_path = my_malloc(strlen(path) + strlen(new_name) + 2);
    sprintf(new_path, "%s/%s", path, new_name);
    if (flag == 0)
      exit = is_server_exist(new_path, index);
    else if (flag == 1) {
      if (access(new_path, F_OK) != 0)
        exit = 0;
    }
    free(new_name);
  }
  free(path);
  free(filename);
  printf("new_path = %s\n", new_path);
  return new_path;
}


x86 assembly (clang, -O0):
<change_same_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1090 <memset@plt>
lea    -0x136(%rbp),%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1090 <memset@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x140(%rbp)
mov    -0x140(%rbp),%rax
mov    %rax,-0x160(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x160(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x140(%rbp)
mov    -0x140(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2f,%ecx
mov    %al,-0x161(%rbp)
je     1289 <change_same_name+0xe9>
mov    -0x140(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x168(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x168(%rbp),%eax
cmp    %ecx,%eax
setl   %al
mov    %al,-0x161(%rbp)
mov    -0x161(%rbp),%al
test   $0x1,%al
jne    129c <change_same_name+0xfc>
jmp    12b3 <change_same_name+0x113>
mov    -0x140(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x140(%rbp)
jmp    1240 <change_same_name+0xa0>
mov    -0x140(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
call   1040 <my_malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x140(%rbp),%rdx
add    $0x1,%rdx
lea    0xd5f(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x178(%rbp)
mov    -0x140(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x178(%rbp),%edi
sub    %eax,%edi
add    $0x1,%edi
call   1040 <my_malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x170(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x174(%rbp)
mov    -0x140(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x174(%rbp),%esi
mov    -0x170(%rbp),%rdi
sub    %eax,%esi
add    $0x1,%esi
mov    -0x8(%rbp),%rcx
lea    0xce6(%rip),%rdx
call   1080 <snprintf@plt>
movl   $0x1,-0x144(%rbp)
cmpl   $0x0,-0x144(%rbp)
je     14e4 <change_same_name+0x344>
mov    -0x14(%rbp),%eax
mov    %eax,-0x148(%rbp)
movl   $0x0,-0x14c(%rbp)
mov    -0x148(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x148(%rbp)
cmp    $0x0,%eax
je     13bc <change_same_name+0x21c>
mov    -0x14c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14c(%rbp)
jmp    138b <change_same_name+0x1eb>
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1090 <memset@plt>
lea    -0x130(%rbp),%rdi
mov    $0xfc,%esi
sub    -0x14c(%rbp),%esi
mov    -0x20(%rbp),%rcx
lea    0xc56(%rip),%rdx
call   1080 <snprintf@plt>
lea    -0x136(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xc38(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x130(%rbp),%rdi
lea    -0x136(%rbp),%rsi
call   1050 <insert_suffix@plt>
mov    %rax,-0x158(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x17c(%rbp)
mov    -0x158(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x17c(%rbp),%edi
add    %eax,%edi
add    $0x2,%edi
call   1040 <my_malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    -0x158(%rbp),%rcx
lea    0xbce(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
cmpl   $0x0,-0x10(%rbp)
jne    1499 <change_same_name+0x2f9>
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   10a0 <is_server_exist@plt>
mov    %eax,-0x144(%rbp)
jmp    14d3 <change_same_name+0x333>
cmpl   $0x1,-0x10(%rbp)
jne    14ce <change_same_name+0x32e>
mov    -0x28(%rbp),%rdi
mov    0x2b2a(%rip),%rax
mov    (%rax),%esi
call   10b0 <access@plt>
cmp    $0x0,%rax
je     14c9 <change_same_name+0x329>
movl   $0x0,-0x144(%rbp)
jmp    14ce <change_same_name+0x32e>
jmp    14d3 <change_same_name+0x333>
mov    -0x158(%rbp),%rdi
call   1030 <free@plt>
jmp    136b <change_same_name+0x1cb>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rsi
lea    0xb44(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<change_same_name>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
mov    %edx,0xc(%rsp)
mov    %esi,0x8(%rsp)
mov    %rdi,%r14
lea    0xe37(%rip),%rdi
call   1070 <puts@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movw   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
mov    %r14,%rdi
call   1080 <strlen@plt>
cltq
lea    (%r14,%rax,1),%rbx
cmpb   $0x2f,(%r14,%rax,1)
jne    1290 <change_same_name+0xd0>
mov    %rbx,%rbp
jmp    12b3 <change_same_name+0xf3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1080 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1080 <strlen@plt>
cmp    %eax,%ebp
jge    127d <change_same_name+0xbd>
lea    -0x1(%rbx),%rbp
cmpb   $0x2f,-0x1(%rbx)
mov    %rbp,%rbx
jne    1290 <change_same_name+0xd0>
mov    %rbp,%rdi
call   1080 <strlen@plt>
lea    0x1(%rax),%edi
call   1040 <my_malloc@plt>
lea    0x1(%rbp),%rsi
mov    %rax,0x18(%rsp)
mov    %rax,%rdi
call   1060 <strcpy@plt>
mov    %r14,%rdi
call   1080 <strlen@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1080 <strlen@plt>
sub    %eax,%ebx
add    $0x1,%ebx
mov    %ebx,%edi
call   1040 <my_malloc@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1080 <strlen@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1080 <strlen@plt>
sub    %eax,%ebx
add    $0x1,%ebx
lea    0xcf5(%rip),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rcx
call   10a0 <snprintf@plt>
mov    $0x1,%ebx
lea    0x20(%rsp),%r14
movl   $0x1,0x4(%rsp)
jmp    1370 <change_same_name+0x1b0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x2c91(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   10d0 <access@plt>
test   %rax,%rax
jne    1458 <change_same_name+0x298>
add    $0x1,%ebx
mov    %r12,%rdi
call   1030 <free@plt>
cmpl   $0x0,0x4(%rsp)
je     1460 <change_same_name+0x2a0>
mov    $0x0,%eax
cmp    $0xa,%ebx
jb     13a5 <change_same_name+0x1e5>
xor    %eax,%eax
mov    %ebx,%ecx
xchg   %ax,%ax
movslq %ecx,%rcx
imul   $0x66666667,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
lea    (%rdx,%rsi,1),%ecx
add    $0x1,%eax
add    %esi,%edx
add    $0x9,%edx
cmp    $0x12,%edx
ja     1380 <change_same_name+0x1c0>
mov    $0xfc,%ebp
sub    %eax,%ebp
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10b0 <memset@plt>
mov    %r14,%rdi
mov    %ebp,%esi
lea    0xc41(%rip),%rdx
mov    0x18(%rsp),%rcx
call   10a0 <snprintf@plt>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
lea    0xc20(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10e0 <sprintf@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1050 <insert_suffix@plt>
mov    %rax,%r12
mov    %r15,%rdi
call   1080 <strlen@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1080 <strlen@plt>
lea    (%rax,%rbp,1),%edi
add    $0x2,%edi
call   1040 <my_malloc@plt>
mov    %rax,%r13
mov    %rax,%rdi
lea    0xbe4(%rip),%rsi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   10e0 <sprintf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
je     1340 <change_same_name+0x180>
test   %eax,%eax
jne    135a <change_same_name+0x19a>
mov    %r13,%rdi
mov    0x8(%rsp),%esi
call   10c0 <is_server_exist@plt>
mov    %eax,0x4(%rsp)
jmp    135a <change_same_name+0x19a>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
lea    0xb92(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r13,%rax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [58 x i8] c"###################change same name...##################\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [5 x i8] c"(%d)\00"
@.str.3 = [6 x i8] c"%s/%s\00"
@F_OK = global i32 0
@.str.4 = [15 x i8] c"new_path = %s\0A\00"
define i8* @change_same_name(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [256 x i8]
%12 = alloca [6 x i8]
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %7
store i8* null, i8** %8
store i8* null, i8** %9
store i8* null, i8** %10
%19 = bitcast [256 x i8]* %11 to i8*
%20 = bitcast [6 x i8]* %12 to i8*
%21 = load i8*, i8** %4
store i8* %21, i8** %13
%22 = load i8*, i8** %13
%23 = load i8*, i8** %4
%24 = call i32 @strlen(i8* %23)
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
store i8* %26, i8** %13
br label %27
27: ; preds = %41, %3
%28 = load i8*, i8** %13
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 47
br i1 %32, label %33, label %39
33: ; preds = %27
%34 = load i8*, i8** %13
%35 = call i32 @strlen(i8* %34)
%36 = load i8*, i8** %4
%37 = call i32 @strlen(i8* %36)
%38 = icmp slt i32 %35, %37
br label %39
39: ; preds = %33, %27
%40 = phi i1 [ false, %27 ], [ %38, %33 ]
br i1 %40, label %41, label %44
41: ; preds = %39
%42 = load i8*, i8** %13
%43 = getelementptr inbounds i8, i8* %42, i32 -1
store i8* %43, i8** %13
br label %27
44: ; preds = %39
%45 = load i8*, i8** %13
%46 = call i32 @strlen(i8* %45)
%47 = add nsw i32 %46, 1
%48 = call i8* @my_malloc(i32 %47)
store i8* %48, i8** %8
%49 = load i8*, i8** %8
%50 = load i8*, i8** %13
%51 = getelementptr inbounds i8, i8* %50, i64 1
%52 = call i32 (i8*, i8*, ...) @sprintf(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %51)
%53 = load i8*, i8** %4
%54 = call i32 @strlen(i8* %53)
%55 = load i8*, i8** %13
%56 = call i32 @strlen(i8* %55)
%57 = sub nsw i32 %54, %56
%58 = add nsw i32 %57, 1
%59 = call i8* @my_malloc(i32 %58)
store i8* %59, i8** %10
%60 = load i8*, i8** %10
%61 = load i8*, i8** %4
%62 = call i32 @strlen(i8* %61)
%63 = load i8*, i8** %13
%64 = call i32 @strlen(i8* %63)
%65 = sub nsw i32 %62, %64
%66 = add nsw i32 %65, 1
%67 = load i8*, i8** %4
%68 = call i32 @snprintf(i8* %60, i32 %66, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %67)
store i32 1, i32* %14
br label %69
69: ; preds = %125, %44
%70 = load i32, i32* %14
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %128
72: ; preds = %69
%73 = load i32, i32* %7
store i32 %73, i32* %15
store i32 0, i32* %16
br label %74
74: ; preds = %78, %72
%75 = load i32, i32* %15
%76 = sdiv i32 %75, 10
store i32 %76, i32* %15
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %74
%79 = load i32, i32* %16
%80 = add nsw i32 %79, 1
store i32 %80, i32* %16
br label %74
81: ; preds = %74
%82 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%83 = call i32 @memset(i8* %82, i8 signext 0, i32 256)
%84 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%85 = load i32, i32* %16
%86 = sub nsw i32 252, %85
%87 = load i8*, i8** %8
%88 = call i32 @snprintf(i8* %84, i32 %86, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %87)
%89 = getelementptr inbounds [6 x i8], [6 x i8]* %12, i64 0, i64 0
%90 = load i32, i32* %7
%91 = call i32 (i8*, i8*, ...) @sprintf(i8* %89, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %90)
%92 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%93 = getelementptr inbounds [6 x i8], [6 x i8]* %12, i64 0, i64 0
%94 = call i8* @insert_suffix(i8* %92, i8* %93)
store i8* %94, i8** %17
%95 = load i32, i32* %7
%96 = add nsw i32 %95, 1
store i32 %96, i32* %7
%97 = load i8*, i8** %10
%98 = call i32 @strlen(i8* %97)
%99 = load i8*, i8** %17
%100 = call i32 @strlen(i8* %99)
%101 = add nsw i32 %98, %100
%102 = add nsw i32 %101, 2
%103 = call i8* @my_malloc(i32 %102)
store i8* %103, i8** %9
%104 = load i8*, i8** %9
%105 = load i8*, i8** %10
%106 = load i8*, i8** %17
%107 = call i32 (i8*, i8*, ...) @sprintf(i8* %104, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %105, i8* %106)
%108 = load i32, i32* %6
%109 = icmp eq i32 %108, 0
br i1 %109, label %110, label %114
110: ; preds = %81
%111 = load i8*, i8** %9
%112 = load i32, i32* %5
%113 = call i32 @is_server_exist(i8* %111, i32 %112)
store i32 %113, i32* %14
br label %125
114: ; preds = %81
%115 = load i32, i32* %6
%116 = icmp eq i32 %115, 1
br i1 %116, label %117, label %124
117: ; preds = %114
%118 = load i8*, i8** %9
%119 = load i32, i32* @F_OK
%120 = call i64 @access(i8* %118, i32 %119)
%121 = icmp ne i64 %120, 0
br i1 %121, label %122, label %123
122: ; preds = %117
store i32 0, i32* %14
br label %123
123: ; preds = %122, %117
br label %124
124: ; preds = %123, %114
br label %125
125: ; preds = %124, %110
%126 = load i8*, i8** %17
%127 = call i32 @free(i8* %126)
br label %69
128: ; preds = %69
%129 = load i8*, i8** %10
%130 = call i32 @free(i8* %129)
%131 = load i8*, i8** %8
%132 = call i32 @free(i8* %131)
%133 = load i8*, i8** %9
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %133)
%135 = load i8*, i8** %9
ret i8* %135
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [5 x i8] c"(%d)\00"
@.str.3 = [6 x i8] c"%s/%s\00"
@F_OK = global i32 0
@.str.4 = [15 x i8] c"new_path = %s\0A\00"
@str = [57 x i8] c"###################change same name...##################\00"
define i8* @change_same_name(i8* %0, i32 %1, i32 %2) {
%4 = alloca [256 x i8]
%5 = alloca [6 x i8]
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%9 = tail call i32 @strlen(i8* %0)
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 47
br i1 %13, label %23, label %14
14: ; preds = %3, %19
%15 = phi i8* [ %20, %19 ], [ %11, %3 ]
%16 = tail call i32 @strlen(i8* %15)
%17 = tail call i32 @strlen(i8* %0)
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %23
19: ; preds = %14
%20 = getelementptr inbounds i8, i8* %15, i64 -1
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 47
br i1 %22, label %23, label %14
23: ; preds = %14, %19, %3
%24 = phi i8* [ %11, %3 ], [ %20, %19 ], [ %15, %14 ]
%25 = tail call i32 @strlen(i8* %24)
%26 = add nsw i32 %25, 1
%27 = tail call i8* @my_malloc(i32 %26)
%28 = getelementptr inbounds i8, i8* %24, i64 1
%29 = tail call i8* @strcpy(i8* dereferenceable(1) %27, i8* %28)
%30 = tail call i32 @strlen(i8* %0)
%31 = tail call i32 @strlen(i8* %24)
%32 = add i32 %30, 1
%33 = sub i32 %32, %31
%34 = tail call i8* @my_malloc(i32 %33)
%35 = tail call i32 @strlen(i8* %0)
%36 = tail call i32 @strlen(i8* %24)
%37 = add i32 %35, 1
%38 = sub i32 %37, %36
%39 = tail call i32 @snprintf(i8* %34, i32 %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %40
40: ; preds = %23, %73
%41 = phi i32 [ 1, %23 ], [ %58, %73 ]
%42 = phi i32 [ 1, %23 ], [ %74, %73 ]
%43 = icmp ult i32 %41, 10
br i1 %43, label %51, label %44
44: ; preds = %40, %44
%45 = phi i32 [ %48, %44 ], [ 0, %40 ]
%46 = phi i32 [ %47, %44 ], [ %41, %40 ]
%47 = sdiv i32 %46, 10
%48 = add nuw nsw i32 %45, 1
%49 = add nsw i32 %47, 9
%50 = icmp ult i32 %49, 19
br i1 %50, label %51, label %44
51: ; preds = %44, %40
%52 = phi i32 [ 0, %40 ], [ %48, %44 ]
%53 = call i32 @memset(i8* %7, i8 signext 0, i32 256)
%54 = sub nsw i32 252, %52
%55 = call i32 @snprintf(i8* %7, i32 %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%56 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %41)
%57 = call i8* @insert_suffix(i8* %7, i8* %8)
%58 = add nuw nsw i32 %41, 1
%59 = call i32 @strlen(i8* %34)
%60 = call i32 @strlen(i8* %57)
%61 = add i32 %59, 2
%62 = add i32 %61, %60
%63 = call i8* @my_malloc(i32 %62)
%64 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %63, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %34, i8* %57)
switch i32 %2, label %73 [
i32 0, label %65
i32 1, label %67
]
65: ; preds = %51
%66 = call i32 @is_server_exist(i8* %63, i32 %1)
br label %73
67: ; preds = %51
%68 = load i32, i32* @F_OK
%69 = call i64 @access(i8* %63, i32 %68)
%70 = icmp eq i64 %69, 0
br i1 %70, label %73, label %71
71: ; preds = %67
%72 = call i32 @free(i8* %57)
br label %77
73: ; preds = %67, %51, %65
%74 = phi i32 [ %66, %65 ], [ %42, %51 ], [ %42, %67 ]
%75 = call i32 @free(i8* %57)
%76 = icmp eq i32 %74, 0
br i1 %76, label %77, label %40
77: ; preds = %73, %71
%78 = call i32 @free(i8* %34)
%79 = call i32 @free(i8* %27)
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %63)
ret i8* %63
}