#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 */

/* Variables and functions */
int /*<<< orphan*/ exit_status(int, char *);
scalar_t__ feof(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int fread(char *, unsigned long, int, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
char *getenv(char *);
char *malloc(unsigned long);
int /*<<< orphan*/ print_status(int, char *);
int /*<<< orphan*/ send_to_daemon(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
scalar_t__ strchr(char *, char);
scalar_t__ strcmp(char const *, char *);
unsigned long strtoul(char const *, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  const char *request_method = getenv("REQUEST_METHOD");
  const char *content_length = getenv("CONTENT_LENGTH");
  const char *content_type = getenv("CONTENT_TYPE");
  unsigned long length, n;
  char *buffer;
  if (argc > 1 && !strcmp(argv[1], "--version") && !request_method) {
    fputs("ppipnhd"
          " ("
          "payproc"
          ") "
          "Mar 18 2022"
          "\n",
          stdout);
    return 0;
  }
  if (!request_method || strcmp(request_method, "POST"))
    exit_status(501, "Only POST allowed");
  length = content_length ? strtoul(content_length, NULL, 10) : 0;
  if (!length)
    exit_status(411, "Content-Length missing");
  if (length >= (64 * 1024))
    exit_status(413, "Payload too large");
  if (!content_type || !*content_type)
    exit_status(400, "Content-type missing");
  buffer = malloc(length + 1);
  if (!buffer)
    exit_status(503, "Service currently unavailable");
  if (fread(buffer, length, 1, stdin) != 1)
    exit_status(400, feof(stdin) ? "Payload shorter than indicated"
                                 : "Error reading payload");
  buffer[length] = 0;
  for (n = 0; n < length; n++) {
    if (!buffer[n])
      exit_status(400, "Binary data in payload not allowed");
    if (strchr(" \t\r\n", buffer[n]))
      exit_status(400, "Whitespaces in payload not allowed");
  }
  send_to_daemon(buffer);
  free(buffer);
  print_status(200, "OK");
  fputs("Content-Type: text/plain\r\n\r\n", stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe23(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
lea    0xe22(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
lea    0xe21(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x28(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    125a <main+0x9a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe0c(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    125a <main+0x9a>
cmpq   $0x0,-0x18(%rbp)
jne    125a <main+0x9a>
mov    0x2d98(%rip),%rax
mov    (%rax),%esi
lea    0xdec(%rip),%rdi
call   1080 <fputs@plt>
movl   $0x0,-0x4(%rbp)
jmp    147c <main+0x2bc>
cmpq   $0x0,-0x18(%rbp)
je     127f <main+0xbf>
mov    -0x18(%rbp),%rdi
lea    0xde4(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     1290 <main+0xd0>
mov    $0x1f5,%edi
lea    0xdce(%rip),%rsi
call   1070 <exit_status@plt>
cmpq   $0x0,-0x20(%rbp)
je     12b6 <main+0xf6>
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    %rax,-0x48(%rbp)
jmp    12c1 <main+0x101>
xor    %eax,%eax
mov    %rax,-0x48(%rbp)
jmp    12c1 <main+0x101>
mov    -0x48(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12e5 <main+0x125>
mov    $0x19b,%edi
lea    0xd8b(%rip),%rsi
call   1070 <exit_status@plt>
cmpq   $0x10000,-0x30(%rbp)
jb     1304 <main+0x144>
mov    $0x19d,%edi
lea    0xd83(%rip),%rsi
call   1070 <exit_status@plt>
cmpq   $0x0,-0x28(%rbp)
je     131c <main+0x15c>
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
jne    132d <main+0x16d>
mov    $0x190,%edi
lea    0xd6c(%rip),%rsi
call   1070 <exit_status@plt>
mov    -0x30(%rbp),%rdi
add    $0x1,%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    135a <main+0x19a>
mov    $0x1f7,%edi
lea    0xd54(%rip),%rsi
call   1070 <exit_status@plt>
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    0x2c7f(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
call   1050 <fread@plt>
cmp    $0x1,%eax
je     13af <main+0x1ef>
mov    0x2c63(%rip),%rax
mov    (%rax),%edi
call   10b0 <feof@plt>
mov    %rax,%rcx
lea    0xd50(%rip),%rsi
lea    0xd2a(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
mov    $0x190,%edi
call   1070 <exit_status@plt>
mov    -0x40(%rbp),%rax
mov    -0x30(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    143d <main+0x27d>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
jne    13f4 <main+0x234>
mov    $0x190,%edi
lea    0xd0d(%rip),%rsi
call   1070 <exit_status@plt>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
lea    0xd1c(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
je     1427 <main+0x267>
mov    $0x190,%edi
lea    0xd02(%rip),%rsi
call   1070 <exit_status@plt>
jmp    142c <main+0x26c>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    13c3 <main+0x203>
mov    -0x40(%rbp),%rdi
call   10e0 <send_to_daemon@plt>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    $0xc8,%edi
lea    0xcec(%rip),%rsi
call   1090 <print_status@plt>
mov    0x2b71(%rip),%rax
mov    (%rax),%esi
lea    0xcda(%rip),%rdi
call   1080 <fputs@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %edi,%ebp
lea    0xe29(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
lea    0xe29(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r14
lea    0xe29(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r15
cmp    $0x2,%ebp
jl     1229 <main+0x69>
mov    0x8(%r12),%rdi
lea    0xe1d(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rbx,%rbx
jne    1229 <main+0x69>
test   %rax,%rax
jne    1229 <main+0x69>
lea    0xe11(%rip),%rdi
jmp    13b9 <main+0x1f9>
test   %rbx,%rbx
je     1242 <main+0x82>
lea    0xe1f(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1253 <main+0x93>
lea    0xe10(%rip),%rsi
mov    $0x1f5,%edi
call   1070 <exit_status@plt>
test   %r14,%r14
je     128f <main+0xcf>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
test   %rax,%rax
je     128f <main+0xcf>
mov    %rax,%r14
cmp    $0x10000,%rax
jb     1288 <main+0xc8>
lea    0xe04(%rip),%rsi
mov    $0x19d,%edi
call   1070 <exit_status@plt>
test   %r15,%r15
jne    12a8 <main+0xe8>
jmp    12ae <main+0xee>
lea    0xdd5(%rip),%rsi
mov    $0x19b,%edi
call   1070 <exit_status@plt>
xor    %r14d,%r14d
test   %r15,%r15
je     12ae <main+0xee>
cmpb   $0x0,(%r15)
jne    12bf <main+0xff>
lea    0xddf(%rip),%rsi
mov    $0x190,%edi
call   1070 <exit_status@plt>
lea    0x1(%r14),%rdi
call   10c0 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    12e1 <main+0x121>
lea    0xdd2(%rip),%rsi
mov    $0x1f7,%edi
call   1070 <exit_status@plt>
mov    0x2d00(%rip),%rbp
mov    0x0(%rbp),%ecx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1050 <fread@plt>
cmp    $0x1,%eax
je     1327 <main+0x167>
mov    0x0(%rbp),%edi
call   10b0 <feof@plt>
test   %rax,%rax
lea    0xdd4(%rip),%rax
lea    0xdae(%rip),%rsi
cmove  %rax,%rsi
mov    $0x190,%edi
call   1070 <exit_status@plt>
movb   $0x0,(%rbx,%r14,1)
test   %r14,%r14
je     1391 <main+0x1d1>
xor    %ebp,%ebp
lea    0xdc2(%rip),%r15
lea    0xdde(%rip),%r12
lea    0xddc(%rip),%r13
jmp    1359 <main+0x199>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%r14
je     1391 <main+0x1d1>
movzbl (%rbx,%rbp,1),%eax
test   %al,%al
jne    1372 <main+0x1b2>
mov    $0x190,%edi
mov    %r15,%rsi
call   1070 <exit_status@plt>
movzbl (%rbx,%rbp,1),%eax
movsbl %al,%esi
mov    %r12,%rdi
call   1060 <strchr@plt>
test   %rax,%rax
je     1350 <main+0x190>
mov    $0x190,%edi
mov    %r13,%rsi
call   1070 <exit_status@plt>
jmp    1350 <main+0x190>
mov    %rbx,%rdi
call   10e0 <send_to_daemon@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
lea    0xd9f(%rip),%rsi
mov    $0xc8,%edi
call   1090 <print_status@plt>
lea    0xd91(%rip),%rdi
mov    0x2c18(%rip),%rax
mov    (%rax),%esi
call   1080 <fputs@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"REQUEST_METHOD\00"
@.str.1 = [15 x i8] c"CONTENT_LENGTH\00"
@.str.2 = [13 x i8] c"CONTENT_TYPE\00"
@.str.3 = [10 x i8] c"--version\00"
@.str.4 = [31 x i8] c"ppipnhd (payproc) Mar 18 2022\0A\00"
@stdout = global i32 0
@.str.5 = [5 x i8] c"POST\00"
@.str.6 = [18 x i8] c"Only POST allowed\00"
@.str.7 = [23 x i8] c"Content-Length missing\00"
@.str.8 = [18 x i8] c"Payload too large\00"
@.str.9 = [21 x i8] c"Content-type missing\00"
@.str.10 = [30 x i8] c"Service currently unavailable\00"
@stdin = global i32 0
@.str.11 = [31 x i8] c"Payload shorter than indicated\00"
@.str.12 = [22 x i8] c"Error reading payload\00"
@.str.13 = [35 x i8] c"Binary data in payload not allowed\00"
@.str.14 = [5 x i8] c" \09\0D\0A\00"
@.str.15 = [35 x i8] c"Whitespaces in payload not allowed\00"
@.str.16 = [3 x i8] c"OK\00"
@.str.17 = [29 x i8] c"Content-Type: text/plain\0D\0A\0D\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i8* %12, i8** %6
%13 = call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i8* %13, i8** %7
%14 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i8* %14, i8** %8
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 1
br i1 %16, label %17, label %29
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp ne i64 %21, 0
br i1 %22, label %29, label %23
23: ; preds = %17
%24 = load i8*, i8** %6
%25 = icmp ne i8* %24, null
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = load i32, i32* @stdout
%28 = call i32 @fputs(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %27)
store i32 0, i32* %3
br label %123
29: ; preds = %23, %17, %2
%30 = load i8*, i8** %6
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i8*, i8** %6
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %32, %29
%37 = call i32 @exit_status(i32 501, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %38
38: ; preds = %36, %32
%39 = load i8*, i8** %7
%40 = icmp ne i8* %39, null
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i8*, i8** %7
%43 = call i64 @strtoul(i8* %42, i32* null, i32 10)
br label %45
44: ; preds = %38
br label %45
45: ; preds = %44, %41
%46 = phi i64 [ %43, %41 ], [ 0, %44 ]
store i64 %46, i64* %9
%47 = load i64, i64* %9
%48 = icmp ne i64 %47, 0
br i1 %48, label %51, label %49
49: ; preds = %45
%50 = call i32 @exit_status(i32 411, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
br label %51
51: ; preds = %49, %45
%52 = load i64, i64* %9
%53 = icmp uge i64 %52, 65536
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = call i32 @exit_status(i32 413, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
br label %56
56: ; preds = %54, %51
%57 = load i8*, i8** %8
%58 = icmp ne i8* %57, null
br i1 %58, label %59, label %63
59: ; preds = %56
%60 = load i8*, i8** %8
%61 = load i8, i8* %60
%62 = icmp ne i8 %61, 0
br i1 %62, label %65, label %63
63: ; preds = %59, %56
%64 = call i32 @exit_status(i32 400, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
br label %65
65: ; preds = %63, %59
%66 = load i64, i64* %9
%67 = add i64 %66, 1
%68 = call i8* @malloc(i64 %67)
store i8* %68, i8** %11
%69 = load i8*, i8** %11
%70 = icmp ne i8* %69, null
br i1 %70, label %73, label %71
71: ; preds = %65
%72 = call i32 @exit_status(i32 503, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0))
br label %73
73: ; preds = %71, %65
%74 = load i8*, i8** %11
%75 = load i64, i64* %9
%76 = load i32, i32* @stdin
%77 = call i32 @fread(i8* %74, i64 %75, i32 1, i32 %76)
%78 = icmp ne i32 %77, 1
br i1 %78, label %79, label %86
79: ; preds = %73
%80 = load i32, i32* @stdin
%81 = call i64 @feof(i32 %80)
%82 = icmp ne i64 %81, 0
%83 = zext i1 %82 to i64
%84 = select i1 %82, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0)
%85 = call i32 @exit_status(i32 400, i8* %84)
br label %86
86: ; preds = %79, %73
%87 = load i8*, i8** %11
%88 = load i64, i64* %9
%89 = getelementptr inbounds i8, i8* %87, i64 %88
store i8 0, i8* %89
store i64 0, i64* %10
br label %90
90: ; preds = %112, %86
%91 = load i64, i64* %10
%92 = load i64, i64* %9
%93 = icmp ult i64 %91, %92
br i1 %93, label %94, label %115
94: ; preds = %90
%95 = load i8*, i8** %11
%96 = load i64, i64* %10
%97 = getelementptr inbounds i8, i8* %95, i64 %96
%98 = load i8, i8* %97
%99 = icmp ne i8 %98, 0
br i1 %99, label %102, label %100
100: ; preds = %94
%101 = call i32 @exit_status(i32 400, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0))
br label %102
102: ; preds = %100, %94
%103 = load i8*, i8** %11
%104 = load i64, i64* %10
%105 = getelementptr inbounds i8, i8* %103, i64 %104
%106 = load i8, i8* %105
%107 = call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8 signext %106)
%108 = icmp ne i64 %107, 0
br i1 %108, label %109, label %111
109: ; preds = %102
%110 = call i32 @exit_status(i32 400, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.15, i64 0, i64 0))
br label %111
111: ; preds = %109, %102
br label %112
112: ; preds = %111
%113 = load i64, i64* %10
%114 = add i64 %113, 1
store i64 %114, i64* %10
br label %90
115: ; preds = %90
%116 = load i8*, i8** %11
%117 = call i32 @send_to_daemon(i8* %116)
%118 = load i8*, i8** %11
%119 = call i32 @free(i8* %118)
%120 = call i32 @print_status(i32 200, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0))
%121 = load i32, i32* @stdout
%122 = call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.17, i64 0, i64 0), i32 %121)
store i32 0, i32* %3
br label %123
123: ; preds = %115, %26
%124 = load i32, i32* %3
ret i32 %124
}

LLVM IR (-O2):
@.str = [15 x i8] c"REQUEST_METHOD\00"
@.str.1 = [15 x i8] c"CONTENT_LENGTH\00"
@.str.2 = [13 x i8] c"CONTENT_TYPE\00"
@.str.3 = [10 x i8] c"--version\00"
@.str.4 = [31 x i8] c"ppipnhd (payproc) Mar 18 2022\0A\00"
@stdout = global i32 0
@.str.5 = [5 x i8] c"POST\00"
@.str.6 = [18 x i8] c"Only POST allowed\00"
@.str.7 = [23 x i8] c"Content-Length missing\00"
@.str.8 = [18 x i8] c"Payload too large\00"
@.str.9 = [21 x i8] c"Content-type missing\00"
@.str.10 = [30 x i8] c"Service currently unavailable\00"
@stdin = global i32 0
@.str.11 = [31 x i8] c"Payload shorter than indicated\00"
@.str.12 = [22 x i8] c"Error reading payload\00"
@.str.13 = [35 x i8] c"Binary data in payload not allowed\00"
@.str.14 = [5 x i8] c" \09\0D\0A\00"
@.str.15 = [35 x i8] c"Whitespaces in payload not allowed\00"
@.str.16 = [3 x i8] c"OK\00"
@.str.17 = [29 x i8] c"Content-Type: text/plain\0D\0A\0D\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = tail call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
%12 = icmp ne i8* %3, null
%13 = or i1 %12, %11
br i1 %13, label %14, label %80
14: ; preds = %7, %2
%15 = icmp eq i8* %3, null
br i1 %15, label %19, label %16
16: ; preds = %14
%17 = tail call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16, %14
%20 = tail call i32 @exit_status(i32 501, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %21
21: ; preds = %19, %16
%22 = icmp eq i8* %4, null
br i1 %22, label %26, label %23
23: ; preds = %21
%24 = tail call i64 @strtoul(i8* nocapture %4, i32* null, i32 10)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23, %21
%27 = tail call i32 @exit_status(i32 411, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
br label %32
28: ; preds = %23
%29 = icmp ugt i64 %24, 65535
br i1 %29, label %30, label %32
30: ; preds = %28
%31 = tail call i32 @exit_status(i32 413, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
br label %32
32: ; preds = %26, %30, %28
%33 = phi i64 [ 0, %26 ], [ %24, %30 ], [ %24, %28 ]
%34 = icmp eq i8* %5, null
br i1 %34, label %38, label %35
35: ; preds = %32
%36 = load i8, i8* %5
%37 = icmp eq i8 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35, %32
%39 = tail call i32 @exit_status(i32 400, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
br label %40
40: ; preds = %38, %35
%41 = add i64 %33, 1
%42 = tail call i8* @malloc(i64 %41)
%43 = icmp eq i8* %42, null
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = tail call i32 @exit_status(i32 503, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0))
br label %46
46: ; preds = %44, %40
%47 = load i32, i32* @stdin
%48 = tail call i32 @fread(i8* %42, i64 %33, i32 1, i32 %47)
%49 = icmp eq i32 %48, 1
br i1 %49, label %56, label %50
50: ; preds = %46
%51 = load i32, i32* @stdin
%52 = tail call i64 @feof(i32 %51)
%53 = icmp eq i64 %52, 0
%54 = select i1 %53, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0)
%55 = tail call i32 @exit_status(i32 400, i8* %54)
br label %56
56: ; preds = %50, %46
%57 = getelementptr inbounds i8, i8* %42, i64 %33
store i8 0, i8* %57
%58 = icmp eq i64 %33, 0
br i1 %58, label %76, label %59
59: ; preds = %56, %73
%60 = phi i64 [ %74, %73 ], [ 0, %56 ]
%61 = getelementptr inbounds i8, i8* %42, i64 %60
%62 = load i8, i8* %61
%63 = icmp eq i8 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %59
%65 = tail call i32 @exit_status(i32 400, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0))
%66 = load i8, i8* %61
br label %67
67: ; preds = %64, %59
%68 = phi i8 [ %66, %64 ], [ %62, %59 ]
%69 = tail call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8 signext %68)
%70 = icmp eq i64 %69, 0
br i1 %70, label %73, label %71
71: ; preds = %67
%72 = tail call i32 @exit_status(i32 400, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.15, i64 0, i64 0))
br label %73
73: ; preds = %67, %71
%74 = add nuw i64 %60, 1
%75 = icmp eq i64 %74, %33
br i1 %75, label %76, label %59
76: ; preds = %73, %56
%77 = tail call i32 @send_to_daemon(i8* %42)
%78 = tail call i32 @free(i8* %42)
%79 = tail call i32 @print_status(i32 200, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0))
br label %80
80: ; preds = %7, %76
%81 = phi i8* [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.17, i64 0, i64 0), %76 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), %7 ]
%82 = load i32, i32* @stdout
%83 = tail call i32 @fputs(i8* %81, i32 %82)
ret i32 0
}