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

/* Variables and functions */
int EXIT_SUCCESS;
int atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strtok(char *, char *);
int bat_info(char *path, char *format, bool emoji, bool quiet) {
  char status[256] = {0};
  bool found_status = false, found_capacity = false;
  int capacity = -1;
  FILE *bf = fopen(path, "r");
  if (bf) {
    char line[256] = {0};
    while (fgets(line, sizeof(line), bf) != NULL) {
      char *key = strtok(line, "=\n");
      if (key != NULL) {
        if (!found_status && strcmp(key, "POWER_SUPPLY_"
                                         "STATUS") == 0) {
          strncpy(status, strtok(NULL, "=\n"), sizeof(status));
          found_status = true;
        } else if (capacity == -1 && strcmp(key, "POWER_SUPPLY_"
                                                 "CAPACITY") == 0) {
          capacity = atoi(strtok(NULL, "=\n"));
          found_capacity = true;
        }
      }
    }
    fclose(bf);
  } else {
    if (!quiet)
      fprintf(stderr, "Can't open '%s'.\n", path);
  }
  char *s = status;
  if (!found_capacity || !found_status) {
    s = emoji ? "\u2607" : "Wired";
    capacity = 100;
  } else if (emoji) {
    if (!strcmp(status, "Charging"))
      s = "\u26A1";
    else if (!strcmp(status, "Full"))
      s = "\u2607";
    else if (!strcmp(status, "Discharging"))
      s = "\U0001F50B";
    else
      s = "\uFFFD";
  }
  printf(format, s, capacity);
  printf("\n");
  fflush(stdout);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<bat_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1060 <memset@plt>
movl   $0x0,-0x124(%rbp)
movl   $0x0,-0x128(%rbp)
movl   $0xffffffff,-0x12c(%rbp)
ff ff ff
mov    -0x8(%rbp),%rdi
lea    0xdfb(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x138(%rbp)
cmpq   $0x0,-0x138(%rbp)
je     1359 <bat_info+0x1a9>
lea    -0x240(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1060 <memset@plt>
lea    -0x240(%rbp),%rdi
mov    -0x138(%rbp),%rdx
mov    $0x100,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     1348 <bat_info+0x198>
lea    -0x240(%rbp),%rdi
lea    0xda0(%rip),%rsi
call   10c0 <strtok@plt>
mov    %rax,-0x248(%rbp)
cmpq   $0x0,-0x248(%rbp)
je     1343 <bat_info+0x193>
cmpl   $0x0,-0x124(%rbp)
jne    12e7 <bat_info+0x137>
mov    -0x248(%rbp),%rdi
lea    0xd6e(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    12e7 <bat_info+0x137>
lea    -0x120(%rbp),%rax
mov    %rax,-0x258(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xd43(%rip),%rsi
call   10c0 <strtok@plt>
mov    -0x258(%rbp),%rdi
mov    %rax,%rsi
mov    $0x100,%edx
call   1030 <strncpy@plt>
movl   $0x1,-0x124(%rbp)
jmp    133e <bat_info+0x18e>
cmpl   $0xffffffff,-0x12c(%rbp)
jne    1339 <bat_info+0x189>
mov    -0x248(%rbp),%rdi
lea    0xd17(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1339 <bat_info+0x189>
xor    %eax,%eax
mov    %eax,%edi
lea    0xce6(%rip),%rsi
call   10c0 <strtok@plt>
mov    %rax,%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x12c(%rbp)
movl   $0x1,-0x128(%rbp)
jmp    133e <bat_info+0x18e>
jmp    1343 <bat_info+0x193>
jmp    1232 <bat_info+0x82>
mov    -0x138(%rbp),%rdi
call   1040 <fclose@plt>
jmp    1381 <bat_info+0x1d1>
cmpl   $0x0,-0x18(%rbp)
jne    137c <bat_info+0x1cc>
mov    0x2c76(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xcb8(%rip),%rsi
call   1090 <fprintf@plt>
jmp    1381 <bat_info+0x1d1>
lea    -0x120(%rbp),%rax
mov    %rax,-0x250(%rbp)
cmpl   $0x0,-0x128(%rbp)
je     13a9 <bat_info+0x1f9>
cmpl   $0x0,-0x124(%rbp)
jne    13d7 <bat_info+0x227>
mov    -0x14(%rbp),%edx
lea    0xc92(%rip),%rax
lea    0xc87(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x250(%rbp)
movl   $0x64,-0x12c(%rbp)
jmp    1493 <bat_info+0x2e3>
cmpl   $0x0,-0x14(%rbp)
je     148e <bat_info+0x2de>
lea    -0x120(%rbp),%rdi
lea    0xc5c(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1411 <bat_info+0x261>
lea    0xc4f(%rip),%rax
mov    %rax,-0x250(%rbp)
jmp    1489 <bat_info+0x2d9>
lea    -0x120(%rbp),%rdi
lea    0xc39(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1441 <bat_info+0x291>
lea    0xc0c(%rip),%rax
mov    %rax,-0x250(%rbp)
jmp    1484 <bat_info+0x2d4>
lea    -0x120(%rbp),%rdi
lea    0xc0e(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1471 <bat_info+0x2c1>
lea    0xc04(%rip),%rax
mov    %rax,-0x250(%rbp)
jmp    147f <bat_info+0x2cf>
lea    0xbf6(%rip),%rax
mov    %rax,-0x250(%rbp)
jmp    1484 <bat_info+0x2d4>
jmp    1489 <bat_info+0x2d9>
jmp    148e <bat_info+0x2de>
jmp    1493 <bat_info+0x2e3>
mov    -0x10(%rbp),%rdi
mov    -0x250(%rbp),%rsi
mov    -0x12c(%rbp),%edx
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xb8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2b18(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    0x2b02(%rip),%rax
mov    (%rax),%eax
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bat_info>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %ecx,%r14d
mov    %edx,%r12d
mov    %rsi,%r15
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0xdbe(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13d6 <bat_info+0x226>
mov    %rax,%rbp
xorps  %xmm0,%xmm0
movaps %xmm0,0x200(%rsp)
movaps %xmm0,0x1f0(%rsp)
movaps %xmm0,0x1e0(%rsp)
movaps %xmm0,0x1d0(%rsp)
movaps %xmm0,0x1c0(%rsp)
movaps %xmm0,0x1b0(%rsp)
movaps %xmm0,0x1a0(%rsp)
movaps %xmm0,0x190(%rsp)
movaps %xmm0,0x180(%rsp)
movaps %xmm0,0x170(%rsp)
movaps %xmm0,0x160(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
lea    0x110(%rsp),%rdi
mov    $0x100,%esi
mov    %rax,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
mov    %r15,0x8(%rsp)
mov    %r12d,0x4(%rsp)
je     13fc <bat_info+0x24c>
mov    $0xffffffff,%r13d
xor    %r14d,%r14d
lea    0xcf4(%rip),%r12
lea    0x110(%rsp),%rbx
movl   $0x0,(%rsp)
jmp    1369 <bat_info+0x1b9>
xor    %edi,%edi
mov    %r12,%rsi
call   10c0 <strtok@plt>
lea    0x10(%rsp),%rdi
mov    %rax,%rsi
mov    $0x100,%edx
call   1040 <strncpy@plt>
mov    $0x1,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %rbp,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     140c <bat_info+0x25c>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10c0 <strtok@plt>
test   %rax,%rax
je     1350 <bat_info+0x1a0>
mov    %rax,%r15
test   %r14d,%r14d
jne    1395 <bat_info+0x1e5>
mov    %r15,%rdi
lea    0xc7a(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     131f <bat_info+0x16f>
cmp    $0xffffffff,%r13d
jne    1350 <bat_info+0x1a0>
mov    %r15,%rdi
lea    0xc74(%rip),%rsi
call   1080 <strcmp@plt>
mov    $0xffffffff,%r13d
test   %rax,%rax
jne    1350 <bat_info+0x1a0>
xor    %edi,%edi
mov    %r12,%rsi
call   10c0 <strtok@plt>
mov    %rax,%rdi
call   10d0 <atoi@plt>
mov    %eax,%r13d
movl   $0x1,(%rsp)
jmp    1350 <bat_info+0x1a0>
test   %r14d,%r14d
jne    148e <bat_info+0x2de>
mov    0x2bfa(%rip),%rax
mov    (%rax),%edi
lea    0xc40(%rip),%rsi
mov    %rbx,%rdx
call   1090 <fprintf@plt>
jmp    148e <bat_info+0x2de>
movl   $0x0,(%rsp)
mov    $0xffffffff,%r13d
xor    %r14d,%r14d
mov    %rbp,%rdi
call   1050 <fclose@plt>
cmpl   $0x0,(%rsp)
mov    0x8(%rsp),%r15
mov    0x4(%rsp),%r12d
je     148e <bat_info+0x2de>
test   %r14d,%r14d
je     148e <bat_info+0x2de>
test   %r12d,%r12d
je     14e9 <bat_info+0x339>
lea    0xc12(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     14f0 <bat_info+0x340>
lea    0xc05(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     14f9 <bat_info+0x349>
lea    0xbf0(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
lea    0xbe8(%rip),%rax
lea    0xbe6(%rip),%rsi
cmove  %rax,%rsi
jmp    14a9 <bat_info+0x2f9>
test   %r12d,%r12d
lea    0xbad(%rip),%rax
lea    0xba2(%rip),%rsi
cmove  %rax,%rsi
mov    $0x64,%r13d
mov    %r15,%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2b11(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    0x2afb(%rip),%rax
mov    (%rax),%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%rsi
jmp    14a9 <bat_info+0x2f9>
lea    0xb5d(%rip),%rsi
jmp    14a9 <bat_info+0x2f9>
lea    0xb41(%rip),%rsi
jmp    14a9 <bat_info+0x2f9>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"=\0A\00"
@.str.2 = [20 x i8] c"POWER_SUPPLY_STATUS\00"
@.str.3 = [22 x i8] c"POWER_SUPPLY_CAPACITY\00"
@stderr = global i32 0
@.str.4 = [18 x i8] c"Can't open '%s'.\0A\00"
@.str.5 = [4 x i8] c"\E2\98\87\00"
@.str.6 = [6 x i8] c"Wired\00"
@.str.7 = [9 x i8] c"Charging\00"
@.str.8 = [4 x i8] c"\E2\9A\A1\00"
@.str.9 = [5 x i8] c"Full\00"
@.str.10 = [12 x i8] c"Discharging\00"
@.str.11 = [5 x i8] c"\F0\9F\94\8B\00"
@.str.12 = [4 x i8] c"\EF\BF\BD\00"
@.str.13 = [2 x i8] c"\0A\00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @bat_info(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [256 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
%14 = alloca [256 x i8]
%15 = alloca i8*
%16 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%17 = bitcast [256 x i8]* %9 to i8*
store i32 0, i32* %10
store i32 0, i32* %11
store i32 -1, i32* %12
%18 = load i8*, i8** %5
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %19, i32** %13
%20 = load i32*, i32** %13
%21 = icmp ne i32* %20, null
br i1 %21, label %22, label %61
22: ; preds = %4
%23 = bitcast [256 x i8]* %14 to i8*
br label %24
24: ; preds = %57, %22
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%26 = load i32*, i32** %13
%27 = call i32* @fgets(i8* %25, i32 256, i32* %26)
%28 = icmp ne i32* %27, null
br i1 %28, label %29, label %58
29: ; preds = %24
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%31 = call i8* @strtok(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i8* %31, i8** %15
%32 = load i8*, i8** %15
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %57
34: ; preds = %29
%35 = load i32, i32* %10
%36 = icmp ne i32 %35, 0
br i1 %36, label %45, label %37
37: ; preds = %34
%38 = load i8*, i8** %15
%39 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%43 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%44 = call i32 @strncpy(i8* %42, i8* %43, i32 256)
store i32 1, i32* %10
br label %56
45: ; preds = %37, %34
%46 = load i32, i32* %12
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %55
48: ; preds = %45
%49 = load i8*, i8** %15
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%54 = call i32 @atoi(i8* %53)
store i32 %54, i32* %12
store i32 1, i32* %11
br label %55
55: ; preds = %52, %48, %45
br label %56
56: ; preds = %55, %41
br label %57
57: ; preds = %56, %29
br label %24
58: ; preds = %24
%59 = load i32*, i32** %13
%60 = call i32 @fclose(i32* %59)
br label %69
61: ; preds = %4
%62 = load i32, i32* %8
%63 = icmp ne i32 %62, 0
br i1 %63, label %68, label %64
64: ; preds = %61
%65 = load i32, i32* @stderr
%66 = load i8*, i8** %5
%67 = call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %66)
br label %68
68: ; preds = %64, %61
br label %69
69: ; preds = %68, %58
%70 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
store i8* %70, i8** %16
%71 = load i32, i32* %11
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %69
%74 = load i32, i32* %10
%75 = icmp ne i32 %74, 0
br i1 %75, label %81, label %76
76: ; preds = %73, %69
%77 = load i32, i32* %7
%78 = icmp ne i32 %77, 0
%79 = zext i1 %78 to i64
%80 = select i1 %78, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0)
store i8* %80, i8** %16
store i32 100, i32* %12
br label %104
81: ; preds = %73
%82 = load i32, i32* %7
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %103
84: ; preds = %81
%85 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%86 = call i64 @strcmp(i8* %85, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%87 = icmp ne i64 %86, 0
br i1 %87, label %89, label %88
88: ; preds = %84
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8** %16
br label %102
89: ; preds = %84
%90 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%91 = call i64 @strcmp(i8* %90, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%92 = icmp ne i64 %91, 0
br i1 %92, label %94, label %93
93: ; preds = %89
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8** %16
br label %101
94: ; preds = %89
%95 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%96 = call i64 @strcmp(i8* %95, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%97 = icmp ne i64 %96, 0
br i1 %97, label %99, label %98
98: ; preds = %94
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8** %16
br label %100
99: ; preds = %94
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8** %16
br label %100
100: ; preds = %99, %98
br label %101
101: ; preds = %100, %93
br label %102
102: ; preds = %101, %88
br label %103
103: ; preds = %102, %81
br label %104
104: ; preds = %103, %76
%105 = load i8*, i8** %6
%106 = load i8*, i8** %16
%107 = load i32, i32* %12
%108 = call i32 (i8*, ...) @printf(i8* %105, i8* %106, i32 %107)
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%110 = load i32, i32* @stdout
%111 = call i32 @fflush(i32 %110)
%112 = load i32, i32* @EXIT_SUCCESS
ret i32 %112
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [3 x i8] c"=\0A\00"
@.str.2 = [20 x i8] c"POWER_SUPPLY_STATUS\00"
@.str.3 = [22 x i8] c"POWER_SUPPLY_CAPACITY\00"
@stderr = global i32 0
@.str.4 = [18 x i8] c"Can't open '%s'.\0A\00"
@.str.5 = [4 x i8] c"\E2\98\87\00"
@.str.6 = [6 x i8] c"Wired\00"
@.str.7 = [9 x i8] c"Charging\00"
@.str.8 = [4 x i8] c"\E2\9A\A1\00"
@.str.9 = [5 x i8] c"Full\00"
@.str.10 = [12 x i8] c"Discharging\00"
@.str.11 = [5 x i8] c"\F0\9F\94\8B\00"
@.str.12 = [4 x i8] c"\EF\BF\BD\00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @bat_info(i8* %0, i8* nocapture %1, i32 %2, i32 %3) {
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%8 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %42, label %10
10: ; preds = %4
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%12 = call i32* @fgets(i8* %11, i32 256, i32* %8)
%13 = icmp eq i32* %12, null
br i1 %13, label %47, label %14
14: ; preds = %10, %36
%15 = phi i32 [ %39, %36 ], [ 0, %10 ]
%16 = phi i32 [ %38, %36 ], [ 0, %10 ]
%17 = phi i32 [ %37, %36 ], [ -1, %10 ]
%18 = call i8* @strtok(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i8* %18, null
br i1 %19, label %36, label %20
20: ; preds = %14
%21 = icmp eq i32 %15, 0
br i1 %21, label %22, label %28
22: ; preds = %20
%23 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 @strncpy(i8* %7, i8* %26, i32 256)
br label %36
28: ; preds = %22, %20
%29 = icmp eq i32 %17, -1
br i1 %29, label %30, label %36
30: ; preds = %28
%31 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%35 = call i32 @atoi(i8* %34)
br label %36
36: ; preds = %25, %33, %30, %28, %14
%37 = phi i32 [ %35, %33 ], [ -1, %30 ], [ %17, %28 ], [ %17, %25 ], [ %17, %14 ]
%38 = phi i32 [ 1, %33 ], [ %16, %30 ], [ %16, %28 ], [ %16, %25 ], [ %16, %14 ]
%39 = phi i32 [ %15, %33 ], [ %15, %30 ], [ %15, %28 ], [ 1, %25 ], [ %15, %14 ]
%40 = call i32* @fgets(i8* %11, i32 256, i32* %8)
%41 = icmp eq i32* %40, null
br i1 %41, label %47, label %14
42: ; preds = %4
%43 = icmp eq i32 %3, 0
br i1 %43, label %44, label %55
44: ; preds = %42
%45 = load i32, i32* @stderr
%46 = tail call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %0)
br label %55
47: ; preds = %36, %10
%48 = phi i32 [ -1, %10 ], [ %37, %36 ]
%49 = phi i32 [ 0, %10 ], [ %38, %36 ]
%50 = phi i32 [ 0, %10 ], [ %39, %36 ]
%51 = call i32 @fclose(i32* %8)
%52 = icmp ne i32 %49, 0
%53 = icmp ne i32 %50, 0
%54 = select i1 %52, i1 %53, i1 false
br i1 %54, label %58, label %55
55: ; preds = %44, %42, %47
%56 = icmp eq i32 %2, 0
%57 = select i1 %56, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
br label %70
58: ; preds = %47
%59 = icmp eq i32 %2, 0
br i1 %59, label %70, label %60
60: ; preds = %58
%61 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%62 = icmp eq i64 %61, 0
br i1 %62, label %70, label %63
63: ; preds = %60
%64 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %70, label %66
66: ; preds = %63
%67 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%68 = icmp eq i64 %67, 0
%69 = select i1 %68, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0)
br label %70
70: ; preds = %66, %63, %60, %58, %55
%71 = phi i32 [ %48, %58 ], [ 100, %55 ], [ %48, %60 ], [ %48, %63 ], [ %48, %66 ]
%72 = phi i8* [ %7, %58 ], [ %57, %55 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), %60 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), %63 ], [ %69, %66 ]
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %1, i8* %72, i32 %71)
%74 = call i32 @putchar(i32 10)
%75 = load i32, i32* @stdout
%76 = call i32 @fflush(i32 %75)
%77 = load i32, i32* @EXIT_SUCCESS
ret i32 %77
}