#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*/ suffix_name;
typedef int /*<<< orphan*/ seq;
typedef int /*<<< orphan*/ prefix_name;
typedef int /*<<< orphan*/ path;
typedef int /*<<< orphan*/ parse_name;
typedef int /*<<< orphan*/ con_filename;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ free(char *);
scalar_t__ is_number(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
char *parse_name_from_path(char const *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, ...);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char const *, scalar_t__);
char *strrchr(char *, char);
char *get_confilicted_name(const char *fullname, int isfolder) {
  char *confilicted_name = NULL;
  char prefix_name[512];
  char suffix_name[256];
  char parse_name[512];
  char *p = NULL;
  char *p1 = NULL;
  char seq[8];
  int num = 0;
  char *filename = NULL;
  char path[512];
  int n = 0, j = 0;
  char con_filename[256];
  memset(prefix_name, 0, sizeof(prefix_name));
  memset(suffix_name, 0, sizeof(suffix_name));
  memset(parse_name, 0, sizeof(parse_name));
  memset(path, 0, sizeof(path));
  memset(con_filename, 0, sizeof(con_filename));
  filename = parse_name_from_path(fullname);
  strncpy(path, fullname, strlen(fullname) - strlen(filename) - 1);
  confilicted_name = (char *)malloc(sizeof(char) * 512);
  if (isfolder) {
    strcpy(parse_name, filename);
  } else {
    p = strrchr(filename, '.');
    if (p && filename[0] != '.') {
      strncpy(parse_name, filename, strlen(filename) - strlen(p));
      strcpy(suffix_name, p);
    } else {
      strcpy(parse_name, filename);
    }
  }
  p = NULL;
  p = strrchr(parse_name, '(');
  if (p) {
    p1 = strchr(p, ')');
    if (p1) {
      p++;
      memset(seq, 0, sizeof(seq));
      strncpy(seq, p, strlen(p) - strlen(p1));
      if (is_number(seq)) {
        num = atoi(seq);
        num++;
        n = num;
        while ((n = (n / 10))) {
          j++;
        }
        strncpy(prefix_name, parse_name, strlen(parse_name) - strlen(p) - 1);
      }
    }
  }
  if (num == 0) {
    num = 1;
    strcpy(prefix_name, parse_name);
  }
  snprintf(prefix_name, 252 - j - strlen(suffix_name), "%s", prefix_name);
  snprintf(con_filename, 256, "%s(%d)%s", prefix_name, num, suffix_name);
  snprintf(confilicted_name, 512, "%s/%s", path, con_filename);
  free(filename);
  filename = NULL;
  ;
  return confilicted_name;
}


x86 assembly (clang, -O0):
<get_confilicted_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8d0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x528(%rbp)
movq   $0x0,-0x530(%rbp)
movl   $0x0,-0x53c(%rbp)
movq   $0x0,-0x548(%rbp)
movl   $0x0,-0x754(%rbp)
movl   $0x0,-0x758(%rbp)
lea    -0x220(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   10c0 <memset@plt>
lea    -0x320(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10c0 <memset@plt>
lea    -0x520(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   10c0 <memset@plt>
lea    -0x750(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   10c0 <memset@plt>
lea    -0x860(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10c0 <memset@plt>
mov    -0x8(%rbp),%rdi
call   1070 <parse_name_from_path@plt>
mov    %rax,-0x548(%rbp)
lea    -0x750(%rbp),%rax
mov    %rax,-0x870(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x868(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <strlen@plt>
mov    %rax,-0x878(%rbp)
mov    -0x548(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x878(%rbp),%rdx
mov    -0x870(%rbp),%rdi
mov    -0x868(%rbp),%rsi
sub    %rax,%rdx
sub    $0x1,%rdx
call   1040 <strncpy@plt>
mov    $0x200,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     130e <get_confilicted_name+0x14e>
lea    -0x520(%rbp),%rdi
mov    -0x548(%rbp),%rsi
call   1050 <strcpy@plt>
jmp    13cf <get_confilicted_name+0x20f>
mov    -0x548(%rbp),%rdi
mov    $0x2e,%esi
call   10b0 <strrchr@plt>
mov    %rax,-0x528(%rbp)
cmpq   $0x0,-0x528(%rbp)
je     13b7 <get_confilicted_name+0x1f7>
mov    -0x548(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     13b7 <get_confilicted_name+0x1f7>
lea    -0x520(%rbp),%rax
mov    %rax,-0x888(%rbp)
mov    -0x548(%rbp),%rax
mov    %rax,-0x880(%rbp)
mov    -0x548(%rbp),%rdi
call   1080 <strlen@plt>
mov    %rax,-0x890(%rbp)
mov    -0x528(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x890(%rbp),%rdx
mov    -0x888(%rbp),%rdi
mov    -0x880(%rbp),%rsi
sub    %rax,%rdx
call   1040 <strncpy@plt>
lea    -0x320(%rbp),%rdi
mov    -0x528(%rbp),%rsi
call   1050 <strcpy@plt>
jmp    13ca <get_confilicted_name+0x20a>
lea    -0x520(%rbp),%rdi
mov    -0x548(%rbp),%rsi
call   1050 <strcpy@plt>
jmp    13cf <get_confilicted_name+0x20f>
movq   $0x0,-0x528(%rbp)
lea    -0x520(%rbp),%rdi
mov    $0x28,%esi
call   10b0 <strrchr@plt>
mov    %rax,-0x528(%rbp)
cmpq   $0x0,-0x528(%rbp)
je     157d <get_confilicted_name+0x3bd>
mov    -0x528(%rbp),%rdi
mov    $0x29,%esi
call   1090 <strchr@plt>
mov    %rax,-0x530(%rbp)
cmpq   $0x0,-0x530(%rbp)
je     1578 <get_confilicted_name+0x3b8>
mov    -0x528(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x528(%rbp)
lea    -0x538(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   10c0 <memset@plt>
lea    -0x538(%rbp),%rax
mov    %rax,-0x8a0(%rbp)
mov    -0x528(%rbp),%rax
mov    %rax,-0x898(%rbp)
mov    -0x528(%rbp),%rdi
call   1080 <strlen@plt>
mov    %rax,-0x8a8(%rbp)
mov    -0x530(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x8a8(%rbp),%rdx
mov    -0x8a0(%rbp),%rdi
mov    -0x898(%rbp),%rsi
sub    %rax,%rdx
call   1040 <strncpy@plt>
lea    -0x538(%rbp),%rdi
call   1060 <is_number@plt>
cmp    $0x0,%rax
je     1573 <get_confilicted_name+0x3b3>
lea    -0x538(%rbp),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x53c(%rbp)
mov    -0x53c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x53c(%rbp)
mov    -0x53c(%rbp),%eax
mov    %eax,-0x754(%rbp)
mov    -0x754(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x754(%rbp)
cmp    $0x0,%eax
je     1517 <get_confilicted_name+0x357>
mov    -0x758(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x758(%rbp)
jmp    14e6 <get_confilicted_name+0x326>
lea    -0x220(%rbp),%rax
mov    %rax,-0x8b8(%rbp)
lea    -0x520(%rbp),%rax
mov    %rax,-0x8b0(%rbp)
lea    -0x520(%rbp),%rdi
call   1080 <strlen@plt>
mov    %rax,-0x8c0(%rbp)
mov    -0x528(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x8c0(%rbp),%rdx
mov    -0x8b8(%rbp),%rdi
mov    -0x8b0(%rbp),%rsi
sub    %rax,%rdx
sub    $0x1,%rdx
call   1040 <strncpy@plt>
jmp    1578 <get_confilicted_name+0x3b8>
jmp    157d <get_confilicted_name+0x3bd>
cmpl   $0x0,-0x53c(%rbp)
jne    15a7 <get_confilicted_name+0x3e7>
movl   $0x1,-0x53c(%rbp)
lea    -0x220(%rbp),%rdi
lea    -0x520(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0x220(%rbp),%rax
mov    %rax,-0x8d0(%rbp)
mov    $0xfc,%eax
sub    -0x758(%rbp),%eax
cltq
mov    %rax,-0x8c8(%rbp)
lea    -0x320(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x8d0(%rbp),%rdi
mov    %rax,%rcx
mov    -0x8c8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,%esi
lea    -0x220(%rbp),%rcx
lea    0xa0d(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
lea    -0x860(%rbp),%rdi
lea    -0x220(%rbp),%rcx
mov    -0x53c(%rbp),%r8d
lea    -0x320(%rbp),%r9
mov    $0x100,%esi
lea    0x9d8(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x750(%rbp),%rcx
lea    -0x860(%rbp),%r8
mov    $0x200,%esi
lea    0x9bc(%rip),%rdx
mov    $0x0,%al
call   10a0 <snprintf@plt>
mov    -0x548(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x548(%rbp)
mov    -0x18(%rbp),%rax
add    $0x8d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_confilicted_name>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x818,%rsp
mov    %esi,%r12d
mov    %rdi,%rbp
lea    0x410(%rsp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   10c0 <memset@plt>
lea    0x210(%rsp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10c0 <memset@plt>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   10c0 <memset@plt>
lea    0x610(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   10c0 <memset@plt>
lea    0x310(%rsp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10c0 <memset@plt>
mov    %rbp,%rdi
call   1070 <parse_name_from_path@plt>
mov    %rax,%r15
mov    %rbp,%rdi
call   1080 <strlen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1080 <strlen@plt>
not    %rax
add    %rax,%rbx
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1040 <strncpy@plt>
mov    $0x200,%edi
call   10d0 <malloc@plt>
test   %r12d,%r12d
mov    %rax,(%rsp)
je     1452 <get_confilicted_name+0x292>
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
call   1050 <strcpy@plt>
lea    0x10(%rsp),%rdi
mov    $0x28,%esi
call   10b0 <strrchr@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     139b <get_confilicted_name+0x1db>
mov    %rax,%r13
mov    %rax,%rdi
mov    $0x29,%esi
call   1090 <strchr@plt>
test   %rax,%rax
je     139b <get_confilicted_name+0x1db>
mov    %rax,%rbp
add    $0x1,%r13
lea    0x8(%rsp),%r12
xor    %r14d,%r14d
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   10c0 <memset@plt>
mov    %r13,%rdi
call   1080 <strlen@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1080 <strlen@plt>
sub    %rax,%rbx
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1040 <strncpy@plt>
mov    %r12,%rdi
call   1060 <is_number@plt>
test   %rax,%rax
je     139b <get_confilicted_name+0x1db>
lea    0x8(%rsp),%rdi
call   10e0 <atoi@plt>
lea    0x1(%rax),%r12d
add    $0xa,%eax
xor    %r14d,%r14d
cmp    $0x13,%eax
jb     1365 <get_confilicted_name+0x1a5>
xor    %r14d,%r14d
mov    %r12d,%eax
nopw   0x0(%rax,%rax,1)
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
lea    (%rcx,%rdx,1),%eax
add    $0x1,%r14d
add    %edx,%ecx
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1340 <get_confilicted_name+0x180>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1080 <strlen@plt>
mov    %rax,%rbx
mov    %r13,%rdi
call   1080 <strlen@plt>
not    %rax
add    %rax,%rbx
lea    0x410(%rsp),%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1040 <strncpy@plt>
test   %r12d,%r12d
jne    13b3 <get_confilicted_name+0x1f3>
lea    0x410(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1050 <strcpy@plt>
mov    $0x1,%r12d
lea    0x210(%rsp),%r13
mov    %r13,%rdi
call   1080 <strlen@plt>
add    %r14d,%eax
mov    $0xfc,%esi
sub    %eax,%esi
lea    0xc32(%rip),%rdx
lea    0x410(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbp,%rcx
xor    %eax,%eax
call   10a0 <snprintf@plt>
lea    0xc10(%rip),%rdx
lea    0x310(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %rbp,%rcx
mov    %r12d,%r8d
mov    %r13,%r9
xor    %eax,%eax
call   10a0 <snprintf@plt>
lea    0xbf2(%rip),%rdx
lea    0x610(%rsp),%rcx
mov    (%rsp),%rbp
mov    %rbp,%rdi
mov    $0x200,%esi
mov    %rbx,%r8
xor    %eax,%eax
call   10a0 <snprintf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbp,%rax
add    $0x818,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15,%rdi
mov    $0x2e,%esi
call   10b0 <strrchr@plt>
test   %rax,%rax
je     1284 <get_confilicted_name+0xc4>
cmpb   $0x2e,(%r15)
je     1284 <get_confilicted_name+0xc4>
mov    %rax,%rbx
mov    %r15,%rdi
call   1080 <strlen@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1080 <strlen@plt>
sub    %rax,%rbp
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1040 <strncpy@plt>
lea    0x210(%rsp),%rdi
mov    %rbx,%rsi
jmp    128c <get_confilicted_name+0xcc>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [9 x i8] c"%s(%d)%s\00"
@.str.2 = [6 x i8] c"%s/%s\00"
define i8* @get_confilicted_name(i8* %0, i32 %1) {
%3 = alloca [512 x i8]
%4 = alloca [256 x i8]
%5 = alloca [512 x i8]
%6 = alloca [8 x i8]
%7 = alloca [512 x i8]
%8 = alloca [256 x i8]
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%15 = call i32 @memset(i8* %9, i32 0, i32 512)
%16 = call i32 @memset(i8* %10, i32 0, i32 256)
%17 = call i32 @memset(i8* %11, i32 0, i32 512)
%18 = call i32 @memset(i8* %13, i32 0, i32 512)
%19 = call i32 @memset(i8* %14, i32 0, i32 256)
%20 = call i8* @parse_name_from_path(i8* %0)
%21 = call i64 @strlen(i8* dereferenceable(1) %0)
%22 = call i64 @strlen(i8* dereferenceable(1) %20)
%23 = xor i64 %22, -1
%24 = add i64 %21, %23
%25 = call i32 @strncpy(i8* %13, i8* %0, i64 %24)
%26 = call i64 @malloc(i32 512)
%27 = inttoptr i64 %26 to i8*
%28 = icmp eq i32 %1, 0
br i1 %28, label %31, label %29
29: ; preds = %2
%30 = call i32 @strcpy(i8* %11, i8* %20)
br label %45
31: ; preds = %2
%32 = call i8* @strrchr(i8* dereferenceable(1) %20, i8 signext 46)
%33 = icmp eq i8* %32, null
br i1 %33, label %43, label %34
34: ; preds = %31
%35 = load i8, i8* %20
%36 = icmp eq i8 %35, 46
br i1 %36, label %43, label %37
37: ; preds = %34
%38 = call i64 @strlen(i8* %20)
%39 = call i64 @strlen(i8* %32)
%40 = sub nsw i64 %38, %39
%41 = call i32 @strncpy(i8* %11, i8* %20, i64 %40)
%42 = call i32 @strcpy(i8* %10, i8* %32)
br label %45
43: ; preds = %34, %31
%44 = call i32 @strcpy(i8* %11, i8* %20)
br label %45
45: ; preds = %37, %43, %29
%46 = call i8* @strrchr(i8* %11, i8 signext 40)
%47 = icmp eq i8* %46, null
br i1 %47, label %80, label %48
48: ; preds = %45
%49 = call i8* @strchr(i8* %46, i8 signext 41)
%50 = icmp eq i8* %49, null
br i1 %50, label %80, label %51
51: ; preds = %48
%52 = getelementptr inbounds i8, i8* %46, i64 1
%53 = call i32 @memset(i8* %12, i32 0, i32 8)
%54 = call i64 @strlen(i8* %52)
%55 = call i64 @strlen(i8* %49)
%56 = sub nsw i64 %54, %55
%57 = call i32 @strncpy(i8* %12, i8* %52, i64 %56)
%58 = call i64 @is_number(i8* %12)
%59 = icmp eq i64 %58, 0
br i1 %59, label %80, label %60
60: ; preds = %51
%61 = call i32 @atoi(i8* %12)
%62 = add nsw i32 %61, 1
%63 = add i32 %61, 10
%64 = icmp ult i32 %63, 19
br i1 %64, label %72, label %65
65: ; preds = %60, %65
%66 = phi i32 [ %69, %65 ], [ 0, %60 ]
%67 = phi i32 [ %68, %65 ], [ %62, %60 ]
%68 = sdiv i32 %67, 10
%69 = add nuw nsw i32 %66, 1
%70 = add nsw i32 %68, 9
%71 = icmp ult i32 %70, 19
br i1 %71, label %72, label %65
72: ; preds = %65, %60
%73 = phi i32 [ 0, %60 ], [ %69, %65 ]
%74 = call i64 @strlen(i8* %11)
%75 = call i64 @strlen(i8* %52)
%76 = xor i64 %75, -1
%77 = add i64 %74, %76
%78 = call i32 @strncpy(i8* %9, i8* %11, i64 %77)
%79 = icmp eq i32 %62, 0
br i1 %79, label %80, label %83
80: ; preds = %45, %48, %51, %72
%81 = phi i32 [ %73, %72 ], [ 0, %51 ], [ 0, %48 ], [ 0, %45 ]
%82 = call i32 @strcpy(i8* %9, i8* %11)
br label %83
83: ; preds = %80, %72
%84 = phi i32 [ %81, %80 ], [ %73, %72 ]
%85 = phi i32 [ 1, %80 ], [ %62, %72 ]
%86 = call i64 @strlen(i8* %10)
%87 = trunc i64 %86 to i32
%88 = add i32 %84, %87
%89 = sub i32 252, %88
%90 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %9, i32 %89, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
%91 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %14, i32 256, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 %85, i8* %10)
%92 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %27, i32 512, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %13, i8* %14)
%93 = call i32 @free(i8* %20)
ret i8* %27
}