#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
scalar_t__ getline(char **, size_t *, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, char *);
int /*<<< orphan*/ *strstr(char *, char *);
char *strtok(char *, char *);
int /*<<< orphan*/ system(char *);
int main(int arg, char *argv[]) {
  int i, j, len, flag;
  char *tmpstr, *token, *minor_token, *chk;
  char delim[] = " \t";
  char major[20];
  FILE *f, *ft;
  tmpstr = (char *)malloc(256);
  len = 256;
  token = (char *)malloc(256);
  sprintf(tmpstr, "%s/npreal2d.cf", "/usr/lib/npreal2/driver");
  f = fopen(tmpstr, "r");
  if (f == NULL) {
    printf("file open error1\n");
    free(tmpstr);
    free(token);
    return (0);
  }
  ft = fopen("/tmp/npr_tmpfile3", "w");
  if (ft == NULL) {
    printf("file open error2\n");
    free(tmpstr);
    free(token);
    return (0);
  }
  for (;;) {
    flag = 0;
    memset(token, '\0', 256);
    if (getline(&tmpstr, (size_t *)&len, f) < 0) {
      break;
    }
    if (strstr(tmpstr, "#") != NULL) {
      fputs(tmpstr, ft);
      continue;
    }
    memset(major, '\0', 20);
    sscanf(tmpstr, "%s", major);
    if (strstr(major, "ttymajor") != NULL ||
        strstr(major, "calloutmajor") != NULL) {
      fputs(tmpstr, ft);
      continue;
    }
    for (i = 0; i < 11; i++) {
      if (i == 0) {
        minor_token = strtok(tmpstr, delim);
        sprintf(token, "%s", minor_token);
      } else {
        chk = strtok(NULL, delim);
        if (chk == NULL) {
          flag = 1;
          break;
        }
        sprintf(token, "%s\t%s", token, chk);
      }
    }
    if (flag == 1) {
      continue;
    }
    fputs(token, ft);
  }
  fclose(ft);
  fclose(f);
  sprintf(tmpstr, "cp -f /tmp/npr_tmpfile3 %s/npreal2d.cf",
          "/usr/lib/npreal2/driver");
  system(tmpstr);
  system("rm -f /tmp/npr_tmpfile3");
  free(tmpstr);
  free(token);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe13(%rip),%ax
mov    %ax,-0x43(%rbp)
mov    0xe0b(%rip),%al
mov    %al,-0x41(%rbp)
mov    $0x100,%edi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x100,-0x1c(%rbp)
mov    $0x100,%edi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe4f(%rip),%rsi
lea    0xdd4(%rip),%rdx
mov    $0x0,%al
call   10e0 <sprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xdd8(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    127f <main+0xaf>
lea    0xdbf(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    14b3 <main+0x2e3>
lea    0xe06(%rip),%rdi
lea    0xda0(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    12cb <main+0xfb>
lea    0xd87(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    14b3 <main+0x2e3>
jmp    12d0 <main+0x100>
movl   $0x0,-0x20(%rbp)
mov    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1080 <memset@plt>
lea    -0x1c(%rbp),%rsi
mov    -0x68(%rbp),%rdx
lea    -0x28(%rbp),%rdi
call   10d0 <getline@plt>
cmp    $0x0,%rax
jge    1307 <main+0x137>
jmp    145a <main+0x28a>
mov    -0x28(%rbp),%rdi
lea    0xd2f(%rip),%rsi
call   10f0 <strstr@plt>
cmp    $0x0,%rax
je     1333 <main+0x163>
mov    -0x28(%rbp),%rdi
mov    -0x70(%rbp),%rsi
call   1070 <fputs@plt>
jmp    12d0 <main+0x100>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1080 <memset@plt>
mov    -0x28(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xd0a(%rip),%rsi
call   10a0 <sscanf@plt>
lea    -0x60(%rbp),%rdi
lea    0xce1(%rip),%rsi
call   10f0 <strstr@plt>
cmp    $0x0,%rax
jne    138b <main+0x1bb>
lea    -0x60(%rbp),%rdi
lea    0xcd0(%rip),%rsi
call   10f0 <strstr@plt>
cmp    $0x0,%rax
je     139d <main+0x1cd>
mov    -0x28(%rbp),%rdi
mov    -0x70(%rbp),%rsi
call   1070 <fputs@plt>
jmp    12d0 <main+0x100>
movl   $0x0,-0x14(%rbp)
cmpl   $0xb,-0x14(%rbp)
jge    1439 <main+0x269>
cmpl   $0x0,-0x14(%rbp)
jne    13e4 <main+0x214>
mov    -0x28(%rbp),%rdi
lea    -0x43(%rbp),%rsi
call   10c0 <strtok@plt>
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rdx
lea    0xc84(%rip),%rsi
mov    $0x0,%al
call   10e0 <sprintf@plt>
jmp    1426 <main+0x256>
lea    -0x43(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   10c0 <strtok@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    140c <main+0x23c>
movl   $0x1,-0x20(%rbp)
jmp    1439 <main+0x269>
mov    -0x30(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    -0x40(%rbp),%rcx
lea    0xc3a(%rip),%rsi
mov    $0x0,%al
call   10e0 <sprintf@plt>
jmp    142b <main+0x25b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13a4 <main+0x1d4>
cmpl   $0x1,-0x20(%rbp)
jne    1448 <main+0x278>
jmp    12d0 <main+0x100>
mov    -0x30(%rbp),%rdi
mov    -0x70(%rbp),%rsi
call   1070 <fputs@plt>
jmp    12d0 <main+0x100>
mov    -0x70(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x68(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x28(%rbp),%rdi
lea    0xbe8(%rip),%rsi
lea    0xb85(%rip),%rdx
mov    $0x0,%al
call   10e0 <sprintf@plt>
mov    -0x28(%rbp),%rdi
call   1050 <system@plt>
lea    0xbf1(%rip),%rdi
call   1050 <system@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movb   $0x0,0xa(%rsp)
movw   $0x920,0x8(%rsp)
mov    $0x100,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbp
mov    %rax,(%rsp)
movl   $0x100,0xc(%rsp)
mov    $0x100,%edi
call   10b0 <malloc@plt>
mov    %rax,%r13
lea    0xe1a(%rip),%rsi
lea    0xdc5(%rip),%rdx
mov    %rbp,%rdi
xor    %eax,%eax
call   1100 <sprintf@plt>
lea    0xdca(%rip),%rsi
mov    %rbp,%rdi
call   10d0 <fopen@plt>
test   %rax,%rax
je     13f8 <main+0x208>
mov    %rax,%r14
lea    0xdfc(%rip),%rdi
lea    0xdaa(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     1401 <main+0x211>
mov    %rax,%r15
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10a0 <memset@plt>
mov    %rsp,%rdi
lea    0xc(%rsp),%rsi
mov    %r14,%rdx
call   10f0 <getline@plt>
test   %rax,%rax
js     13b4 <main+0x1c4>
lea    0x10(%rsp),%r12
lea    0x8(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rsp),%rbx
mov    %rbx,%rdi
mov    $0x23,%esi
call   1080 <strchr@plt>
test   %rax,%rax
jne    1324 <main+0x134>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10a0 <memset@plt>
mov    (%rsp),%rdi
lea    0xd46(%rip),%rsi
mov    %r12,%rdx
call   10c0 <sscanf@plt>
mov    %r12,%rdi
lea    0xd1b(%rip),%rsi
call   1110 <strstr@plt>
test   %rax,%rax
jne    1320 <main+0x130>
mov    %r12,%rdi
lea    0xd10(%rip),%rsi
call   1110 <strstr@plt>
test   %rax,%rax
je     1359 <main+0x169>
mov    (%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <fputs@plt>
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10a0 <memset@plt>
mov    %rsp,%rdi
lea    0xc(%rsp),%rsi
mov    %r14,%rdx
call   10f0 <getline@plt>
test   %rax,%rax
jns    12c0 <main+0xd0>
jmp    13b4 <main+0x1c4>
mov    $0xb,%ebx
jmp    137c <main+0x18c>
mov    (%rsp),%rdi
mov    %rbp,%rsi
call   10e0 <strtok@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
add    $0xffffffff,%ebx
je     13ac <main+0x1bc>
cmp    $0xb,%ebx
je     1360 <main+0x170>
xor    %edi,%edi
mov    %rbp,%rsi
call   10e0 <strtok@plt>
test   %rax,%rax
je     132f <main+0x13f>
mov    %r13,%rdi
lea    0xc99(%rip),%rsi
mov    %r13,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1100 <sprintf@plt>
add    $0xffffffff,%ebx
jne    137c <main+0x18c>
mov    %r13,%rbx
jmp    1324 <main+0x134>
mov    %r15,%rdi
call   1060 <fclose@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
mov    (%rsp),%rdi
lea    0xc6a(%rip),%rsi
lea    0xc2d(%rip),%rdx
xor    %eax,%eax
call   1100 <sprintf@plt>
mov    (%rsp),%rdi
call   1070 <system@plt>
lea    0xc73(%rip),%rdi
call   1070 <system@plt>
mov    (%rsp),%rdi
jmp    1410 <main+0x220>
lea    0xc8a(%rip),%rdi
jmp    1408 <main+0x218>
lea    0xc70(%rip),%rdi
call   1050 <puts@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.delim = [3 x i8] c" \09\00"
@.str = [15 x i8] c"%s/npreal2d.cf\00"
@.str.1 = [24 x i8] c"/usr/lib/npreal2/driver\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [18 x i8] c"file open error1\0A\00"
@.str.4 = [18 x i8] c"/tmp/npr_tmpfile3\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [18 x i8] c"file open error2\0A\00"
@.str.7 = [2 x i8] c"#\00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [9 x i8] c"ttymajor\00"
@.str.10 = [13 x i8] c"calloutmajor\00"
@.str.11 = [6 x i8] c"%s\09%s\00"
@.str.12 = [39 x i8] c"cp -f /tmp/npr_tmpfile3 %s/npreal2d.cf\00"
@.str.13 = [24 x i8] c"rm -f /tmp/npr_tmpfile3\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca [3 x i8]
%15 = alloca [20 x i8]
%16 = alloca i32*
%17 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = bitcast [3 x i8]* %14 to i8*
%19 = call i64 @malloc(i32 256)
%20 = inttoptr i64 %19 to i8*
store i8* %20, i8** %10
store i32 256, i32* %8
%21 = call i64 @malloc(i32 256)
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %11
%23 = load i8*, i8** %10
%24 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %23, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%25 = load i8*, i8** %10
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %26, i32** %16
%27 = load i32*, i32** %16
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %35
29: ; preds = %2
%30 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%31 = load i8*, i8** %10
%32 = call i32 @free(i8* %31)
%33 = load i8*, i8** %11
%34 = call i32 @free(i8* %33)
store i32 0, i32* %3
br label %130
35: ; preds = %2
%36 = call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %36, i32** %17
%37 = load i32*, i32** %17
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %45
39: ; preds = %35
%40 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%41 = load i8*, i8** %10
%42 = call i32 @free(i8* %41)
%43 = load i8*, i8** %11
%44 = call i32 @free(i8* %43)
store i32 0, i32* %3
br label %130
45: ; preds = %35
br label %46
46: ; preds = %112, %111, %75, %58, %45
store i32 0, i32* %9
%47 = load i8*, i8** %11
%48 = call i32 @memset(i8* %47, i8 signext 0, i32 256)
%49 = bitcast i32* %8 to i64*
%50 = load i32*, i32** %16
%51 = call i64 @getline(i8** %10, i64* %49, i32* %50)
%52 = icmp slt i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %46
br label %116
54: ; preds = %46
%55 = load i8*, i8** %10
%56 = call i32* @strstr(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%57 = icmp ne i32* %56, null
br i1 %57, label %58, label %62
58: ; preds = %54
%59 = load i8*, i8** %10
%60 = load i32*, i32** %17
%61 = call i32 @fputs(i8* %59, i32* %60)
br label %46
62: ; preds = %54
%63 = getelementptr inbounds [20 x i8], [20 x i8]* %15, i64 0, i64 0
%64 = call i32 @memset(i8* %63, i8 signext 0, i32 20)
%65 = load i8*, i8** %10
%66 = getelementptr inbounds [20 x i8], [20 x i8]* %15, i64 0, i64 0
%67 = call i32 @sscanf(i8* %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %66)
%68 = getelementptr inbounds [20 x i8], [20 x i8]* %15, i64 0, i64 0
%69 = call i32* @strstr(i8* %68, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
%70 = icmp ne i32* %69, null
br i1 %70, label %75, label %71
71: ; preds = %62
%72 = getelementptr inbounds [20 x i8], [20 x i8]* %15, i64 0, i64 0
%73 = call i32* @strstr(i8* %72, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
%74 = icmp ne i32* %73, null
br i1 %74, label %75, label %79
75: ; preds = %71, %62
%76 = load i8*, i8** %10
%77 = load i32*, i32** %17
%78 = call i32 @fputs(i8* %76, i32* %77)
br label %46
79: ; preds = %71
store i32 0, i32* %6
br label %80
80: ; preds = %105, %79
%81 = load i32, i32* %6
%82 = icmp slt i32 %81, 11
br i1 %82, label %83, label %108
83: ; preds = %80
%84 = load i32, i32* %6
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %93
86: ; preds = %83
%87 = load i8*, i8** %10
%88 = getelementptr inbounds [3 x i8], [3 x i8]* %14, i64 0, i64 0
%89 = call i8* @strtok(i8* %87, i8* %88)
store i8* %89, i8** %12
%90 = load i8*, i8** %11
%91 = load i8*, i8** %12
%92 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %90, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %91)
br label %104
93: ; preds = %83
%94 = getelementptr inbounds [3 x i8], [3 x i8]* %14, i64 0, i64 0
%95 = call i8* @strtok(i8* null, i8* %94)
store i8* %95, i8** %13
%96 = load i8*, i8** %13
%97 = icmp eq i8* %96, null
br i1 %97, label %98, label %99
98: ; preds = %93
store i32 1, i32* %9
br label %108
99: ; preds = %93
%100 = load i8*, i8** %11
%101 = load i8*, i8** %11
%102 = load i8*, i8** %13
%103 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %100, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8* %101, i8* %102)
br label %104
104: ; preds = %99, %86
br label %105
105: ; preds = %104
%106 = load i32, i32* %6
%107 = add nsw i32 %106, 1
store i32 %107, i32* %6
br label %80
108: ; preds = %98, %80
%109 = load i32, i32* %9
%110 = icmp eq i32 %109, 1
br i1 %110, label %111, label %112
111: ; preds = %108
br label %46
112: ; preds = %108
%113 = load i8*, i8** %11
%114 = load i32*, i32** %17
%115 = call i32 @fputs(i8* %113, i32* %114)
br label %46
116: ; preds = %53
%117 = load i32*, i32** %17
%118 = call i32 @fclose(i32* %117)
%119 = load i32*, i32** %16
%120 = call i32 @fclose(i32* %119)
%121 = load i8*, i8** %10
%122 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %121, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%123 = load i8*, i8** %10
%124 = call i32 @system(i8* %123)
%125 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%126 = load i8*, i8** %10
%127 = call i32 @free(i8* %126)
%128 = load i8*, i8** %11
%129 = call i32 @free(i8* %128)
store i32 0, i32* %3
br label %130
130: ; preds = %116, %39, %29
%131 = load i32, i32* %3
ret i32 %131
}

LLVM IR (-O2):
@__const.main.delim = [3 x i8] c" \09\00"
@.str = [15 x i8] c"%s/npreal2d.cf\00"
@.str.1 = [24 x i8] c"/usr/lib/npreal2/driver\00"
@.str.2 = [2 x i8] c"r\00"
@.str.4 = [18 x i8] c"/tmp/npr_tmpfile3\00"
@.str.5 = [2 x i8] c"w\00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [9 x i8] c"ttymajor\00"
@.str.10 = [13 x i8] c"calloutmajor\00"
@.str.11 = [6 x i8] c"%s\09%s\00"
@.str.12 = [39 x i8] c"cp -f /tmp/npr_tmpfile3 %s/npreal2d.cf\00"
@.str.13 = [24 x i8] c"rm -f /tmp/npr_tmpfile3\00"
@str = [17 x i8] c"file open error2\00"
@str.14 = [17 x i8] c"file open error1\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [3 x i8]
%6 = alloca [20 x i8]
%7 = bitcast i32* %3 to i8*
%8 = bitcast i8** %4 to i8*
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%11 = tail call i64 @malloc(i32 256)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %4
store i32 256, i32* %3
%13 = tail call i64 @malloc(i32 256)
%14 = inttoptr i64 %13 to i8*
%15 = tail call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %12, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %22
18: ; preds = %2
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.14, i64 0, i64 0))
%20 = tail call i32 @free(i8* %12)
%21 = tail call i32 @free(i8* %14)
br label %82
22: ; preds = %2
%23 = tail call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%24 = icmp eq i32* %23, null
br i1 %24, label %30, label %25
25: ; preds = %22
%26 = call i32 @memset(i8* %14, i8 signext 0, i32 256)
%27 = bitcast i32* %3 to i64*
%28 = call i64 @getline(i8** %4, i64* %27, i32* %16)
%29 = icmp slt i64 %28, 0
br i1 %29, label %71, label %34
30: ; preds = %22
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%32 = tail call i32 @free(i8* %12)
%33 = tail call i32 @free(i8* %14)
br label %82
34: ; preds = %25, %41
%35 = load i8*, i8** %4
%36 = call i8* @strchr(i8* dereferenceable(1) %35, i32 35)
%37 = icmp eq i8* %36, null
br i1 %37, label %45, label %38
38: ; preds = %68, %34, %54
%39 = phi i8* [ %55, %54 ], [ %35, %34 ], [ %14, %68 ]
%40 = call i32 @fputs(i8* %39, i32* %23)
br label %41
41: ; preds = %63, %38
%42 = call i32 @memset(i8* %14, i8 signext 0, i32 256)
%43 = call i64 @getline(i8** %4, i64* %27, i32* %16)
%44 = icmp slt i64 %43, 0
br i1 %44, label %71, label %34
45: ; preds = %34
%46 = call i32 @memset(i8* %10, i8 signext 0, i32 20)
%47 = load i8*, i8** %4
%48 = call i32 @sscanf(i8* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %10)
%49 = call i32* @strstr(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
%50 = icmp eq i32* %49, null
br i1 %50, label %51, label %54
51: ; preds = %45
%52 = call i32* @strstr(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
%53 = icmp eq i32* %52, null
br i1 %53, label %56, label %54
54: ; preds = %51, %45
%55 = load i8*, i8** %4
br label %38
56: ; preds = %51, %68
%57 = phi i32 [ %69, %68 ], [ 0, %51 ]
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %63
59: ; preds = %56
%60 = load i8*, i8** %4
%61 = call i8* @strtok(i8* %60, i8* %9)
%62 = call i8* @strcpy(i8* dereferenceable(1) %14, i8* dereferenceable(1) %61)
br label %68
63: ; preds = %56
%64 = call i8* @strtok(i8* null, i8* %9)
%65 = icmp eq i8* %64, null
br i1 %65, label %41, label %66
66: ; preds = %63
%67 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %14, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i8* %14, i8* %64)
br label %68
68: ; preds = %59, %66
%69 = add nuw nsw i32 %57, 1
%70 = icmp eq i32 %69, 11
br i1 %70, label %38, label %56
71: ; preds = %41, %25
%72 = call i32 @fclose(i32* %23)
%73 = call i32 @fclose(i32* %16)
%74 = load i8*, i8** %4
%75 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %74, i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%76 = load i8*, i8** %4
%77 = call i32 @system(i8* %76)
%78 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%79 = load i8*, i8** %4
%80 = call i32 @free(i8* %79)
%81 = call i32 @free(i8* %14)
br label %82
82: ; preds = %71, %30, %18
ret i32 0
}