#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 timespec {
  int tv_sec;
  scalar_t__ tv_nsec;
};
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ nanosleep(struct timespec *, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int write(int /*<<< orphan*/, char *, scalar_t__);
int main() {
  char input[65536 + 1];
  ssize_t len;
  struct timespec ts;
  char *crypt = "2002928\n-----BEGIN PGP MESSAGE-----\nVersion: GnuPG v1.4.9 "
                "(GNU/Linux)\n\nhQIOAzz6ltMxvh7UEAf/"
                "Xy60gF+"
                "WHzgZNyflPb8seVn7KjSdA5ojkIpUjnsf4Xhc\n66PgvVrQwyiyYZ6KFs2f4na"
                "BwdSUTYEa/YL+7Tsc5el1ipdYxwdVOzD9Iac1XG9G\nQDeByA/"
                "UHk4CJj171I0CCJvIeuA7Bjd6JEpjCaNatxL1AGeLEAL4fv7dGzKYYwNc\nFvy"
                "aIDMWtbbY1VVHmPg1yv7he1y0bTAN/"
                "PrDmlvcE5t7YNpQGixbF4mVWtys4zLi\nZIqculNyqd+BrBLB3tYbS7K/"
                "ixufYw2PdI4dWZ70bc0S0fK17gSjJI/l8DYIGV86\npqeon/"
                "18JjNjj64yf86tf0TZZbDr1320QeLpKWrnUgf/e7ceFNySjJg/"
                "ZxX5jXU5\neYYoFqM/h+uMBonssstQzpQcccinttR+zBcsaqbx6y8PxU/"
                "83Zu2pdhAHDcp3uo2\ndLitOKa5UDKBWbwxhym+"
                "l9MzNvrRTEE4ZyWnSuzWdPZBv39CkDC00pLb8AHCBWBU\ndBdCPPxznzPiA31a"
                "MiWRlmY+iZJ7oj2/"
                "4MTpSWfxLhVdGhos701xl8OuAzRIg0Xj\n9XWywzstNl7D3Gak4OqP+"
                "b7amzVLFHNjqcVMZ00qaz76Y+eO/"
                "hmPTlgzCrxtmxEm\n9ODn8w44RK9aiDdK6Mg5TnDZMENjLvDSWAfWznh34+"
                "Ah0dVnw7X3t7nTmljOjHMy\nI9JSARazAgS0KIQP8M/"
                "qYZMEOf22hBNYbNPBmfI3a7QQJGXqbGNTFPWqHtwu809W\nUQQpdMJCi/"
                "N7fhdVK2Rgws+fYN3qbX1XKG2jrxD1Yj0QbOU/KA==\n=pStt\n-----END "
                "PGP MESSAGE-----\n";
  read(STDIN_FILENO, input, 4);
  input[4] = '\0';
  fprintf(stderr, "dummy-LTP cmd: %s\n", input);
  read(STDIN_FILENO, input, 128);
  input[128] = '\0';
  fprintf(stderr, "dummy-LTP listens to url: %s\n", input);
  ts.tv_sec = 3;
  ts.tv_nsec = 0;
  nanosleep(&ts, NULL);
  len = write(STDOUT_FILENO, crypt, strlen(crypt));
  fprintf(stderr, "len=%ld\n", (long)strlen(crypt));
  while (1) {
    len = read(STDIN_FILENO, input, 65536 + 1);
    if (len < 0) {
      perror("tp/dummy/listen: read");
      return 1;
    }
    if (len > 65536) {
      fprintf(stderr, "Packet too big (%ld)!\n", (long)len);
      continue;
    }
    input[len] = '\0';
    fprintf(stderr, "dummy-LTP received command: %s (until first \\0)\n",
            input);
    if (!strncmp(input, "1002", 4)) {
      fprintf(stderr, "dummy/c: Time to say goodbye...\n");
      return 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10050,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rax
mov    %rax,-0x10030(%rbp)
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    -0x10010(%rbp),%rsi
mov    $0x4,%edx
call   1070 <read@plt>
movb   $0x0,-0x1000c(%rbp)
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    -0x10010(%rbp),%rdx
lea    0x11e1(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
lea    -0x10010(%rbp),%rsi
mov    $0x80,%edx
call   1070 <read@plt>
movb   $0x0,-0xff90(%rbp)
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
lea    -0x10010(%rbp),%rdx
lea    0x11b5(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x3,-0x10028(%rbp)
movq   $0x0,-0x10020(%rbp)
lea    -0x10028(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <nanosleep@plt>
mov    0x2db6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10044(%rbp)
mov    -0x10030(%rbp),%rax
mov    %rax,-0x10040(%rbp)
mov    -0x10030(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x10044(%rbp),%edi
mov    -0x10040(%rbp),%rsi
mov    %rax,%rdx
call   1040 <write@plt>
mov    %eax,-0x10014(%rbp)
mov    0x2d5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10034(%rbp)
mov    -0x10030(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x10034(%rbp),%edi
mov    %rax,%rdx
lea    0x1138(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
lea    -0x10010(%rbp),%rsi
mov    $0x10001,%edx
call   1070 <read@plt>
mov    %eax,-0x10014(%rbp)
cmpl   $0x0,-0x10014(%rbp)
jge    12ee <main+0x17e>
lea    0x1106(%rip),%rdi
call   1090 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1397 <main+0x227>
cmpl   $0x10000,-0x10014(%rbp)
jle    1321 <main+0x1b1>
mov    0x2cd3(%rip),%rax
mov    (%rax),%edi
movslq -0x10014(%rbp),%rdx
lea    0x10e4(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    12a9 <main+0x139>
movslq -0x10014(%rbp),%rax
movb   $0x0,-0x10010(%rbp,%rax,1)
mov    0x2ca1(%rip),%rax
mov    (%rax),%edi
lea    -0x10010(%rbp),%rdx
lea    0x10c9(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    -0x10010(%rbp),%rdi
lea    0x10e5(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1392 <main+0x222>
mov    0x2c62(%rip),%rax
mov    (%rax),%edi
lea    0x10c7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1397 <main+0x227>
jmp    12a9 <main+0x139>
mov    -0x4(%rbp),%eax
add    $0x10050,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10018,%rsp
mov    0x2e58(%rip),%r13
mov    0x0(%r13),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x4,%edx
call   1060 <read@plt>
movb   $0x0,0x14(%rsp)
mov    0x2e3e(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0x1205(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x0(%r13),%edi
mov    %rbx,%rsi
mov    $0x80,%edx
call   1060 <read@plt>
movb   $0x0,0x90(%rsp)
mov    0x0(%rbp),%edi
lea    0x11eb(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
movl   $0x3,(%rsp)
movq   $0x0,0x8(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1050 <nanosleep@plt>
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
lea    0xdfb(%rip),%rsi
mov    $0x3a8,%edx
call   1040 <write@plt>
mov    0x0(%rbp),%edi
lea    0x11c1(%rip),%rsi
mov    $0x3a8,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x0(%r13),%edi
mov    %rbx,%rsi
mov    $0x10001,%edx
call   1060 <read@plt>
test   %eax,%eax
js     12db <main+0x17b>
lea    0x11b4(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0x11bf(%rip),%r15
lea    0x11e9(%rip),%r12
jmp    1282 <main+0x122>
nopw   0x0(%rax,%rax,1)
mov    0x0(%rbp),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x0(%r13),%edi
mov    %rbx,%rsi
mov    $0x10001,%edx
call   1060 <read@plt>
test   %eax,%eax
js     12db <main+0x17b>
mov    %eax,%edx
cmp    $0x10001,%eax
jae    1260 <main+0x100>
movb   $0x0,0x10(%rsp,%rdx,1)
mov    0x0(%rbp),%edi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    126d <main+0x10d>
mov    0x0(%rbp),%edi
lea    0x1188(%rip),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %ebx,%eax
add    $0x10018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x1101(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%ebx
jmp    12c7 <main+0x167>

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
@.str = [937 x i8] c"2002928\0A-----BEGIN PGP MESSAGE-----\0AVersion: GnuPG v1.4.9 (GNU/Linux)\0A\0AhQIOAzz6ltMxvh7UEAf/Xy60gF+WHzgZNyflPb8seVn7KjSdA5ojkIpUjnsf4Xhc\0A66PgvVrQwyiyYZ6KFs2f4naBwdSUTYEa/YL+7Tsc5el1ipdYxwdVOzD9Iac1XG9G\0AQDeByA/UHk4CJj171I0CCJvIeuA7Bjd6JEpjCaNatxL1AGeLEAL4fv7dGzKYYwNc\0AFvyaIDMWtbbY1VVHmPg1yv7he1y0bTAN/PrDmlvcE5t7YNpQGixbF4mVWtys4zLi\0AZIqculNyqd+BrBLB3tYbS7K/ixufYw2PdI4dWZ70bc0S0fK17gSjJI/l8DYIGV86\0Apqeon/18JjNjj64yf86tf0TZZbDr1320QeLpKWrnUgf/e7ceFNySjJg/ZxX5jXU5\0AeYYoFqM/h+uMBonssstQzpQcccinttR+zBcsaqbx6y8PxU/83Zu2pdhAHDcp3uo2\0AdLitOKa5UDKBWbwxhym+l9MzNvrRTEE4ZyWnSuzWdPZBv39CkDC00pLb8AHCBWBU\0AdBdCPPxznzPiA31aMiWRlmY+iZJ7oj2/4MTpSWfxLhVdGhos701xl8OuAzRIg0Xj\0A9XWywzstNl7D3Gak4OqP+b7amzVLFHNjqcVMZ00qaz76Y+eO/hmPTlgzCrxtmxEm\0A9ODn8w44RK9aiDdK6Mg5TnDZMENjLvDSWAfWznh34+Ah0dVnw7X3t7nTmljOjHMy\0AI9JSARazAgS0KIQP8M/qYZMEOf22hBNYbNPBmfI3a7QQJGXqbGNTFPWqHtwu809W\0AUQQpdMJCi/N7fhdVK2Rgws+fYN3qbX1XKG2jrxD1Yj0QbOU/KA==\0A=pStt\0A-----END PGP MESSAGE-----\0A\00"
@STDIN_FILENO = global i32 0
@stderr = global i32 0
@.str.1 = [19 x i8] c"dummy-LTP cmd: %s\0A\00"
@.str.2 = [30 x i8] c"dummy-LTP listens to url: %s\0A\00"
@STDOUT_FILENO = global i32 0
@.str.3 = [9 x i8] c"len=%ld\0A\00"
@.str.4 = [22 x i8] c"tp/dummy/listen: read\00"
@.str.5 = [23 x i8] c"Packet too big (%ld)!\0A\00"
@.str.6 = [49 x i8] c"dummy-LTP received command: %s (until first \\0)\0A\00"
@.str.7 = [5 x i8] c"1002\00"
@.str.8 = [33 x i8] c"dummy/c: Time to say goodbye...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [65537 x i8]
%3 = alloca i32
%4 = alloca %struct.timespec
%5 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([937 x i8], [937 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = load i32, i32* @STDIN_FILENO
%7 = getelementptr inbounds [65537 x i8], [65537 x i8]* %2, i64 0, i64 0
%8 = call i32 @read(i32 %6, i8* %7, i32 4)
%9 = getelementptr inbounds [65537 x i8], [65537 x i8]* %2, i64 0, i64 4
store i8 0, i8* %9
%10 = load i32, i32* @stderr
%11 = getelementptr inbounds [65537 x i8], [65537 x i8]* %2, i64 0, i64 0
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = load i32, i32* @STDIN_FILENO
%14 = getelementptr inbounds [65537 x i8], [65537 x i8]* %2, i64 0, i64 0
%15 = call i32 @read(i32 %13, i8* %14, i32 128)
%16 = getelementptr inbounds [65537 x i8], [65537 x i8]* %2, i64 0, i64 128
store i8 0, i8* %16
%17 = load i32, i32* @stderr
%18 = getelementptr inbounds [65537 x i8], [65537 x i8]* %2, i64 0, i64 0
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 0
store i32 3, i32* %20
%21 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i32 0, i32 1
store i64 0, i64* %21
%22 = call i32 @nanosleep(%struct.timespec* %4, i32* null)
%23 = load i32, i32* @STDOUT_FILENO
%24 = load i8*, i8** %5
%25 = load i8*, i8** %5
%26 = call i64 @strlen(i8* %25)
%27 = call i32 @write(i32 %23, i8* %24, i64 %26)
store i32 %27, i32* %3
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %5
%30 = call i64 @strlen(i8* %29)
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 %30)
br label %32
32: ; preds = %0, %43, %61
%33 = load i32, i32* @STDIN_FILENO
%34 = getelementptr inbounds [65537 x i8], [65537 x i8]* %2, i64 0, i64 0
%35 = call i32 @read(i32 %33, i8* %34, i32 65537)
store i32 %35, i32* %3
%36 = load i32, i32* %3
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %32
%39 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %1
br label %62
40: ; preds = %32
%41 = load i32, i32* %3
%42 = icmp sgt i32 %41, 65536
br i1 %42, label %43, label %48
43: ; preds = %40
%44 = load i32, i32* @stderr
%45 = load i32, i32* %3
%46 = sext i32 %45 to i64
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i64 %46)
br label %32
48: ; preds = %40
%49 = load i32, i32* %3
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [65537 x i8], [65537 x i8]* %2, i64 0, i64 %50
store i8 0, i8* %51
%52 = load i32, i32* @stderr
%53 = getelementptr inbounds [65537 x i8], [65537 x i8]* %2, i64 0, i64 0
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0), i8* %53)
%55 = getelementptr inbounds [65537 x i8], [65537 x i8]* %2, i64 0, i64 0
%56 = call i32 @strncmp(i8* %55, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%57 = icmp ne i32 %56, 0
br i1 %57, label %61, label %58
58: ; preds = %48
%59 = load i32, i32* @stderr
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %1
br label %62
61: ; preds = %48
br label %32
62: ; preds = %58, %38
%63 = load i32, i32* %1
ret i32 %63
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
@.str = [937 x i8] c"2002928\0A-----BEGIN PGP MESSAGE-----\0AVersion: GnuPG v1.4.9 (GNU/Linux)\0A\0AhQIOAzz6ltMxvh7UEAf/Xy60gF+WHzgZNyflPb8seVn7KjSdA5ojkIpUjnsf4Xhc\0A66PgvVrQwyiyYZ6KFs2f4naBwdSUTYEa/YL+7Tsc5el1ipdYxwdVOzD9Iac1XG9G\0AQDeByA/UHk4CJj171I0CCJvIeuA7Bjd6JEpjCaNatxL1AGeLEAL4fv7dGzKYYwNc\0AFvyaIDMWtbbY1VVHmPg1yv7he1y0bTAN/PrDmlvcE5t7YNpQGixbF4mVWtys4zLi\0AZIqculNyqd+BrBLB3tYbS7K/ixufYw2PdI4dWZ70bc0S0fK17gSjJI/l8DYIGV86\0Apqeon/18JjNjj64yf86tf0TZZbDr1320QeLpKWrnUgf/e7ceFNySjJg/ZxX5jXU5\0AeYYoFqM/h+uMBonssstQzpQcccinttR+zBcsaqbx6y8PxU/83Zu2pdhAHDcp3uo2\0AdLitOKa5UDKBWbwxhym+l9MzNvrRTEE4ZyWnSuzWdPZBv39CkDC00pLb8AHCBWBU\0AdBdCPPxznzPiA31aMiWRlmY+iZJ7oj2/4MTpSWfxLhVdGhos701xl8OuAzRIg0Xj\0A9XWywzstNl7D3Gak4OqP+b7amzVLFHNjqcVMZ00qaz76Y+eO/hmPTlgzCrxtmxEm\0A9ODn8w44RK9aiDdK6Mg5TnDZMENjLvDSWAfWznh34+Ah0dVnw7X3t7nTmljOjHMy\0AI9JSARazAgS0KIQP8M/qYZMEOf22hBNYbNPBmfI3a7QQJGXqbGNTFPWqHtwu809W\0AUQQpdMJCi/N7fhdVK2Rgws+fYN3qbX1XKG2jrxD1Yj0QbOU/KA==\0A=pStt\0A-----END PGP MESSAGE-----\0A\00"
@STDIN_FILENO = global i32 0
@stderr = global i32 0
@.str.1 = [19 x i8] c"dummy-LTP cmd: %s\0A\00"
@.str.2 = [30 x i8] c"dummy-LTP listens to url: %s\0A\00"
@STDOUT_FILENO = global i32 0
@.str.3 = [9 x i8] c"len=%ld\0A\00"
@.str.4 = [22 x i8] c"tp/dummy/listen: read\00"
@.str.5 = [23 x i8] c"Packet too big (%ld)!\0A\00"
@.str.6 = [49 x i8] c"dummy-LTP received command: %s (until first \\0)\0A\00"
@.str.7 = [5 x i8] c"1002\00"
@.str.8 = [33 x i8] c"dummy/c: Time to say goodbye...\0A\00"
define i32 @main() {
%1 = alloca [65537 x i8]
%2 = alloca %struct.timespec
%3 = getelementptr inbounds [65537 x i8], [65537 x i8]* %1, i64 0, i64 0
%4 = bitcast %struct.timespec* %2 to i8*
%5 = load i32, i32* @STDIN_FILENO
%6 = call i32 @read(i32 %5, i8* %3, i32 4)
%7 = getelementptr inbounds [65537 x i8], [65537 x i8]* %1, i64 0, i64 4
store i8 0, i8* %7
%8 = load i32, i32* @stderr
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%10 = load i32, i32* @STDIN_FILENO
%11 = call i32 @read(i32 %10, i8* %3, i32 128)
%12 = getelementptr inbounds [65537 x i8], [65537 x i8]* %1, i64 0, i64 128
store i8 0, i8* %12
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%15 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i32 3, i32* %15
%16 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i64 0, i64* %16
%17 = call i32 @nanosleep(%struct.timespec* %2, i32* null)
%18 = load i32, i32* @STDOUT_FILENO
%19 = call i32 @write(i32 %18, i8* getelementptr inbounds ([937 x i8], [937 x i8]* @.str, i64 0, i64 0), i64 936)
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 936)
%22 = load i32, i32* @STDIN_FILENO
%23 = call i32 @read(i32 %22, i8* %3, i32 65537)
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %34, %0
%26 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %48
27: ; preds = %0, %34
%28 = phi i32 [ %36, %34 ], [ %23, %0 ]
%29 = icmp ugt i32 %28, 65536
br i1 %29, label %30, label %38
30: ; preds = %27
%31 = load i32, i32* @stderr
%32 = zext i32 %28 to i64
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i64 %32)
br label %34
34: ; preds = %30, %38
%35 = load i32, i32* @STDIN_FILENO
%36 = call i32 @read(i32 %35, i8* %3, i32 65537)
%37 = icmp slt i32 %36, 0
br i1 %37, label %25, label %27
38: ; preds = %27
%39 = zext i32 %28 to i64
%40 = getelementptr inbounds [65537 x i8], [65537 x i8]* %1, i64 0, i64 %39
store i8 0, i8* %40
%41 = load i32, i32* @stderr
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0), i8* %3)
%43 = call i32 @strncmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %34
45: ; preds = %38
%46 = load i32, i32* @stderr
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0))
br label %48
48: ; preds = %45, %25
%49 = phi i32 [ 1, %25 ], [ 0, %45 ]
ret i32 %49
}