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

/* Variables and functions */
int INT_MAX;
scalar_t__ errno;
scalar_t__ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
int strlen(char const *);
scalar_t__ strncmp(char const *, char *, int);
long strtol(char *, char **, int);
int errno_by_name_dynamic(const char *errno_name) {
  int i, len = strlen(errno_name);
  int err, number = -1;
  char buf[128];
  char cmd[64];
  char *end;
  long val;
  FILE *f;
  for (i = 0; i < len; i++) {
    if (errno_name[i] < 'A' || errno_name[i] > 'Z') {
      fprintf(stderr, "errno_name contains invalid char 0x%02x: %s\n",
              errno_name[i], errno_name);
      return -1;
    }
  }
  snprintf(cmd, sizeof(cmd), "errno %s", errno_name);
  f = popen(cmd, "r");
  if (!f) {
    fprintf(stderr, "popen: %s: %s\n", cmd, strerror(errno));
    return -1;
  }
  if (!fgets(buf, sizeof(buf), f)) {
    goto close;
  } else if (ferror(f)) {
    fprintf(stderr, "fgets: %s\n", strerror(errno));
    goto close;
  }
  if (strncmp(errno_name, buf, len) || strlen(buf) < len + 2) {
    fprintf(stderr, "expected '%s': %s\n", errno_name, buf);
    goto close;
  }
  errno = 0;
  val = strtol(buf + len + 2, &end, 10);
  if (errno || end == (buf + len + 2) || number < 0 || number > INT_MAX) {
    fprintf(stderr, "can't parse the second column, expected int: %s\n", buf);
    goto close;
  }
  number = val;
close:
  err = pclose(f);
  if (err < 0)
    fprintf(stderr, "pclose: %s\n", strerror(errno));
  return number;
}


x86 assembly (clang, -O0):
<errno_by_name_dynamic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x18(%rbp)
movl   $0xffffffff,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1245 <errno_by_name_dynamic+0xa5>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x41,%eax
jl     11ff <errno_by_name_dynamic+0x5f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5a,%eax
jle    1232 <errno_by_name_dynamic+0x92>
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
mov    -0x10(%rbp),%rcx
lea    0xde1(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c0 <errno_by_name_dynamic+0x320>
jmp    1237 <errno_by_name_dynamic+0x97>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c9 <errno_by_name_dynamic+0x29>
lea    -0xe0(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x40,%esi
lea    0xdd1(%rip),%rdx
call   1070 <snprintf@plt>
lea    -0xe0(%rbp),%rdi
lea    0xdc7(%rip),%rsi
call   10b0 <popen@plt>
mov    %rax,-0xf8(%rbp)
cmpq   $0x0,-0xf8(%rbp)
jne    12df <errno_by_name_dynamic+0x13f>
mov    0x2d48(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x104(%rbp)
lea    -0xe0(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    0x2d23(%rip),%rax
mov    (%rax),%rdi
call   10c0 <strerror@plt>
mov    -0x104(%rbp),%edi
mov    -0x100(%rbp),%rdx
mov    %rax,%rcx
lea    0xd6c(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14c0 <errno_by_name_dynamic+0x320>
lea    -0xa0(%rbp),%rdi
mov    -0xf8(%rbp),%rdx
mov    $0x80,%esi
call   1080 <fgets@plt>
cmp    $0x0,%eax
jne    1305 <errno_by_name_dynamic+0x165>
jmp    146c <errno_by_name_dynamic+0x2cc>
mov    -0xf8(%rbp),%rdi
call   1040 <ferror@plt>
cmp    $0x0,%rax
je     1355 <errno_by_name_dynamic+0x1b5>
mov    0x2cb6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x108(%rbp)
mov    0x2c9f(%rip),%rax
mov    (%rax),%rdi
call   10c0 <strerror@plt>
mov    -0x108(%rbp),%edi
mov    %rax,%rdx
lea    0xcfe(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    146c <errno_by_name_dynamic+0x2cc>
jmp    135a <errno_by_name_dynamic+0x1ba>
mov    -0x10(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1391 <errno_by_name_dynamic+0x1f1>
lea    -0xa0(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jge    13b8 <errno_by_name_dynamic+0x218>
mov    0x2c40(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    -0xa0(%rbp),%rcx
lea    0xca6(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    146c <errno_by_name_dynamic+0x2cc>
mov    0x2c11(%rip),%rax
movq   $0x0,(%rax)
lea    -0xa0(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
add    $0x2,%rdi
lea    -0xe8(%rbp),%rsi
mov    $0xa,%edx
call   10a0 <strtol@plt>
mov    %rax,-0xf0(%rbp)
mov    0x2bd9(%rip),%rax
cmpq   $0x0,(%rax)
jne    143f <errno_by_name_dynamic+0x29f>
mov    -0xe8(%rbp),%rax
lea    -0xa0(%rbp),%rcx
movslq -0x18(%rbp),%rdx
add    %rdx,%rcx
add    $0x2,%rcx
cmp    %rcx,%rax
je     143f <errno_by_name_dynamic+0x29f>
cmpl   $0x0,-0x20(%rbp)
jl     143f <errno_by_name_dynamic+0x29f>
mov    -0x20(%rbp),%eax
mov    0x2bb1(%rip),%rcx
cmp    (%rcx),%eax
jle    1462 <errno_by_name_dynamic+0x2c2>
mov    0x2b92(%rip),%rax
mov    (%rax),%edi
lea    -0xa0(%rbp),%rdx
lea    0xc0f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    146c <errno_by_name_dynamic+0x2cc>
mov    -0xf0(%rbp),%rax
mov    %eax,-0x20(%rbp)
mov    -0xf8(%rbp),%rdi
call   1060 <pclose@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    14ba <errno_by_name_dynamic+0x31a>
mov    0x2b4c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10c(%rbp)
mov    0x2b35(%rip),%rax
mov    (%rax),%rdi
call   10c0 <strerror@plt>
mov    -0x10c(%rbp),%edi
mov    %rax,%rdx
lea    0xbe3(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errno_by_name_dynamic>:
push   %r15
push   %r14
push   %rbx
sub    $0xd0,%rsp
mov    %rdi,%rbx
call   1050 <strlen@plt>
mov    %eax,%r15d
test   %eax,%eax
jle    11da <errno_by_name_dynamic+0x3a>
mov    %r15d,%eax
xor    %ecx,%ecx
movsbl (%rbx,%rcx,1),%edx
lea    -0x5b(%rdx),%esi
cmp    $0xe5,%sil
jbe    126b <errno_by_name_dynamic+0xcb>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    11c0 <errno_by_name_dynamic+0x20>
lea    0xe4c(%rip),%rdx
lea    0x90(%rsp),%r14
mov    %r14,%rdi
mov    $0x40,%esi
mov    %rbx,%rcx
call   1070 <snprintf@plt>
lea    0xe36(%rip),%rsi
mov    %r14,%rdi
call   10b0 <popen@plt>
test   %rax,%rax
je     128a <errno_by_name_dynamic+0xea>
mov    %rax,%r14
lea    0x10(%rsp),%rdi
mov    $0x80,%esi
mov    %rax,%rdx
call   1080 <fgets@plt>
test   %eax,%eax
je     1305 <errno_by_name_dynamic+0x165>
mov    %r14,%rdi
call   1040 <ferror@plt>
test   %rax,%rax
je     12bf <errno_by_name_dynamic+0x11f>
mov    0x2d9e(%rip),%rax
mov    (%rax),%ebx
mov    0x2d8d(%rip),%rax
mov    (%rax),%rdi
call   10c0 <strerror@plt>
lea    0xded(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1305 <errno_by_name_dynamic+0x165>
mov    0x2d6e(%rip),%rax
mov    (%rax),%edi
lea    0xd85(%rip),%rsi
mov    %rbx,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    133c <errno_by_name_dynamic+0x19c>
mov    0x2d4f(%rip),%rax
mov    (%rax),%ebx
mov    0x2d3e(%rip),%rax
mov    (%rax),%rdi
call   10c0 <strerror@plt>
lea    0xd8f(%rip),%rsi
lea    0x90(%rsp),%rdx
mov    %ebx,%edi
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    133c <errno_by_name_dynamic+0x19c>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    %r15d,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    12e6 <errno_by_name_dynamic+0x146>
lea    0x10(%rsp),%rdi
call   1050 <strlen@plt>
lea    0x2(%r15),%ecx
cmp    %ecx,%eax
jge    134e <errno_by_name_dynamic+0x1ae>
mov    0x2cf3(%rip),%rax
mov    (%rax),%edi
lea    0xd5c(%rip),%rsi
lea    0x10(%rsp),%rcx
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %r14,%rdi
call   1060 <pclose@plt>
test   %eax,%eax
jns    133c <errno_by_name_dynamic+0x19c>
mov    0x2cc8(%rip),%rax
mov    (%rax),%ebx
mov    0x2cb7(%rip),%rax
mov    (%rax),%rdi
call   10c0 <strerror@plt>
lea    0xd66(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2c83(%rip),%rax
movq   $0x0,(%rax)
movslq %r15d,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x12,%rdi
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   10a0 <strtol@plt>
mov    0x2c63(%rip),%rax
mov    (%rax),%edi
lea    0xcdf(%rip),%rsi
lea    0x10(%rsp),%rdx
jmp    125f <errno_by_name_dynamic+0xbf>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"errno_name contains invalid char 0x%02x: %s\0A\00"
@.str.1 = [9 x i8] c"errno %s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [15 x i8] c"popen: %s: %s\0A\00"
@errno = global i64 0
@.str.4 = [11 x i8] c"fgets: %s\0A\00"
@.str.5 = [19 x i8] c"expected '%s': %s\0A\00"
@INT_MAX = global i32 0
@.str.6 = [49 x i8] c"can't parse the second column, expected int: %s\0A\00"
@.str.7 = [12 x i8] c"pclose: %s\0A\00"
define i32 @errno_by_name_dynamic(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [128 x i8]
%9 = alloca [64 x i8]
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i32*
store i8* %0, i8** %3
%13 = load i8*, i8** %3
%14 = call i32 @strlen(i8* %13)
store i32 %14, i32* %5
store i32 -1, i32* %7
store i32 0, i32* %4
br label %15
15: ; preds = %46, %1
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %49
19: ; preds = %15
%20 = load i8*, i8** %3
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp slt i32 %25, 65
br i1 %26, label %35, label %27
27: ; preds = %19
%28 = load i8*, i8** %3
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp sgt i32 %33, 90
br i1 %34, label %35, label %45
35: ; preds = %27, %19
%36 = load i32, i32* @stderr
%37 = load i8*, i8** %3
%38 = load i32, i32* %4
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = load i8*, i8** %3
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %42, i8* %43)
store i32 -1, i32* %2
br label %139
45: ; preds = %27
br label %46
46: ; preds = %45
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
store i32 %48, i32* %4
br label %15
49: ; preds = %15
%50 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%51 = load i8*, i8** %3
%52 = call i32 @snprintf(i8* %50, i32 64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %51)
%53 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%54 = call i32* @popen(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %54, i32** %12
%55 = load i32*, i32** %12
%56 = icmp ne i32* %55, null
br i1 %56, label %63, label %57
57: ; preds = %49
%58 = load i32, i32* @stderr
%59 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%60 = load i64, i64* @errno
%61 = call i8* @strerror(i64 %60)
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %59, i8* %61)
store i32 -1, i32* %2
br label %139
63: ; preds = %49
%64 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%65 = load i32*, i32** %12
%66 = call i32 @fgets(i8* %64, i32 128, i32* %65)
%67 = icmp ne i32 %66, 0
br i1 %67, label %69, label %68
68: ; preds = %63
br label %127
69: ; preds = %63
%70 = load i32*, i32** %12
%71 = call i64 @ferror(i32* %70)
%72 = icmp ne i64 %71, 0
br i1 %72, label %73, label %78
73: ; preds = %69
%74 = load i32, i32* @stderr
%75 = load i64, i64* @errno
%76 = call i8* @strerror(i64 %75)
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %76)
br label %127
78: ; preds = %69
br label %79
79: ; preds = %78
%80 = load i8*, i8** %3
%81 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%82 = load i32, i32* %5
%83 = call i64 @strncmp(i8* %80, i8* %81, i32 %82)
%84 = icmp ne i64 %83, 0
br i1 %84, label %91, label %85
85: ; preds = %79
%86 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%87 = call i32 @strlen(i8* %86)
%88 = load i32, i32* %5
%89 = add nsw i32 %88, 2
%90 = icmp slt i32 %87, %89
br i1 %90, label %91, label %96
91: ; preds = %85, %79
%92 = load i32, i32* @stderr
%93 = load i8*, i8** %3
%94 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %93, i8* %94)
br label %127
96: ; preds = %85
store i64 0, i64* @errno
%97 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%98 = load i32, i32* %5
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8, i8* %97, i64 %99
%101 = getelementptr inbounds i8, i8* %100, i64 2
%102 = call i64 @strtol(i8* %101, i8** %10, i32 10)
store i64 %102, i64* %11
%103 = load i64, i64* @errno
%104 = icmp ne i64 %103, 0
br i1 %104, label %120, label %105
105: ; preds = %96
%106 = load i8*, i8** %10
%107 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%108 = load i32, i32* %5
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8, i8* %107, i64 %109
%111 = getelementptr inbounds i8, i8* %110, i64 2
%112 = icmp eq i8* %106, %111
br i1 %112, label %120, label %113
113: ; preds = %105
%114 = load i32, i32* %7
%115 = icmp slt i32 %114, 0
br i1 %115, label %120, label %116
116: ; preds = %113
%117 = load i32, i32* %7
%118 = load i32, i32* @INT_MAX
%119 = icmp sgt i32 %117, %118
br i1 %119, label %120, label %124
120: ; preds = %116, %113, %105, %96
%121 = load i32, i32* @stderr
%122 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%123 = call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0), i8* %122)
br label %127
124: ; preds = %116
%125 = load i64, i64* %11
%126 = trunc i64 %125 to i32
store i32 %126, i32* %7
br label %127
127: ; preds = %124, %120, %91, %73, %68
%128 = load i32*, i32** %12
%129 = call i32 @pclose(i32* %128)
store i32 %129, i32* %6
%130 = load i32, i32* %6
%131 = icmp slt i32 %130, 0
br i1 %131, label %132, label %137
132: ; preds = %127
%133 = load i32, i32* @stderr
%134 = load i64, i64* @errno
%135 = call i8* @strerror(i64 %134)
%136 = call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* %135)
br label %137
137: ; preds = %132, %127
%138 = load i32, i32* %7
store i32 %138, i32* %2
br label %139
139: ; preds = %137, %57, %35
%140 = load i32, i32* %2
ret i32 %140
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"errno_name contains invalid char 0x%02x: %s\0A\00"
@.str.1 = [9 x i8] c"errno %s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [15 x i8] c"popen: %s: %s\0A\00"
@errno = global i64 0
@.str.4 = [11 x i8] c"fgets: %s\0A\00"
@.str.5 = [19 x i8] c"expected '%s': %s\0A\00"
@INT_MAX = global i32 0
@.str.6 = [49 x i8] c"can't parse the second column, expected int: %s\0A\00"
@.str.7 = [12 x i8] c"pclose: %s\0A\00"
define i32 @errno_by_name_dynamic(i8* %0) {
%2 = alloca [128 x i8]
%3 = alloca [64 x i8]
%4 = alloca i8*
%5 = tail call i32 @strlen(i8* %0)
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%8 = bitcast i8** %4 to i8*
%9 = icmp sgt i32 %5, 0
br i1 %9, label %10, label %25
10: ; preds = %1
%11 = zext i32 %5 to i64
br label %14
12: ; preds = %14
%13 = icmp eq i64 %20, %11
br i1 %13, label %25, label %14
14: ; preds = %10, %12
%15 = phi i64 [ 0, %10 ], [ %20, %12 ]
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = add i8 %17, -91
%19 = icmp ult i8 %18, -26
%20 = add nuw nsw i64 %15, 1
br i1 %19, label %21, label %12
21: ; preds = %14
%22 = load i32, i32* @stderr
%23 = sext i8 %17 to i32
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %23, i8* %0)
br label %70
25: ; preds = %12, %1
%26 = call i32 @snprintf(i8* %7, i32 64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%27 = call i32* @popen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %34
29: ; preds = %25
%30 = load i32, i32* @stderr
%31 = load i64, i64* @errno
%32 = call i8* @strerror(i64 %31)
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %7, i8* %32)
br label %70
34: ; preds = %25
%35 = call i32 @fgets(i8* %6, i32 128, i32* %27)
%36 = icmp eq i32 %35, 0
br i1 %36, label %62, label %37
37: ; preds = %34
%38 = call i64 @ferror(i32* %27)
%39 = icmp eq i64 %38, 0
br i1 %39, label %45, label %40
40: ; preds = %37
%41 = load i32, i32* @stderr
%42 = load i64, i64* @errno
%43 = call i8* @strerror(i64 %42)
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %43)
br label %62
45: ; preds = %37
%46 = call i64 @strncmp(i8* %0, i8* %6, i32 %5)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %45
%49 = call i32 @strlen(i8* %6)
%50 = add nsw i32 %5, 2
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %55
52: ; preds = %48, %45
%53 = load i32, i32* @stderr
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %0, i8* %6)
br label %62
55: ; preds = %48
store i64 0, i64* @errno
%56 = sext i32 %5 to i64
%57 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %56
%58 = getelementptr inbounds i8, i8* %57, i64 2
%59 = call i64 @strtol(i8* %58, i8** %4, i32 10)
%60 = load i32, i32* @stderr
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0), i8* %6)
br label %62
62: ; preds = %34, %55, %52, %40
%63 = call i32 @pclose(i32* %27)
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %70
65: ; preds = %62
%66 = load i32, i32* @stderr
%67 = load i64, i64* @errno
%68 = call i8* @strerror(i64 %67)
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* %68)
br label %70
70: ; preds = %62, %65, %29, %21
ret i32 -1
}