#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*/ *fopen_path(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
scalar_t__ get_line(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  FILE *input_file;
  char buffer[1024];
  FILE *output_pipe;
  char *input_filename;
  argc = 1;
  if (strcmp(argv[0], "ufw_blacklist.e") == 0)
    input_filename = "ufw_blacklist.dat";
  else
    input_filename = "ufw_whitelist.dat";
  output_pipe = popen("sort -n", "w");
  if ((input_file = fopen_path(input_filename, "r"))) {
    while (get_line(buffer, input_file)) {
      fprintf(output_pipe, "%s\n", buffer);
    }
    pclose(output_pipe);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe72(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11b0 <main+0x50>
lea    0xe6c(%rip),%rax
mov    %rax,-0x430(%rbp)
jmp    11be <main+0x5e>
lea    0xe6b(%rip),%rax
mov    %rax,-0x430(%rbp)
lea    0xe6f(%rip),%rdi
lea    0xe70(%rip),%rsi
call   1080 <popen@plt>
mov    %rax,-0x428(%rbp)
mov    -0x430(%rbp),%rdi
lea    0xe58(%rip),%rsi
call   1070 <fopen_path@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1243 <main+0xe3>
jmp    11fe <main+0x9e>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     1237 <main+0xd7>
mov    -0x428(%rbp),%rdi
lea    -0x420(%rbp),%rdx
lea    0xe13(%rip),%rsi
call   1060 <fprintf@plt>
jmp    11fe <main+0x9e>
mov    -0x428(%rbp),%rdi
call   1040 <pclose@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    (%rsi),%rdi
lea    0xe88(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
lea    0xe89(%rip),%rax
lea    0xe94(%rip),%rbx
cmove  %rax,%rbx
lea    0xe9b(%rip),%rdi
lea    0xe9c(%rip),%rsi
call   1080 <popen@plt>
mov    %rax,%r14
lea    0xe8f(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen_path@plt>
test   %rax,%rax
je     1206 <main+0xa6>
mov    %rax,%r12
mov    %rsp,%rdi
mov    %rax,%rsi
call   1030 <get_line@plt>
test   %rax,%rax
je     11fe <main+0x9e>
lea    0xe6a(%rip),%r15
mov    %rsp,%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1060 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <get_line@plt>
test   %rax,%rax
jne    11e0 <main+0x80>
mov    %r14,%rdi
call   1040 <pclose@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"ufw_blacklist.e\00"
@.str.1 = [18 x i8] c"ufw_blacklist.dat\00"
@.str.2 = [18 x i8] c"ufw_whitelist.dat\00"
@.str.3 = [8 x i8] c"sort -n\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [1024 x i8]
%8 = alloca i32*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %4
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %2
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %17
16: ; preds = %2
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8** %9
br label %17
17: ; preds = %16, %15
%18 = call i32* @popen(i8* getelementptr inbounds ([8 x i8], [8 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* %18, i32** %8
%19 = load i8*, i8** %9
%20 = call i32* @fopen_path(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %20, i32** %6
%21 = icmp ne i32* %20, null
br i1 %21, label %22, label %35
22: ; preds = %17
br label %23
23: ; preds = %28, %22
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%25 = load i32*, i32** %6
%26 = call i64 @get_line(i8* %24, i32* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = load i32*, i32** %8
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%31 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %30)
br label %23
32: ; preds = %23
%33 = load i32*, i32** %8
%34 = call i32 @pclose(i32* %33)
br label %35
35: ; preds = %32, %17
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"ufw_blacklist.e\00"
@.str.1 = [18 x i8] c"ufw_blacklist.dat\00"
@.str.2 = [18 x i8] c"ufw_whitelist.dat\00"
@.str.3 = [8 x i8] c"sort -n\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %1
%6 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0)
%9 = tail call i32* @popen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32* @fopen_path(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %21, label %12
12: ; preds = %2
%13 = call i64 @get_line(i8* %4, i32* %10)
%14 = icmp eq i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %12, %15
%16 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%17 = call i64 @get_line(i8* %4, i32* %10)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %15
19: ; preds = %15, %12
%20 = call i32 @pclose(i32* %9)
br label %21
21: ; preds = %19, %2
ret i32 0
}