#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 *);
scalar_t__ mCalloc(int, int);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
void Clean_Multifurcation(char **subtrees, int current_deg, int end_deg) {
  char *s_tmp;
  int i;
  if (current_deg > end_deg) {
    s_tmp = (char *)mCalloc(1000000, sizeof(char));
    strncat(s_tmp, "(", 1);
    strncat(s_tmp, subtrees[0], strlen(subtrees[0]));
    strncat(s_tmp, ",", 1);
    strncat(s_tmp, subtrees[1], strlen(subtrees[1]));
    strncat(s_tmp, ")", 1);
    free(subtrees[0]);
    subtrees[0] = s_tmp;
    for (i = 1; i < current_deg - 1; i++)
      strncpy(subtrees[i], subtrees[i + 1], strlen(subtrees[i + 1]));
    Clean_Multifurcation(subtrees, current_deg - 1, end_deg);
  }
  return;
}


x86 assembly (clang, -O0):
<Clean_Multifurcation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    12c7 <Clean_Multifurcation+0x167>
mov    $0xf4240,%edi
mov    $0x1,%esi
call   1080 <mCalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe64(%rip),%rsi
mov    $0x1,%edx
call   1070 <strncat@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
call   1070 <strncat@plt>
mov    -0x18(%rbp),%rdi
lea    0xe23(%rip),%rsi
mov    $0x1,%edx
call   1070 <strncat@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
call   1070 <strncat@plt>
mov    -0x18(%rbp),%rdi
lea    0xde0(%rip),%rsi
mov    $0x1,%edx
call   1070 <strncat@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12b5 <Clean_Multifurcation+0x155>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <strlen@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
call   1050 <strncpy@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    124c <Clean_Multifurcation+0xec>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <Clean_Multifurcation@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Clean_Multifurcation>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,0x4(%rsp)
cmp    %edx,%esi
jle    126f <Clean_Multifurcation+0x11f>
mov    %esi,%r14d
mov    %rdi,%rbx
lea    -0x1(%r14),%r12d
jmp    118f <Clean_Multifurcation+0x3f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xffffffff,%r12d
cmp    0x4(%rsp),%r14d
jle    126f <Clean_Multifurcation+0x11f>
mov    %r14d,%r15d
mov    %r12d,%r12d
mov    $0xf4240,%edi
mov    $0x1,%esi
call   1070 <mCalloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
lea    0xe4f(%rip),%rsi
mov    $0x1,%edx
call   1060 <strncat@plt>
mov    (%rbx),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1060 <strncat@plt>
mov    %rbp,%rdi
lea    0xe25(%rip),%rsi
mov    $0x1,%edx
call   1060 <strncat@plt>
mov    0x8(%rbx),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1060 <strncat@plt>
mov    %rbp,%rdi
lea    0xdfa(%rip),%rsi
mov    $0x1,%edx
call   1060 <strncat@plt>
mov    (%rbx),%rdi
call   1030 <free@plt>
mov    %rbp,(%rbx)
lea    -0x1(%r15),%r14d
cmp    $0x3,%r15d
jl     1180 <Clean_Multifurcation+0x30>
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%rax),%r13
mov    (%rbx,%rax,8),%rbp
mov    0x8(%rbx,%rax,8),%r15
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1040 <strncpy@plt>
mov    %r13,%rax
cmp    %r13,%r12
jne    1240 <Clean_Multifurcation+0xf0>
jmp    1180 <Clean_Multifurcation+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"(\00"
@.str.1 = [2 x i8] c",\00"
@.str.2 = [2 x i8] c")\00"
define void @Clean_Multifurcation(i8** %0, i32 %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %79
12: ; preds = %3
%13 = call i64 @mCalloc(i32 1000000, i32 1)
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %7
%15 = load i8*, i8** %7
%16 = call i32 @strncat(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%17 = load i8*, i8** %7
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = load i8**, i8*** %4
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 @strlen(i8* %23)
%25 = call i32 @strncat(i8* %17, i8* %20, i32 %24)
%26 = load i8*, i8** %7
%27 = call i32 @strncat(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%28 = load i8*, i8** %7
%29 = load i8**, i8*** %4
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = load i8**, i8*** %4
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @strlen(i8* %34)
%36 = call i32 @strncat(i8* %28, i8* %31, i32 %35)
%37 = load i8*, i8** %7
%38 = call i32 @strncat(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%39 = load i8**, i8*** %4
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = call i32 @free(i8* %41)
%43 = load i8*, i8** %7
%44 = load i8**, i8*** %4
%45 = getelementptr inbounds i8*, i8** %44, i64 0
store i8* %43, i8** %45
store i32 1, i32* %8
br label %46
46: ; preds = %71, %12
%47 = load i32, i32* %8
%48 = load i32, i32* %5
%49 = sub nsw i32 %48, 1
%50 = icmp slt i32 %47, %49
br i1 %50, label %51, label %74
51: ; preds = %46
%52 = load i8**, i8*** %4
%53 = load i32, i32* %8
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %52, i64 %54
%56 = load i8*, i8** %55
%57 = load i8**, i8*** %4
%58 = load i32, i32* %8
%59 = add nsw i32 %58, 1
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8*, i8** %57, i64 %60
%62 = load i8*, i8** %61
%63 = load i8**, i8*** %4
%64 = load i32, i32* %8
%65 = add nsw i32 %64, 1
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %63, i64 %66
%68 = load i8*, i8** %67
%69 = call i32 @strlen(i8* %68)
%70 = call i32 @strncpy(i8* %56, i8* %62, i32 %69)
br label %71
71: ; preds = %51
%72 = load i32, i32* %8
%73 = add nsw i32 %72, 1
store i32 %73, i32* %8
br label %46
74: ; preds = %46
%75 = load i8**, i8*** %4
%76 = load i32, i32* %5
%77 = sub nsw i32 %76, 1
%78 = load i32, i32* %6
br label %79
79: ; preds = %74, %3
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"(\00"
@.str.1 = [2 x i8] c",\00"
@.str.2 = [2 x i8] c")\00"
define void @Clean_Multifurcation(i8** nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, %2
br i1 %4, label %5, label %40
5: ; preds = %3
%6 = getelementptr inbounds i8*, i8** %0, i64 1
br label %9
7: ; preds = %30, %9
%8 = icmp sgt i32 %26, %2
br i1 %8, label %9, label %40
9: ; preds = %5, %7
%10 = phi i32 [ %1, %5 ], [ %12, %7 ]
%11 = phi i32 [ %1, %5 ], [ %26, %7 ]
%12 = add i32 %10, -1
%13 = tail call i64 @mCalloc(i32 1000000, i32 1)
%14 = inttoptr i64 %13 to i8*
%15 = tail call i32 @strncat(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%16 = load i8*, i8** %0
%17 = tail call i32 @strlen(i8* %16)
%18 = tail call i32 @strncat(i8* %14, i8* %16, i32 %17)
%19 = tail call i32 @strncat(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%20 = load i8*, i8** %6
%21 = tail call i32 @strlen(i8* %20)
%22 = tail call i32 @strncat(i8* %14, i8* %20, i32 %21)
%23 = tail call i32 @strncat(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%24 = load i8*, i8** %0
%25 = tail call i32 @free(i8* %24)
store i8* %14, i8** %0
%26 = add nsw i32 %11, -1
%27 = icmp sgt i32 %11, 2
br i1 %27, label %28, label %7
28: ; preds = %9
%29 = zext i32 %12 to i64
br label %30
30: ; preds = %28, %30
%31 = phi i64 [ 1, %28 ], [ %34, %30 ]
%32 = getelementptr inbounds i8*, i8** %0, i64 %31
%33 = load i8*, i8** %32
%34 = add nuw nsw i64 %31, 1
%35 = getelementptr inbounds i8*, i8** %0, i64 %34
%36 = load i8*, i8** %35
%37 = tail call i32 @strlen(i8* %36)
%38 = tail call i32 @strncpy(i8* %33, i8* %36, i32 %37)
%39 = icmp eq i64 %34, %29
br i1 %39, label %7, label %30
40: ; preds = %7, %3
ret void
}