#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
scalar_t__ isspace(char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ *stdout;
void tree_out(FILE *out, int **path, int row, int col, char *name,
              int *seq_identity) {
  FILE *in;
  char buffer[100], *p, c;
  int i, j, k, count = 0, check[3];
  if ((in = fopen(name, "r")) == NULL) {
    printf("\n\tCannot open sequence file\n");
    exit(1);
  }
  for (i = 0; i < row; i++) {
    c = ' ';
    while (c != ':') {
      fscanf(in, "%c", &c);
      if (c != '\n')
        fprintf(out, "%c", c);
    }
    for (j = 0; path[seq_identity[i]][j]; j++)
      fprintf(out, "%3d", path[seq_identity[i]][j]);
    fprintf(out, "%3d\n", 0);
    for (j = 0; j < col; j++) {
      c = ' ';
      while (isspace(c) != 0)
        fscanf(in, "%c", &c);
    }
  }
  if (out != stdout)
    fclose(out);
}


x86 assembly (clang, -O0):
<tree_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movl   $0x0,-0xbc(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    11cf <tree_out+0x5f>
lea    0xe42(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
movl   $0x0,-0xb0(%rbp)
mov    -0xb0(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    134f <tree_out+0x1df>
movb   $0x20,-0xa9(%rbp)
movsbl -0xa9(%rbp),%eax
cmp    $0x3a,%eax
je     1242 <tree_out+0xd2>
mov    -0x30(%rbp),%rdi
lea    0xe15(%rip),%rsi
lea    -0xa9(%rbp),%rdx
call   1050 <fscanf@plt>
movsbl -0xa9(%rbp),%eax
cmp    $0xa,%eax
je     123d <tree_out+0xcd>
mov    -0x8(%rbp),%rdi
movsbl -0xa9(%rbp),%edx
lea    0xde7(%rip),%rsi
call   1070 <fprintf@plt>
jmp    11ef <tree_out+0x7f>
movl   $0x0,-0xb4(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0xb0(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xb4(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     12b9 <tree_out+0x149>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0xb0(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xb4(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xd82(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    124c <tree_out+0xdc>
mov    -0x8(%rbp),%rdi
lea    0xd62(%rip),%rsi
xor    %edx,%edx
call   1070 <fprintf@plt>
movl   $0x0,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1336 <tree_out+0x1c6>
movb   $0x20,-0xa9(%rbp)
movsbl -0xa9(%rbp),%edi
call   1060 <isspace@plt>
cmp    $0x0,%rax
je     131d <tree_out+0x1ad>
mov    -0x30(%rbp),%rdi
lea    0xd13(%rip),%rsi
lea    -0xa9(%rbp),%rdx
call   1050 <fscanf@plt>
jmp    12eb <tree_out+0x17b>
jmp    1322 <tree_out+0x1b2>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    12d5 <tree_out+0x165>
jmp    133b <tree_out+0x1cb>
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb0(%rbp)
jmp    11d9 <tree_out+0x69>
mov    -0x8(%rbp),%rax
mov    0x2c86(%rip),%rcx
cmp    (%rcx),%rax
je     136c <tree_out+0x1fc>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tree_out>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,0x8(%rsp)
mov    %ecx,0x4(%rsp)
mov    %edx,%ebx
mov    %rsi,0x18(%rsp)
mov    %rdi,%r13
lea    0xe58(%rip),%rsi
mov    %r8,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     1322 <tree_out+0x1a2>
test   %ebx,%ebx
jle    12ff <tree_out+0x17f>
mov    %rax,%rbp
mov    %ebx,%eax
mov    %rax,0x10(%rsp)
xor    %ebx,%ebx
lea    0xe2e(%rip),%r15
lea    0x3(%rsp),%r14
jmp    11ef <tree_out+0x6f>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    0x10(%rsp),%rbx
je     12ff <tree_out+0x17f>
movb   $0x20,0x3(%rsp)
mov    0x18(%rsp),%r12
jmp    1204 <tree_out+0x84>
nopl   0x0(%rax,%rax,1)
cmp    $0x3a,%al
je     1230 <tree_out+0xb0>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <fscanf@plt>
movsbl 0x3(%rsp),%edi
mov    $0xa,%al
cmp    $0xa,%edi
je     1200 <tree_out+0x80>
mov    %r13,%rsi
call   1070 <fputc@plt>
movzbl 0x3(%rsp),%eax
jmp    1200 <tree_out+0x80>
nopl   (%rax)
mov    0x8(%rsp),%rcx
movslq (%rcx,%rbx,4),%rax
mov    (%r12,%rax,8),%rax
mov    (%rax),%edx
test   %edx,%edx
mov    %rbx,%rdi
lea    0xdba(%rip),%rax
je     128f <tree_out+0x10f>
mov    $0x4,%ebx
mov    %rdi,0x20(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rax,%rsi
call   1080 <fprintf@plt>
mov    0x20(%rsp),%rdi
mov    0x8(%rsp),%rcx
movslq (%rcx,%rdi,4),%rax
mov    (%r12,%rax,8),%rax
mov    (%rax,%rbx,1),%edx
lea    0xd7e(%rip),%rax
add    $0x4,%rbx
test   %edx,%edx
jne    1260 <tree_out+0xe0>
mov    %rdi,%rbx
mov    %r13,%rdi
lea    0xd6d(%rip),%rsi
xor    %edx,%edx
call   1080 <fprintf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11e0 <tree_out+0x60>
xor    %r12d,%r12d
jmp    12cf <tree_out+0x14f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r12d
cmp    0x4(%rsp),%r12d
je     11e0 <tree_out+0x60>
movb   $0x20,0x3(%rsp)
mov    $0x20,%edi
nopl   0x0(%rax)
call   1060 <isspace@plt>
test   %rax,%rax
je     12c0 <tree_out+0x140>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <fscanf@plt>
movsbl 0x3(%rsp),%edi
jmp    12e0 <tree_out+0x160>
mov    0x2cda(%rip),%rax
cmp    %r13,(%rax)
je     1313 <tree_out+0x193>
mov    %r13,%rdi
call   1040 <fclose@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xce5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [29 x i8] c"\0A\09Cannot open sequence file\0A\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [4 x i8] c"%3d\00"
@.str.4 = [5 x i8] c"%3d\0A\00"
@stdout = global i32* null
define void @tree_out(i32* %0, i32** %1, i32 %2, i32 %3, i8* %4, i32* %5) {
%7 = alloca i32*
%8 = alloca i32**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca [100 x i8]
%15 = alloca i8*
%16 = alloca i8
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca [3 x i32]
store i32* %0, i32** %7
store i32** %1, i32*** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i32* %5, i32** %12
store i32 0, i32* %20
%22 = load i8*, i8** %11
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %23, i32** %13
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %28
25: ; preds = %6
%26 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %6
store i32 0, i32* %17
br label %29
29: ; preds = %105, %28
%30 = load i32, i32* %17
%31 = load i32, i32* %9
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %108
33: ; preds = %29
store i8 32, i8* %16
br label %34
34: ; preds = %49, %33
%35 = load i8, i8* %16
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 58
br i1 %37, label %38, label %50
38: ; preds = %34
%39 = load i32*, i32** %13
%40 = call i32 @fscanf(i32* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%41 = load i8, i8* %16
%42 = sext i8 %41 to i32
%43 = icmp ne i32 %42, 10
br i1 %43, label %44, label %49
44: ; preds = %38
%45 = load i32*, i32** %7
%46 = load i8, i8* %16
%47 = sext i8 %46 to i32
%48 = call i32 @fprintf(i32* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %44, %38
br label %34
50: ; preds = %34
store i32 0, i32* %18
br label %51
51: ; preds = %82, %50
%52 = load i32**, i32*** %8
%53 = load i32*, i32** %12
%54 = load i32, i32* %17
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i32, i32* %53, i64 %55
%57 = load i32, i32* %56
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32*, i32** %52, i64 %58
%60 = load i32*, i32** %59
%61 = load i32, i32* %18
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %60, i64 %62
%64 = load i32, i32* %63
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %85
66: ; preds = %51
%67 = load i32*, i32** %7
%68 = load i32**, i32*** %8
%69 = load i32*, i32** %12
%70 = load i32, i32* %17
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i32, i32* %69, i64 %71
%73 = load i32, i32* %72
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i32*, i32** %68, i64 %74
%76 = load i32*, i32** %75
%77 = load i32, i32* %18
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i32, i32* %76, i64 %78
%80 = load i32, i32* %79
%81 = call i32 @fprintf(i32* %67, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %80)
br label %82
82: ; preds = %66
%83 = load i32, i32* %18
%84 = add nsw i32 %83, 1
store i32 %84, i32* %18
br label %51
85: ; preds = %51
%86 = load i32*, i32** %7
%87 = call i32 @fprintf(i32* %86, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 0)
store i32 0, i32* %18
br label %88
88: ; preds = %101, %85
%89 = load i32, i32* %18
%90 = load i32, i32* %10
%91 = icmp slt i32 %89, %90
br i1 %91, label %92, label %104
92: ; preds = %88
store i8 32, i8* %16
br label %93
93: ; preds = %97, %92
%94 = load i8, i8* %16
%95 = call i64 @isspace(i8 signext %94)
%96 = icmp ne i64 %95, 0
br i1 %96, label %97, label %100
97: ; preds = %93
%98 = load i32*, i32** %13
%99 = call i32 @fscanf(i32* %98, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %16)
br label %93
100: ; preds = %93
br label %101
101: ; preds = %100
%102 = load i32, i32* %18
%103 = add nsw i32 %102, 1
store i32 %103, i32* %18
br label %88
104: ; preds = %88
br label %105
105: ; preds = %104
%106 = load i32, i32* %17
%107 = add nsw i32 %106, 1
store i32 %107, i32* %17
br label %29
108: ; preds = %29
%109 = load i32*, i32** %7
%110 = load i32*, i32** @stdout
%111 = icmp ne i32* %109, %110
br i1 %111, label %112, label %115
112: ; preds = %108
%113 = load i32*, i32** %7
%114 = call i32 @fclose(i32* %113)
br label %115
115: ; preds = %112, %108
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [4 x i8] c"%3d\00"
@.str.4 = [5 x i8] c"%3d\0A\00"
@stdout = global i32* null
@str = [28 x i8] c"\0A\09Cannot open sequence file\00"
define void @tree_out(i32* nocapture %0, i32** nocapture %1, i32 %2, i32 %3, i8* nocapture %4, i32* nocapture %5) {
%7 = alloca i8
%8 = tail call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %15, label %10
10: ; preds = %6
%11 = icmp sgt i32 %2, 0
br i1 %11, label %12, label %68
12: ; preds = %10
%13 = icmp sgt i32 %3, 0
%14 = zext i32 %2 to i64
br label %18
15: ; preds = %6
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %12, %65
%19 = phi i64 [ 0, %12 ], [ %66, %65 ]
store i8 32, i8* %7
br label %28
20: ; preds = %36
%21 = getelementptr inbounds i32, i32* %5, i64 %19
%22 = load i32, i32* %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32*, i32** %1, i64 %23
%25 = load i32*, i32** %24
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 0
br i1 %27, label %51, label %39
28: ; preds = %18, %36
%29 = call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%30 = load i8, i8* %7
%31 = icmp eq i8 %30, 10
br i1 %31, label %36, label %32
32: ; preds = %28
%33 = sext i8 %30 to i32
%34 = call i32 @fputc(i32 %33, i32* %0)
%35 = load i8, i8* %7
br label %36
36: ; preds = %32, %28
%37 = phi i8 [ %35, %32 ], [ 10, %28 ]
%38 = icmp eq i8 %37, 58
br i1 %38, label %20, label %28
39: ; preds = %20, %39
%40 = phi i64 [ %43, %39 ], [ 0, %20 ]
%41 = phi i32 [ %49, %39 ], [ %26, %20 ]
%42 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %41)
%43 = add nuw i64 %40, 1
%44 = load i32, i32* %21
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32*, i32** %1, i64 %45
%47 = load i32*, i32** %46
%48 = getelementptr inbounds i32, i32* %47, i64 %43
%49 = load i32, i32* %48
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %39
51: ; preds = %39, %20
%52 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 0)
br i1 %13, label %53, label %65
53: ; preds = %51, %62
%54 = phi i32 [ %63, %62 ], [ 0, %51 ]
store i8 32, i8* %7
%55 = call i64 @isspace(i8 signext 32)
%56 = icmp eq i64 %55, 0
br i1 %56, label %62, label %57
57: ; preds = %53, %57
%58 = call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%59 = load i8, i8* %7
%60 = call i64 @isspace(i8 signext %59)
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %57
62: ; preds = %57, %53
%63 = add nuw nsw i32 %54, 1
%64 = icmp eq i32 %63, %3
br i1 %64, label %65, label %53
65: ; preds = %62, %51
%66 = add nuw nsw i64 %19, 1
%67 = icmp eq i64 %66, %14
br i1 %67, label %68, label %18
68: ; preds = %65, %10
%69 = load i32*, i32** @stdout
%70 = icmp eq i32* %69, %0
br i1 %70, label %73, label %71
71: ; preds = %68
%72 = call i32 @fclose(i32* %0)
br label %73
73: ; preds = %71, %68
ret void
}