#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 */
struct output {
  int dummy;
};
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ add_output(struct output *, char *, int);
int /*<<< orphan*/ do_exec(char **, int /*<<< orphan*/, struct output *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ output_errno(struct output *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int, char *);
int sscanf(char *, char *, ...);
scalar_t__ strcmp(char *, char *);
void local_net_do(char **argv, int if_index, char *addr_str, char *netmask_str,
                  char *skip_dev, struct output *output) {
  FILE *fp;
  unsigned long addr, netmask, if_addr;
  int a[4], n[4];
  char buf[1024], iface[32], out[1024];
  if (sscanf(addr_str, "%d.%d.%d.%d", &a[0], &a[1], &a[2], &a[3]) != 4) {
    add_output(output, "local_net_do didn't parse address", -1);
    return;
  }
  addr = (a[3] << 24) | (a[2] << 16) | (a[1] << 8) | a[0];
  if (sscanf(netmask_str, "%d.%d.%d.%d", &n[0], &n[1], &n[2], &n[3]) != 4) {
    add_output(output, "local_net_do didn't parse netmask", -1);
    return;
  }
  netmask = (n[3] << 24) | (n[2] << 16) | (n[1] << 8) | n[0];
  argv[if_index] = iface;
  if ((fp = fopen("/proc/net/route", "r")) == NULL) {
    output_errno(output, "Couldn't open /proc/net/route");
    return;
  }
  if (fgets(buf, sizeof(buf), fp) == NULL)
    return;
  buf[0] = '\0';
  while (fgets(buf, sizeof(buf), fp) != NULL) {
    int n;
    n = sscanf(buf, "%32s %lx %*x %*x %*x %*x %*x", iface, &if_addr);
    if (n != 2) {
      sprintf(out, "Didn't parse /proc/net/route, got %d\n on '%s'", n, buf);
      add_output(output, out, -1);
      return;
    }
    if (strcmp(skip_dev, iface) && ((addr & netmask) == (if_addr & netmask)))
      do_exec(argv, 0, output);
    buf[0] = '\0';
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<local_net_do>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8a0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    -0x60(%rbp),%rcx
add    $0x4,%rcx
lea    -0x60(%rbp),%r8
add    $0x8,%r8
lea    -0x60(%rbp),%r9
add    $0xc,%r9
lea    0xe27(%rip),%rsi
mov    $0x0,%al
call   1080 <sscanf@plt>
cmp    $0x4,%eax
je     1203 <local_net_do+0x73>
mov    -0x30(%rbp),%rdi
lea    0xe18(%rip),%rsi
mov    $0xffffffff,%edx
call   10a0 <add_output@plt>
jmp    13e9 <local_net_do+0x259>
mov    -0x54(%rbp),%eax
shl    $0x18,%eax
mov    -0x58(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x5c(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     -0x60(%rbp),%eax
cltq
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x70(%rbp),%rdx
lea    -0x70(%rbp),%rcx
add    $0x4,%rcx
lea    -0x70(%rbp),%r8
add    $0x8,%r8
lea    -0x70(%rbp),%r9
add    $0xc,%r9
lea    0xdb7(%rip),%rsi
mov    $0x0,%al
call   1080 <sscanf@plt>
cmp    $0x4,%eax
je     1273 <local_net_do+0xe3>
mov    -0x30(%rbp),%rdi
lea    0xdca(%rip),%rsi
mov    $0xffffffff,%edx
call   10a0 <add_output@plt>
jmp    13e9 <local_net_do+0x259>
mov    -0x64(%rbp),%eax
shl    $0x18,%eax
mov    -0x68(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x6c(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     -0x70(%rbp),%eax
cltq
mov    %rax,-0x48(%rbp)
lea    -0x490(%rbp),%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
lea    0xdb4(%rip),%rdi
lea    0xd9d(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    12db <local_net_do+0x14b>
mov    -0x30(%rbp),%rdi
lea    0xd81(%rip),%rsi
call   1030 <output_errno@plt>
jmp    13e9 <local_net_do+0x259>
lea    -0x470(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    $0x400,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    12ff <local_net_do+0x16f>
jmp    13e9 <local_net_do+0x259>
movb   $0x0,-0x470(%rbp)
lea    -0x470(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    $0x400,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     13e0 <local_net_do+0x250>
lea    -0x470(%rbp),%rdi
lea    -0x490(%rbp),%rdx
lea    0xd36(%rip),%rsi
lea    -0x50(%rbp),%rcx
mov    $0x0,%al
call   1080 <sscanf@plt>
mov    %eax,-0x894(%rbp)
cmpl   $0x2,-0x894(%rbp)
je     1392 <local_net_do+0x202>
lea    -0x890(%rbp),%rdi
mov    -0x894(%rbp),%edx
lea    -0x470(%rbp),%rcx
lea    0xd1a(%rip),%rsi
call   10b0 <sprintf@plt>
mov    -0x30(%rbp),%rdi
lea    -0x890(%rbp),%rsi
mov    $0xffffffff,%edx
call   10a0 <add_output@plt>
jmp    13e9 <local_net_do+0x259>
mov    -0x28(%rbp),%rdi
lea    -0x490(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     13d4 <local_net_do+0x244>
mov    -0x40(%rbp),%rax
and    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rcx
and    -0x48(%rbp),%rcx
cmp    %rcx,%rax
jne    13d4 <local_net_do+0x244>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rdx
xor    %esi,%esi
call   1040 <do_exec@plt>
movb   $0x0,-0x470(%rbp)
jmp    1306 <local_net_do+0x176>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
add    $0x8a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<local_net_do>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x868,%rsp
mov    %r9,%r14
mov    %r8,%r12
mov    %rcx,%rbp
mov    %rdx,%rax
mov    %esi,%r15d
mov    %rdi,%r13
lea    0x14(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x1c(%rsp),%r9
lea    0xe37(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   1080 <sscanf@plt>
cmp    $0x4,%eax
jne    133c <local_net_do+0x1ac>
mov    0x1c(%rsp),%eax
shl    $0x18,%eax
mov    0x14(%rsp),%ebx
mov    0x18(%rsp),%ecx
shl    $0x10,%ecx
or     %eax,%ecx
shl    $0x8,%ebx
or     %ecx,%ebx
or     0x10(%rsp),%ebx
lea    0x4(%rsp),%rcx
lea    0x8(%rsp),%r8
lea    0xc(%rsp),%r9
lea    0xdec(%rip),%rsi
mov    %rsp,%rdx
mov    %rbp,%rdi
xor    %eax,%eax
call   1080 <sscanf@plt>
cmp    $0x4,%eax
jne    1345 <local_net_do+0x1b5>
mov    0xc(%rsp),%eax
shl    $0x18,%eax
mov    0x4(%rsp),%ebp
mov    0x8(%rsp),%ecx
shl    $0x10,%ecx
or     %eax,%ecx
shl    $0x8,%ebp
or     %ecx,%ebp
or     (%rsp),%ebp
movslq %r15d,%rax
lea    0x40(%rsp),%rcx
mov    %rcx,0x0(%r13,%rax,8)
lea    0xe06(%rip),%rdi
lea    0xdef(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     136b <local_net_do+0x1db>
mov    %rax,%r15
lea    0x60(%rsp),%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1359 <local_net_do+0x1c9>
mov    %r13,0x28(%rsp)
movb   $0x0,0x60(%rsp)
lea    0x60(%rsp),%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     137c <local_net_do+0x1ec>
movslq %ebp,%rax
mov    %rax,0x30(%rsp)
and    %eax,%ebx
movslq %ebx,%rbx
lea    0x60(%rsp),%rbp
lea    0x40(%rsp),%r13
jmp    12ee <local_net_do+0x15e>
nopl   0x0(%rax,%rax,1)
movb   $0x0,0x60(%rsp)
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     137c <local_net_do+0x1ec>
mov    %rbp,%rdi
lea    0xd78(%rip),%rsi
mov    %r13,%rdx
lea    0x38(%rsp),%rcx
xor    %eax,%eax
call   1080 <sscanf@plt>
cmp    $0x2,%eax
jne    1386 <local_net_do+0x1f6>
mov    %r12,%rdi
mov    %r13,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12d0 <local_net_do+0x140>
mov    0x38(%rsp),%rax
and    0x30(%rsp),%rax
cmp    %rbx,%rax
jne    12d0 <local_net_do+0x140>
mov    0x28(%rsp),%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <do_exec@plt>
jmp    12d0 <local_net_do+0x140>
lea    0xcc9(%rip),%rsi
jmp    134c <local_net_do+0x1bc>
lea    0xce2(%rip),%rsi
mov    %r14,%rdi
mov    $0xffffffff,%edx
call   10a0 <add_output@plt>
add    $0x868,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xce0(%rip),%rsi
mov    %r14,%rdi
call   1030 <output_errno@plt>
jmp    1359 <local_net_do+0x1c9>
mov    %r15,%rdi
call   1050 <fclose@plt>
jmp    1359 <local_net_do+0x1c9>
lea    0xd00(%rip),%rsi
lea    0x460(%rsp),%rbx
lea    0x60(%rsp),%rcx
mov    %rbx,%rdi
mov    %eax,%edx
call   10b0 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
jmp    134f <local_net_do+0x1bf>

LLVM IR (-O0):
%struct.output = type { i32 }
@.str = [12 x i8] c"%d.%d.%d.%d\00"
@.str.1 = [34 x i8] c"local_net_do didn't parse address\00"
@.str.2 = [34 x i8] c"local_net_do didn't parse netmask\00"
@.str.3 = [16 x i8] c"/proc/net/route\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [30 x i8] c"Couldn't open /proc/net/route\00"
@.str.6 = [29 x i8] c"%32s %lx %*x %*x %*x %*x %*x\00"
@.str.7 = [46 x i8] c"Didn't parse /proc/net/route, got %d\0A on '%s'\00"
define void @local_net_do(i8** %0, i32 %1, i8* %2, i8* %3, i8* %4, %struct.output* %5) {
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca %struct.output*
%13 = alloca i32*
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca [4 x i32]
%18 = alloca [4 x i32]
%19 = alloca [1024 x i8]
%20 = alloca [32 x i8]
%21 = alloca [1024 x i8]
%22 = alloca i32
store i8** %0, i8*** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store %struct.output* %5, %struct.output** %12
%23 = load i8*, i8** %9
%24 = getelementptr inbounds [4 x i32], [4 x i32]* %17, i64 0, i64 0
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %17, i64 0, i64 1
%26 = getelementptr inbounds [4 x i32], [4 x i32]* %17, i64 0, i64 2
%27 = getelementptr inbounds [4 x i32], [4 x i32]* %17, i64 0, i64 3
%28 = call i32 (i8*, i8*, ...) @sscanf(i8* %23, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %24, i32* %25, i32* %26, i32* %27)
%29 = icmp ne i32 %28, 4
br i1 %29, label %30, label %33
30: ; preds = %6
%31 = load %struct.output*, %struct.output** %12
%32 = call i32 @add_output(%struct.output* %31, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 -1)
br label %134
33: ; preds = %6
%34 = getelementptr inbounds [4 x i32], [4 x i32]* %17, i64 0, i64 3
%35 = load i32, i32* %34
%36 = shl i32 %35, 24
%37 = getelementptr inbounds [4 x i32], [4 x i32]* %17, i64 0, i64 2
%38 = load i32, i32* %37
%39 = shl i32 %38, 16
%40 = or i32 %36, %39
%41 = getelementptr inbounds [4 x i32], [4 x i32]* %17, i64 0, i64 1
%42 = load i32, i32* %41
%43 = shl i32 %42, 8
%44 = or i32 %40, %43
%45 = getelementptr inbounds [4 x i32], [4 x i32]* %17, i64 0, i64 0
%46 = load i32, i32* %45
%47 = or i32 %44, %46
%48 = sext i32 %47 to i64
store i64 %48, i64* %14
%49 = load i8*, i8** %10
%50 = getelementptr inbounds [4 x i32], [4 x i32]* %18, i64 0, i64 0
%51 = getelementptr inbounds [4 x i32], [4 x i32]* %18, i64 0, i64 1
%52 = getelementptr inbounds [4 x i32], [4 x i32]* %18, i64 0, i64 2
%53 = getelementptr inbounds [4 x i32], [4 x i32]* %18, i64 0, i64 3
%54 = call i32 (i8*, i8*, ...) @sscanf(i8* %49, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %50, i32* %51, i32* %52, i32* %53)
%55 = icmp ne i32 %54, 4
br i1 %55, label %56, label %59
56: ; preds = %33
%57 = load %struct.output*, %struct.output** %12
%58 = call i32 @add_output(%struct.output* %57, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 -1)
br label %134
59: ; preds = %33
%60 = getelementptr inbounds [4 x i32], [4 x i32]* %18, i64 0, i64 3
%61 = load i32, i32* %60
%62 = shl i32 %61, 24
%63 = getelementptr inbounds [4 x i32], [4 x i32]* %18, i64 0, i64 2
%64 = load i32, i32* %63
%65 = shl i32 %64, 16
%66 = or i32 %62, %65
%67 = getelementptr inbounds [4 x i32], [4 x i32]* %18, i64 0, i64 1
%68 = load i32, i32* %67
%69 = shl i32 %68, 8
%70 = or i32 %66, %69
%71 = getelementptr inbounds [4 x i32], [4 x i32]* %18, i64 0, i64 0
%72 = load i32, i32* %71
%73 = or i32 %70, %72
%74 = sext i32 %73 to i64
store i64 %74, i64* %15
%75 = getelementptr inbounds [32 x i8], [32 x i8]* %20, i64 0, i64 0
%76 = load i8**, i8*** %7
%77 = load i32, i32* %8
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8*, i8** %76, i64 %78
store i8* %75, i8** %79
%80 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %80, i32** %13
%81 = icmp eq i32* %80, null
br i1 %81, label %82, label %85
82: ; preds = %59
%83 = load %struct.output*, %struct.output** %12
%84 = call i32 @output_errno(%struct.output* %83, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %134
85: ; preds = %59
%86 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%87 = load i32*, i32** %13
%88 = call i32* @fgets(i8* %86, i32 1024, i32* %87)
%89 = icmp eq i32* %88, null
br i1 %89, label %90, label %91
90: ; preds = %85
br label %134
91: ; preds = %85
%92 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
store i8 0, i8* %92
br label %93
93: ; preds = %129, %91
%94 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%95 = load i32*, i32** %13
%96 = call i32* @fgets(i8* %94, i32 1024, i32* %95)
%97 = icmp ne i32* %96, null
br i1 %97, label %98, label %131
98: ; preds = %93
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%100 = getelementptr inbounds [32 x i8], [32 x i8]* %20, i64 0, i64 0
%101 = call i32 (i8*, i8*, ...) @sscanf(i8* %99, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %100, i64* %16)
store i32 %101, i32* %22
%102 = load i32, i32* %22
%103 = icmp ne i32 %102, 2
br i1 %103, label %104, label %112
104: ; preds = %98
%105 = getelementptr inbounds [1024 x i8], [1024 x i8]* %21, i64 0, i64 0
%106 = load i32, i32* %22
%107 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
%108 = call i32 @sprintf(i8* %105, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), i32 %106, i8* %107)
%109 = load %struct.output*, %struct.output** %12
%110 = getelementptr inbounds [1024 x i8], [1024 x i8]* %21, i64 0, i64 0
%111 = call i32 @add_output(%struct.output* %109, i8* %110, i32 -1)
br label %134
112: ; preds = %98
%113 = load i8*, i8** %11
%114 = getelementptr inbounds [32 x i8], [32 x i8]* %20, i64 0, i64 0
%115 = call i64 @strcmp(i8* %113, i8* %114)
%116 = icmp ne i64 %115, 0
br i1 %116, label %117, label %129
117: ; preds = %112
%118 = load i64, i64* %14
%119 = load i64, i64* %15
%120 = and i64 %118, %119
%121 = load i64, i64* %16
%122 = load i64, i64* %15
%123 = and i64 %121, %122
%124 = icmp eq i64 %120, %123
br i1 %124, label %125, label %129
125: ; preds = %117
%126 = load i8**, i8*** %7
%127 = load %struct.output*, %struct.output** %12
%128 = call i32 @do_exec(i8** %126, i32 0, %struct.output* %127)
br label %129
129: ; preds = %125, %117, %112
%130 = getelementptr inbounds [1024 x i8], [1024 x i8]* %19, i64 0, i64 0
store i8 0, i8* %130
br label %93
131: ; preds = %93
%132 = load i32*, i32** %13
%133 = call i32 @fclose(i32* %132)
br label %134
134: ; preds = %131, %104, %90, %82, %56, %30
ret void
}

LLVM IR (-O2):
%struct.output = type { i32 }
@.str = [12 x i8] c"%d.%d.%d.%d\00"
@.str.1 = [34 x i8] c"local_net_do didn't parse address\00"
@.str.2 = [34 x i8] c"local_net_do didn't parse netmask\00"
@.str.3 = [16 x i8] c"/proc/net/route\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [30 x i8] c"Couldn't open /proc/net/route\00"
@.str.6 = [29 x i8] c"%32s %lx %*x %*x %*x %*x %*x\00"
@.str.7 = [46 x i8] c"Didn't parse /proc/net/route, got %d\0A on '%s'\00"
define void @local_net_do(i8** %0, i32 %1, i8* nocapture %2, i8* nocapture %3, i8* %4, %struct.output* %5) {
%7 = alloca i64
%8 = alloca [4 x i32]
%9 = alloca [4 x i32]
%10 = alloca [1024 x i8]
%11 = alloca [32 x i8]
%12 = alloca [1024 x i8]
%13 = bitcast i64* %7 to i8*
%14 = bitcast [4 x i32]* %8 to i8*
%15 = bitcast [4 x i32]* %9 to i8*
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%17 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 0
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 1
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 2
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 3
%23 = call i32 (i8*, i8*, ...) @sscanf(i8* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %19, i32* %20, i32* %21, i32* %22)
%24 = icmp eq i32 %23, 4
br i1 %24, label %27, label %25
25: ; preds = %6
%26 = call i32 @add_output(%struct.output* %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 -1)
br label %93
27: ; preds = %6
%28 = load i32, i32* %22
%29 = shl i32 %28, 24
%30 = load i32, i32* %21
%31 = shl i32 %30, 16
%32 = or i32 %31, %29
%33 = load i32, i32* %20
%34 = shl i32 %33, 8
%35 = or i32 %32, %34
%36 = load i32, i32* %19
%37 = or i32 %35, %36
%38 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%39 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 1
%40 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 2
%41 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 3
%42 = call i32 (i8*, i8*, ...) @sscanf(i8* %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %38, i32* %39, i32* %40, i32* %41)
%43 = icmp eq i32 %42, 4
br i1 %43, label %46, label %44
44: ; preds = %27
%45 = call i32 @add_output(%struct.output* %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 -1)
br label %93
46: ; preds = %27
%47 = load i32, i32* %41
%48 = shl i32 %47, 24
%49 = load i32, i32* %40
%50 = shl i32 %49, 16
%51 = or i32 %50, %48
%52 = load i32, i32* %39
%53 = shl i32 %52, 8
%54 = or i32 %51, %53
%55 = load i32, i32* %38
%56 = or i32 %54, %55
%57 = sext i32 %56 to i64
%58 = sext i32 %1 to i64
%59 = getelementptr inbounds i8*, i8** %0, i64 %58
store i8* %17, i8** %59
%60 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %64
62: ; preds = %46
%63 = call i32 @output_errno(%struct.output* %5, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %93
64: ; preds = %46
%65 = call i32* @fgets(i8* %16, i32 1024, i32* %60)
%66 = icmp eq i32* %65, null
br i1 %66, label %93, label %67
67: ; preds = %64
store i8 0, i8* %16
%68 = call i32* @fgets(i8* %16, i32 1024, i32* %60)
%69 = icmp eq i32* %68, null
br i1 %69, label %91, label %70
70: ; preds = %67
%71 = and i32 %56, %37
%72 = sext i32 %71 to i64
br label %73
73: ; preds = %70, %88
%74 = call i32 (i8*, i8*, ...) @sscanf(i8* %16, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %17, i64* %7)
%75 = icmp eq i32 %74, 2
br i1 %75, label %79, label %76
76: ; preds = %73
%77 = call i32 @sprintf(i8* %18, i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), i32 %74, i8* %16)
%78 = call i32 @add_output(%struct.output* %5, i8* %18, i32 -1)
br label %93
79: ; preds = %73
%80 = call i64 @strcmp(i8* %4, i8* %17)
%81 = icmp eq i64 %80, 0
br i1 %81, label %88, label %82
82: ; preds = %79
%83 = load i64, i64* %7
%84 = and i64 %83, %57
%85 = icmp eq i64 %84, %72
br i1 %85, label %86, label %88
86: ; preds = %82
%87 = call i32 @do_exec(i8** %0, i32 0, %struct.output* %5)
br label %88
88: ; preds = %79, %82, %86
store i8 0, i8* %16
%89 = call i32* @fgets(i8* %16, i32 1024, i32* %60)
%90 = icmp eq i32* %89, null
br i1 %90, label %91, label %73
91: ; preds = %88, %67
%92 = call i32 @fclose(i32* %60)
br label %93
93: ; preds = %76, %64, %91, %62, %44, %25
ret void
}