#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*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(unsigned char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ isspace(unsigned char);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ snprintf(unsigned char *, int, char *, unsigned char *);
int /*<<< orphan*/ stderr;
int strlen(unsigned char *);
int /*<<< orphan*/ strncmp(unsigned char *, char *, int);
int read_git_status(unsigned char *id_buf, int id_buf_size,
                    int *p_has_changes) {
  FILE *f = popen("git rev-parse --short HEAD", "r");
  if (!f) {
    fprintf(stderr, "cannot invoke git\n");
    exit(1);
  }
  unsigned char buf[1024];
  if (!fgets(buf, sizeof(buf), f)) {
    fprintf(stderr, "unexpected EOF in call to rev-parse\n");
    exit(1);
  }
  int len = strlen(buf);
  while (len > 0 && isspace(buf[len - 1]))
    --len;
  buf[len] = 0;
  snprintf(id_buf, id_buf_size, "%s", buf);
  while (fgets(buf, sizeof(buf), f)) {
  }
  fclose(f);
  f = NULL;
  int has_changes = 0;
  f = popen("git status --porcelain", "r");
  while (fgets(buf, sizeof(buf), f)) {
    int len = strlen(buf);
    while (len > 0 && isspace(buf[len - 1]))
      --len;
    buf[len] = 0;
    if (!strncmp(buf, "db/", 3))
      continue;
    if (!strncmp(buf, "NEWS", 4))
      continue;
    if (len > 0)
      has_changes = 1;
  }
  fclose(f);
  f = NULL;
  if (p_has_changes)
    *p_has_changes = has_changes;
  return 0;
}


x86 assembly (clang, -O0):
<read_git_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xe53(%rip),%rdi
lea    0xe67(%rip),%rsi
call   10a0 <popen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11e7 <read_git_status+0x57>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
lea    0xe45(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x400,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    1225 <read_git_status+0x95>
mov    0x2dd3(%rip),%rax
mov    (%rax),%edi
lea    0xe1a(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    -0x420(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x424(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x424(%rbp)
mov    %al,-0x42d(%rbp)
jle    1271 <read_git_status+0xe1>
mov    -0x424(%rbp),%eax
sub    $0x1,%eax
cltq
movzbl -0x420(%rbp,%rax,1),%edi
ff
call   1070 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x42d(%rbp)
mov    -0x42d(%rbp),%al
test   $0x1,%al
jne    1284 <read_git_status+0xf4>
jmp    1298 <read_git_status+0x108>
mov    -0x424(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x424(%rbp)
jmp    1237 <read_git_status+0xa7>
movslq -0x424(%rbp),%rax
movb   $0x0,-0x420(%rbp,%rax,1)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x420(%rbp),%rcx
lea    0xd99(%rip),%rdx
call   1060 <snprintf@plt>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x400,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     12e5 <read_git_status+0x155>
jmp    12c1 <read_git_status+0x131>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x428(%rbp)
lea    0xd51(%rip),%rdi
lea    0xd0d(%rip),%rsi
call   10a0 <popen@plt>
mov    %rax,-0x20(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x400,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     1420 <read_git_status+0x290>
lea    -0x420(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x42c(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x42c(%rbp)
mov    %al,-0x42e(%rbp)
jle    1382 <read_git_status+0x1f2>
mov    -0x42c(%rbp),%eax
sub    $0x1,%eax
cltq
movzbl -0x420(%rbp,%rax,1),%edi
ff
call   1070 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x42e(%rbp)
mov    -0x42e(%rbp),%al
test   $0x1,%al
jne    1395 <read_git_status+0x205>
jmp    13a9 <read_git_status+0x219>
mov    -0x42c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x42c(%rbp)
jmp    1348 <read_git_status+0x1b8>
movslq -0x42c(%rbp),%rax
movb   $0x0,-0x420(%rbp,%rax,1)
lea    -0x420(%rbp),%rdi
lea    0xca9(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    13de <read_git_status+0x24e>
jmp    1317 <read_git_status+0x187>
lea    -0x420(%rbp),%rdi
lea    0xc87(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1404 <read_git_status+0x274>
jmp    1317 <read_git_status+0x187>
cmpl   $0x0,-0x42c(%rbp)
jle    141b <read_git_status+0x28b>
movl   $0x1,-0x428(%rbp)
jmp    1317 <read_git_status+0x187>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1448 <read_git_status+0x2b8>
mov    -0x428(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_git_status>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rdx,0x8(%rsp)
mov    %esi,%r15d
mov    %rdi,%r12
lea    0xe4d(%rip),%rdi
lea    0xe61(%rip),%rsi
call   10a0 <popen@plt>
test   %rax,%rax
je     136c <read_git_status+0x1dc>
mov    %rax,%rbx
lea    0x10(%rsp),%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     137e <read_git_status+0x1ee>
lea    0x10(%rsp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
xor    %r14d,%r14d
test   %eax,%eax
cmovs  %eax,%r14d
nopl   0x0(%rax,%rax,1)
test   %ebp,%ebp
jle    121d <read_git_status+0x8d>
movzbl 0xf(%rsp,%rbp,1),%edi
add    $0xffffffffffffffff,%rbp
call   1070 <isspace@plt>
test   %rax,%rax
jne    1200 <read_git_status+0x70>
add    $0x1,%ebp
mov    %ebp,%r14d
movslq %r14d,%rax
movb   $0x0,0x10(%rsp,%rax,1)
lea    0xe29(%rip),%rdx
lea    0x10(%rsp),%rbp
mov    %r12,%rdi
mov    %r15d,%esi
mov    %rbp,%rcx
call   1060 <snprintf@plt>
nop
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
jne    1240 <read_git_status+0xb0>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xdf4(%rip),%rdi
lea    0xdb0(%rip),%rsi
call   10a0 <popen@plt>
mov    %rax,%r15
lea    0x10(%rsp),%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     1340 <read_git_status+0x1b0>
lea    0x10(%rsp),%rbx
xor    %r14d,%r14d
jmp    12b9 <read_git_status+0x129>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     1343 <read_git_status+0x1b3>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %eax,%r12d
test   %eax,%eax
mov    $0x0,%eax
cmovns %eax,%ebp
mov    %r12d,%r13d
test   %r12d,%r12d
jle    12f3 <read_git_status+0x163>
movzbl 0xf(%rsp,%r12,1),%edi
add    $0xffffffffffffffff,%r12
call   1070 <isspace@plt>
test   %rax,%rax
jne    12d0 <read_git_status+0x140>
add    $0x1,%r12d
mov    %r12d,%ebp
movslq %ebp,%rax
movb   $0x0,0x10(%rsp,%rax,1)
mov    %rbx,%rdi
lea    0xd6a(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     12a0 <read_git_status+0x110>
mov    %rbx,%rdi
lea    0xd56(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %r13d,%r13d
mov    %r14d,%ecx
mov    $0x1,%edx
cmovg  %edx,%ecx
test   %eax,%eax
cmovne %ecx,%r14d
jmp    12a0 <read_git_status+0x110>
xor    %r14d,%r14d
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    0x8(%rsp),%rax
test   %rax,%rax
je     1358 <read_git_status+0x1c8>
mov    %r14d,(%rax)
xor    %eax,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c6d(%rip),%rax
mov    (%rax),%edi
lea    0xca1(%rip),%rsi
jmp    138e <read_git_status+0x1fe>
mov    0x2c5b(%rip),%rax
mov    (%rax),%edi
lea    0xca2(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"git rev-parse --short HEAD\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [19 x i8] c"cannot invoke git\0A\00"
@.str.3 = [37 x i8] c"unexpected EOF in call to rev-parse\0A\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [23 x i8] c"git status --porcelain\00"
@.str.6 = [4 x i8] c"db/\00"
@.str.7 = [5 x i8] c"NEWS\00"
define i32 @read_git_status(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [1024 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%12 = call i32* @popen(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %7
%13 = load i32*, i32** %7
%14 = icmp ne i32* %13, null
br i1 %14, label %19, label %15
15: ; preds = %3
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %3
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%21 = load i32*, i32** %7
%22 = call i64 @fgets(i8* %20, i32 1024, i32* %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %19
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %19
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%30 = call i32 @strlen(i8* %29)
store i32 %30, i32* %9
br label %31
31: ; preds = %44, %28
%32 = load i32, i32* %9
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %42
34: ; preds = %31
%35 = load i32, i32* %9
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = call i64 @isspace(i8 zeroext %39)
%41 = icmp ne i64 %40, 0
br label %42
42: ; preds = %34, %31
%43 = phi i1 [ false, %31 ], [ %41, %34 ]
br i1 %43, label %44, label %47
44: ; preds = %42
%45 = load i32, i32* %9
%46 = add nsw i32 %45, -1
store i32 %46, i32* %9
br label %31
47: ; preds = %42
%48 = load i32, i32* %9
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 %49
store i8 0, i8* %50
%51 = load i8*, i8** %4
%52 = load i32, i32* %5
%53 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%54 = call i32 @snprintf(i8* %51, i32 %52, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %53)
br label %55
55: ; preds = %60, %47
%56 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%57 = load i32*, i32** %7
%58 = call i64 @fgets(i8* %56, i32 1024, i32* %57)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %55
br label %55
61: ; preds = %55
%62 = load i32*, i32** %7
%63 = call i32 @fclose(i32* %62)
store i32* null, i32** %7
store i32 0, i32* %10
%64 = call i32* @popen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %64, i32** %7
br label %65
65: ; preds = %106, %101, %96, %61
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%67 = load i32*, i32** %7
%68 = call i64 @fgets(i8* %66, i32 1024, i32* %67)
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %107
70: ; preds = %65
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%72 = call i32 @strlen(i8* %71)
store i32 %72, i32* %11
br label %73
73: ; preds = %86, %70
%74 = load i32, i32* %11
%75 = icmp sgt i32 %74, 0
br i1 %75, label %76, label %84
76: ; preds = %73
%77 = load i32, i32* %11
%78 = sub nsw i32 %77, 1
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 %79
%81 = load i8, i8* %80
%82 = call i64 @isspace(i8 zeroext %81)
%83 = icmp ne i64 %82, 0
br label %84
84: ; preds = %76, %73
%85 = phi i1 [ false, %73 ], [ %83, %76 ]
br i1 %85, label %86, label %89
86: ; preds = %84
%87 = load i32, i32* %11
%88 = add nsw i32 %87, -1
store i32 %88, i32* %11
br label %73
89: ; preds = %84
%90 = load i32, i32* %11
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 %91
store i8 0, i8* %92
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%94 = call i32 @strncmp(i8* %93, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 3)
%95 = icmp ne i32 %94, 0
br i1 %95, label %97, label %96
96: ; preds = %89
br label %65
97: ; preds = %89
%98 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%99 = call i32 @strncmp(i8* %98, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%100 = icmp ne i32 %99, 0
br i1 %100, label %102, label %101
101: ; preds = %97
br label %65
102: ; preds = %97
%103 = load i32, i32* %11
%104 = icmp sgt i32 %103, 0
br i1 %104, label %105, label %106
105: ; preds = %102
store i32 1, i32* %10
br label %106
106: ; preds = %105, %102
br label %65
107: ; preds = %65
%108 = load i32*, i32** %7
%109 = call i32 @fclose(i32* %108)
store i32* null, i32** %7
%110 = load i32*, i32** %6
%111 = icmp ne i32* %110, null
br i1 %111, label %112, label %115
112: ; preds = %107
%113 = load i32, i32* %10
%114 = load i32*, i32** %6
store i32 %113, i32* %114
br label %115
115: ; preds = %112, %107
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"git rev-parse --short HEAD\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [19 x i8] c"cannot invoke git\0A\00"
@.str.3 = [37 x i8] c"unexpected EOF in call to rev-parse\0A\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [23 x i8] c"git status --porcelain\00"
@.str.6 = [4 x i8] c"db/\00"
@.str.7 = [5 x i8] c"NEWS\00"
define i32 @read_git_status(i8* %0, i32 %1, i32* writeonly %2) {
%4 = alloca [1024 x i8]
%5 = tail call i32* @popen(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %3
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%13 = call i64 @fgets(i8* %12, i32 1024, i32* %5)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %11
%20 = call i32 @strlen(i8* %12)
%21 = zext i32 %20 to i64
%22 = call i32 @llvm.smin.i32(i32 %20, i32 0)
br label %23
23: ; preds = %27, %19
%24 = phi i64 [ %28, %27 ], [ %21, %19 ]
%25 = trunc i64 %24 to i32
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %23
%28 = add nsw i64 %24, -1
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = call i64 @isspace(i8 zeroext %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %23
33: ; preds = %27
%34 = trunc i64 %24 to i32
br label %35
35: ; preds = %23, %33
%36 = phi i32 [ %34, %33 ], [ %22, %23 ]
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %37
store i8 0, i8* %38
%39 = call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %12)
br label %40
40: ; preds = %40, %35
%41 = call i64 @fgets(i8* %12, i32 1024, i32* %5)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %40
43: ; preds = %40
%44 = call i32 @fclose(i32* %5)
%45 = call i32* @popen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%46 = call i64 @fgets(i8* %12, i32 1024, i32* %45)
%47 = icmp eq i64 %46, 0
br i1 %47, label %80, label %48
48: ; preds = %43, %76
%49 = phi i32 [ %77, %76 ], [ 0, %43 ]
%50 = call i32 @strlen(i8* %12)
%51 = zext i32 %50 to i64
%52 = call i32 @llvm.smin.i32(i32 %50, i32 0)
br label %53
53: ; preds = %57, %48
%54 = phi i64 [ %58, %57 ], [ %51, %48 ]
%55 = trunc i64 %54 to i32
%56 = icmp sgt i32 %55, 0
br i1 %56, label %57, label %65
57: ; preds = %53
%58 = add nsw i64 %54, -1
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %58
%60 = load i8, i8* %59
%61 = call i64 @isspace(i8 zeroext %60)
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %53
63: ; preds = %57
%64 = trunc i64 %54 to i32
br label %65
65: ; preds = %53, %63
%66 = phi i32 [ %64, %63 ], [ %52, %53 ]
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %67
store i8 0, i8* %68
%69 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 3)
%70 = icmp eq i32 %69, 0
br i1 %70, label %76, label %71
71: ; preds = %65
%72 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%73 = icmp eq i32 %72, 0
%74 = select i1 %56, i32 1, i32 %49
%75 = select i1 %73, i32 %49, i32 %74
br label %76
76: ; preds = %71, %65
%77 = phi i32 [ %49, %65 ], [ %75, %71 ]
%78 = call i64 @fgets(i8* %12, i32 1024, i32* %45)
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %48
80: ; preds = %76, %43
%81 = phi i32 [ 0, %43 ], [ %77, %76 ]
%82 = call i32 @fclose(i32* %45)
%83 = icmp eq i32* %2, null
br i1 %83, label %85, label %84
84: ; preds = %80
store i32 %81, i32* %2
br label %85
85: ; preds = %84, %80
ret i32 0
}