#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ welcome;
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  void *sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ reference_char;
typedef int /*<<< orphan*/ reception_addr;
typedef int /*<<< orphan*/ hash;
typedef int /*<<< orphan*/ goodbye;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SHA1(char *, int, unsigned char *);
int SHA_DIGEST_LENGTH;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
void *htons(int);
scalar_t__ listen(int, int);
int /*<<< orphan*/ memcpy(char **, char *, int);
int /*<<< orphan*/ memset(char **, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
scalar_t__ read(int, char **, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ write(int, ...);
int main(int argc, char *argv[]) {
  char eins = 'd';
  char fluff = 'q';
  char du = 'a';
  char gtfo = 'x';
  char three = 't';
  char O_O = 's';
  char four = 'f';
  char T_T[] = "if you're looking here, you're doing it wrong!!!!";
  char go = 'i';
  char sechs = 'l';
  char set = 'e';
  char reference_char[7] = {0};
  int var = 507;
  var++;
  var++;
  char da_encode[90];
  unsigned char hash[SHA_DIGEST_LENGTH];
  memcpy(&reference_char, &eins, 1);
  memcpy(&reference_char + 1, &du, 1);
  memcpy(&reference_char + 2, &three, 1);
  memcpy(&reference_char + 3, &four, 1);
  memcpy(&reference_char + 4, &go, 1);
  memcpy(&reference_char + 5, &sechs, 1);
  memcpy(&reference_char + 6, &set, 1);
  struct sockaddr_in reception_addr;
  reception_addr.sin_family = AF_INET;
  if (argc != 2) {
    reception_addr.sin_port = htons(9001);
  } else if (argc == 2) {
    reception_addr.sin_port = htons((int)argv[1]);
  }
  reception_addr.sin_addr.s_addr = INADDR_ANY;
  SHA1(reference_char, sizeof(reference_char), hash);
  int reception_sock = 0;
  reception_sock = socket(AF_INET, SOCK_STREAM, 0);
  if (bind(reception_sock, (struct sockaddr *)&reception_addr,
           sizeof(reception_addr)) < 0) {
    perror("The internet sucks!");
    return -1;
  }
  int connected_socket = 0;
  struct sockaddr_in remote_sockadder;
  int remote_length = 0;
  char input_buffer[7] = {0};
  char welcome[] = "Password plz\n";
  char goodbye[] = "goodbye";
  int winrar = 0;
  while (1) {
    if (listen(reception_sock, 1) < 0) {
      perror("The internet is a bag of dicks!");
    }
    connected_socket = accept(
        reception_sock, (struct sockaddr *)&remote_sockadder, &remote_length);
    write(connected_socket, &welcome, sizeof(welcome));
    for (int i = 0; i < 7; i++) {
      if (read(connected_socket, &input_buffer + i, 1) < 0) {
        continue;
      }
      if (input_buffer[i] != reference_char[i]) {
        write(connected_socket, &goodbye, sizeof(goodbye));
        close(connected_socket);
        memset(&input_buffer, 0, 7);
        break;
      }
      winrar = 1;
    }
    if (winrar == 1) {
      write(connected_socket, &hash, sizeof(hash));
      write(connected_socket, "\n", 1);
      winrar = 0;
      memset(&input_buffer, 0, 7);
      close(connected_socket);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x64,-0x11(%rbp)
movb   $0x71,-0x12(%rbp)
movb   $0x61,-0x13(%rbp)
movb   $0x78,-0x14(%rbp)
movb   $0x74,-0x15(%rbp)
movb   $0x73,-0x16(%rbp)
movb   $0x66,-0x17(%rbp)
movaps 0xe24(%rip),%xmm0
movaps %xmm0,-0x30(%rbp)
movaps 0xe09(%rip),%xmm0
movaps %xmm0,-0x40(%rbp)
movaps 0xdee(%rip),%xmm0
movaps %xmm0,-0x50(%rbp)
movw   $0x21,-0x20(%rbp)
movb   $0x69,-0x51(%rbp)
movb   $0x6c,-0x52(%rbp)
movb   $0x65,-0x53(%rbp)
movl   $0x0,-0x59(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x1fb,-0x60(%rbp)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    0x2d8a(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x148(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0xc8(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x140(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xd0(%rbp)
lea    -0x5c(%rbp),%rdi
lea    -0x11(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
lea    -0x5c(%rbp),%rdi
add    $0x7,%rdi
lea    -0x13(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
lea    -0x5c(%rbp),%rdi
add    $0xe,%rdi
lea    -0x15(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
lea    -0x5c(%rbp),%rdi
add    $0x15,%rdi
lea    -0x17(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
lea    -0x5c(%rbp),%rdi
add    $0x1c,%rdi
lea    -0x51(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
lea    -0x5c(%rbp),%rdi
add    $0x23,%rdi
lea    -0x52(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
lea    -0x5c(%rbp),%rdi
add    $0x2a,%rdi
lea    -0x53(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
mov    0x2cc0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xd8(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1350 <main+0x190>
mov    $0x2329,%edi
call   1040 <htons@plt>
mov    %rax,-0xe0(%rbp)
jmp    1375 <main+0x1b5>
cmpl   $0x2,-0x8(%rbp)
jne    1370 <main+0x1b0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %eax,%edi
call   1040 <htons@plt>
mov    %rax,-0xe0(%rbp)
jmp    1375 <main+0x1b5>
mov    -0x140(%rbp),%rdx
mov    0x2c55(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xe8(%rbp)
lea    -0x5c(%rbp),%rdi
mov    $0x7,%esi
call   10b0 <SHA1@plt>
movl   $0x0,-0xec(%rbp)
mov    0x2c3e(%rip),%rax
mov    (%rax),%edi
mov    0x2c15(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0xec(%rbp)
mov    -0xec(%rbp),%edi
lea    -0xe8(%rbp),%rsi
mov    $0x18,%edx
call   10a0 <bind@plt>
cmp    $0x0,%rax
jge    1408 <main+0x248>
lea    0xc48(%rip),%rdi
call   10c0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0xc8(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret
movl   $0x0,-0xf0(%rbp)
movl   $0x0,-0x10c(%rbp)
lea    -0x113(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1050 <memset@plt>
mov    0xc10(%rip),%rax
mov    %rax,-0x121(%rbp)
mov    0xc0b(%rip),%eax
mov    %eax,-0x119(%rbp)
mov    0xc02(%rip),%ax
mov    %ax,-0x115(%rbp)
mov    0xbf6(%rip),%rax
mov    %rax,-0x129(%rbp)
movl   $0x0,-0x130(%rbp)
jmp    1474 <main+0x2b4>
mov    -0xec(%rbp),%edi
mov    $0x1,%esi
call   1090 <listen@plt>
cmp    $0x0,%rax
jge    149a <main+0x2da>
lea    0xbc7(%rip),%rdi
call   10c0 <perror@plt>
mov    -0xec(%rbp),%edi
lea    -0x108(%rbp),%rsi
lea    -0x10c(%rbp),%rdx
call   10d0 <accept@plt>
mov    %eax,-0xf0(%rbp)
mov    -0xf0(%rbp),%edi
lea    -0x121(%rbp),%rsi
mov    $0xe,%edx
mov    $0x0,%al
call   1030 <write@plt>
movl   $0x0,-0x134(%rbp)
cmpl   $0x7,-0x134(%rbp)
jge    159a <main+0x3da>
mov    -0xf0(%rbp),%edi
movslq -0x134(%rbp),%rax
lea    -0x113(%rbp),%rsi
imul   $0x7,%rax,%rax
add    %rax,%rsi
mov    $0x1,%edx
call   1070 <read@plt>
cmp    $0x0,%rax
jge    151d <main+0x35d>
jmp    1586 <main+0x3c6>
movslq -0x134(%rbp),%rax
movsbl -0x113(%rbp,%rax,1),%eax
ff
movslq -0x134(%rbp),%rcx
movsbl -0x5c(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     157c <main+0x3bc>
mov    -0xf0(%rbp),%edi
lea    -0x129(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    -0xf0(%rbp),%edi
call   1060 <close@plt>
lea    -0x113(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1050 <memset@plt>
jmp    159a <main+0x3da>
movl   $0x1,-0x130(%rbp)
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    14dc <main+0x31c>
cmpl   $0x1,-0x130(%rbp)
jne    1603 <main+0x443>
mov    -0x148(%rbp),%rdx
mov    -0x140(%rbp),%rsi
mov    -0xf0(%rbp),%edi
mov    $0x0,%al
call   1030 <write@plt>
mov    -0xf0(%rbp),%edi
lea    0xa83(%rip),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <write@plt>
movl   $0x0,-0x130(%rbp)
lea    -0x113(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1050 <memset@plt>
mov    -0xf0(%rbp),%edi
call   1060 <close@plt>
jmp    146f <main+0x2af>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%r14
mov    %edi,%r12d
mov    %rsp,%r15
movb   $0x64,-0x3f(%rbp)
movb   $0x61,-0x3e(%rbp)
movb   $0x74,-0x3d(%rbp)
movb   $0x66,-0x3c(%rbp)
movb   $0x69,-0x3b(%rbp)
movb   $0x6c,-0x3a(%rbp)
movb   $0x65,-0x39(%rbp)
movl   $0x0,-0x2d(%rbp)
movl   $0x0,-0x30(%rbp)
mov    0x2dd5(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rax,-0x58(%rbp)
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
lea    -0x30(%rbp),%rdi
lea    -0x3f(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
lea    -0x29(%rbp),%rdi
lea    -0x3e(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
lea    -0x22(%rbp),%rdi
lea    -0x3d(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
lea    -0x1b(%rbp),%rdi
lea    -0x3c(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
lea    -0x14(%rbp),%rdi
lea    -0x3b(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
lea    -0xd(%rbp),%rdi
lea    -0x3a(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
lea    -0x6(%rbp),%rdi
lea    -0x39(%rbp),%rsi
mov    $0x1,%edx
call   1080 <memcpy@plt>
mov    0x2d3d(%rip),%rbx
mov    (%rbx),%eax
mov    %eax,-0x78(%rbp)
mov    $0x2329,%edi
cmp    $0x2,%r12d
jne    12bf <main+0xff>
mov    0x8(%r14),%edi
call   1040 <htons@plt>
mov    %rax,-0x80(%rbp)
mov    0x2d09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x88(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x7,%esi
mov    -0x50(%rbp),%rdx
call   10b0 <SHA1@plt>
mov    (%rbx),%edi
mov    0x2cd6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,%ebx
lea    -0x88(%rbp),%rsi
mov    %eax,%edi
mov    $0x18,%edx
call   10a0 <bind@plt>
test   %rax,%rax
js     154b <main+0x38b>
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x35(%rbp)
movl   $0x0,-0x38(%rbp)
movabs $0xa7a6c70206472,%rax
mov    %rax,-0x6a(%rbp)
movabs $0x64726f7773736150,%rax
6f 72 64
mov    %rax,-0x70(%rbp)
movabs $0x657962646f6f67,%rax
mov    %rax,-0x60(%rbp)
lea    -0x38(%rbp),%r12
jmp    139f <main+0x1df>
xchg   %ax,%ax
mov    %r13d,%edi
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rdx
xor    %eax,%eax
call   1030 <write@plt>
mov    %r13d,%edi
lea    0xca4(%rip),%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <write@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1050 <memset@plt>
mov    %r13d,%edi
call   1060 <close@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1090 <listen@plt>
test   %rax,%rax
jns    13bc <main+0x1fc>
lea    0xc6b(%rip),%rdi
call   10c0 <perror@plt>
mov    %ebx,%edi
lea    -0xa0(%rbp),%rsi
lea    -0x44(%rbp),%rdx
call   10d0 <accept@plt>
mov    %eax,%r13d
xor    %r15d,%r15d
mov    $0xe,%edx
mov    %eax,%edi
lea    -0x70(%rbp),%rsi
xor    %eax,%eax
call   1030 <write@plt>
mov    %r13d,%edi
mov    %r12,%rsi
mov    $0x1,%edx
call   1070 <read@plt>
test   %rax,%rax
js     1411 <main+0x251>
movzbl -0x38(%rbp),%eax
xor    %r14d,%r14d
mov    $0x1,%r15d
cmp    -0x30(%rbp),%al
jne    1510 <main+0x350>
mov    %r13d,%edi
lea    -0x31(%rbp),%rsi
mov    $0x1,%edx
call   1070 <read@plt>
test   %rax,%rax
js     143d <main+0x27d>
movzbl -0x37(%rbp),%eax
mov    %r15d,%r14d
mov    $0x1,%r15d
cmp    -0x2f(%rbp),%al
jne    1510 <main+0x350>
mov    %r13d,%edi
lea    -0x2a(%rbp),%rsi
mov    $0x1,%edx
call   1070 <read@plt>
test   %rax,%rax
js     1469 <main+0x2a9>
movzbl -0x36(%rbp),%eax
mov    %r15d,%r14d
mov    $0x1,%r15d
cmp    -0x2e(%rbp),%al
jne    1510 <main+0x350>
mov    %r13d,%edi
lea    -0x23(%rbp),%rsi
mov    $0x1,%edx
call   1070 <read@plt>
test   %rax,%rax
js     1491 <main+0x2d1>
movzbl -0x35(%rbp),%eax
mov    %r15d,%r14d
mov    $0x1,%r15d
cmp    -0x2d(%rbp),%al
jne    1510 <main+0x350>
mov    %r13d,%edi
lea    -0x1c(%rbp),%rsi
mov    $0x1,%edx
call   1070 <read@plt>
test   %rax,%rax
js     14b9 <main+0x2f9>
movzbl -0x34(%rbp),%eax
mov    %r15d,%r14d
mov    $0x1,%r15d
cmp    -0x2c(%rbp),%al
jne    1510 <main+0x350>
mov    %r13d,%edi
lea    -0x15(%rbp),%rsi
mov    $0x1,%edx
call   1070 <read@plt>
test   %rax,%rax
js     14e1 <main+0x321>
movzbl -0x33(%rbp),%eax
mov    %r15d,%r14d
mov    $0x1,%r15d
cmp    -0x2b(%rbp),%al
jne    1510 <main+0x350>
mov    %r13d,%edi
lea    -0xe(%rbp),%rsi
mov    $0x1,%edx
call   1070 <read@plt>
test   %rax,%rax
js     153d <main+0x37d>
movzbl -0x32(%rbp),%eax
mov    %r15d,%r14d
cmp    -0x2a(%rbp),%al
je     1360 <main+0x1a0>
nopw   0x0(%rax,%rax,1)
mov    $0x8,%edx
mov    %r13d,%edi
lea    -0x60(%rbp),%rsi
xor    %eax,%eax
call   1030 <write@plt>
mov    %r13d,%edi
call   1060 <close@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1050 <memset@plt>
mov    %r14d,%r15d
test   %r15d,%r15d
je     139f <main+0x1df>
jmp    1360 <main+0x1a0>
lea    0xaae(%rip),%rdi
call   10c0 <perror@plt>
mov    %r15,%rsp
mov    $0xffffffff,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i8*, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@__const.main.T_T = [50 x i8] c"if you're looking here, you're doing it wrong!!!!\00"
@SHA_DIGEST_LENGTH = global i32 0
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@SOCK_STREAM = global i32 0
@.str = [20 x i8] c"The internet sucks!\00"
@__const.main.welcome = [14 x i8] c"Password plz\0A\00"
@__const.main.goodbye = [8 x i8] c"goodbye\00"
@.str.1 = [32 x i8] c"The internet is a bag of dicks!\00"
@.str.2 = [2 x i8] c"\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 i8
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
%13 = alloca [50 x i8]
%14 = alloca i8
%15 = alloca i8
%16 = alloca i8
%17 = alloca [7 x i8]
%18 = alloca i32
%19 = alloca [90 x i8]
%20 = alloca i8*
%21 = alloca i64
%22 = alloca %struct.sockaddr_in
%23 = alloca i32
%24 = alloca i32
%25 = alloca %struct.sockaddr_in
%26 = alloca i32
%27 = alloca [7 x i8]
%28 = alloca [14 x i8]
%29 = alloca [8 x i8]
%30 = alloca i32
%31 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 100, i8* %6
store i8 113, i8* %7
store i8 97, i8* %8
store i8 120, i8* %9
store i8 116, i8* %10
store i8 115, i8* %11
store i8 102, i8* %12
%32 = bitcast [50 x i8]* %13 to i8*
store i8 105, i8* %14
store i8 108, i8* %15
store i8 101, i8* %16
%33 = bitcast [7 x i8]* %17 to i8*
store i32 507, i32* %18
%34 = load i32, i32* %18
%35 = add nsw i32 %34, 1
store i32 %35, i32* %18
%36 = load i32, i32* %18
%37 = add nsw i32 %36, 1
store i32 %37, i32* %18
%38 = load i32, i32* @SHA_DIGEST_LENGTH
%39 = zext i32 %38 to i64
%40 = call i8* @llvm.stacksave()
store i8* %40, i8** %20
%41 = alloca i8, i64 %39
store i64 %39, i64* %21
%42 = bitcast [7 x i8]* %17 to i8**
%43 = call i32 @memcpy(i8** %42, i8* %6, i32 1)
%44 = getelementptr inbounds [7 x i8], [7 x i8]* %17, i64 1
%45 = bitcast [7 x i8]* %44 to i8**
%46 = call i32 @memcpy(i8** %45, i8* %8, i32 1)
%47 = getelementptr inbounds [7 x i8], [7 x i8]* %17, i64 2
%48 = bitcast [7 x i8]* %47 to i8**
%49 = call i32 @memcpy(i8** %48, i8* %10, i32 1)
%50 = getelementptr inbounds [7 x i8], [7 x i8]* %17, i64 3
%51 = bitcast [7 x i8]* %50 to i8**
%52 = call i32 @memcpy(i8** %51, i8* %12, i32 1)
%53 = getelementptr inbounds [7 x i8], [7 x i8]* %17, i64 4
%54 = bitcast [7 x i8]* %53 to i8**
%55 = call i32 @memcpy(i8** %54, i8* %14, i32 1)
%56 = getelementptr inbounds [7 x i8], [7 x i8]* %17, i64 5
%57 = bitcast [7 x i8]* %56 to i8**
%58 = call i32 @memcpy(i8** %57, i8* %15, i32 1)
%59 = getelementptr inbounds [7 x i8], [7 x i8]* %17, i64 6
%60 = bitcast [7 x i8]* %59 to i8**
%61 = call i32 @memcpy(i8** %60, i8* %16, i32 1)
%62 = load i32, i32* @AF_INET
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %22, i32 0, i32 2
store i32 %62, i32* %63
%64 = load i32, i32* %4
%65 = icmp ne i32 %64, 2
br i1 %65, label %66, label %69
66: ; preds = %2
%67 = call i8* @htons(i32 9001)
%68 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %22, i32 0, i32 1
store i8* %67, i8** %68
br label %80
69: ; preds = %2
%70 = load i32, i32* %4
%71 = icmp eq i32 %70, 2
br i1 %71, label %72, label %79
72: ; preds = %69
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 1
%75 = load i8*, i8** %74
%76 = ptrtoint i8* %75 to i32
%77 = call i8* @htons(i32 %76)
%78 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %22, i32 0, i32 1
store i8* %77, i8** %78
br label %79
79: ; preds = %72, %69
br label %80
80: ; preds = %79, %66
%81 = load i32, i32* @INADDR_ANY
%82 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %22, i32 0, i32 0
%83 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %82, i32 0, i32 0
store i32 %81, i32* %83
%84 = getelementptr inbounds [7 x i8], [7 x i8]* %17, i64 0, i64 0
%85 = call i32 @SHA1(i8* %84, i32 7, i8* %41)
store i32 0, i32* %23
%86 = load i32, i32* @AF_INET
%87 = load i32, i32* @SOCK_STREAM
%88 = call i32 @socket(i32 %86, i32 %87, i32 0)
store i32 %88, i32* %23
%89 = load i32, i32* %23
%90 = bitcast %struct.sockaddr_in* %22 to %struct.sockaddr*
%91 = call i64 @bind(i32 %89, %struct.sockaddr* %90, i32 24)
%92 = icmp slt i64 %91, 0
br i1 %92, label %93, label %97
93: ; preds = %80
%94 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
%95 = load i8*, i8** %20
%96 = load i32, i32* %3
ret i32 %96
97: ; preds = %80
store i32 0, i32* %24
store i32 0, i32* %26
%98 = bitcast [7 x i8]* %27 to i8*
%99 = bitcast [14 x i8]* %28 to i8*
%100 = bitcast [8 x i8]* %29 to i8*
store i32 0, i32* %30
br label %101
101: ; preds = %161, %97
br label %102
102: ; preds = %101
%103 = load i32, i32* %23
%104 = call i64 @listen(i32 %103, i32 1)
%105 = icmp slt i64 %104, 0
br i1 %105, label %106, label %108
106: ; preds = %102
%107 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %108
108: ; preds = %106, %102
%109 = load i32, i32* %23
%110 = bitcast %struct.sockaddr_in* %25 to %struct.sockaddr*
%111 = call i32 @accept(i32 %109, %struct.sockaddr* %110, i32* %26)
store i32 %111, i32* %24
%112 = load i32, i32* %24
%113 = call i32 (i32, ...) @write(i32 %112, [14 x i8]* %28, i64 14)
store i32 0, i32* %31
br label %114
114: ; preds = %146, %108
%115 = load i32, i32* %31
%116 = icmp slt i32 %115, 7
br i1 %116, label %117, label %149
117: ; preds = %114
%118 = load i32, i32* %24
%119 = load i32, i32* %31
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [7 x i8], [7 x i8]* %27, i64 %120
%122 = bitcast [7 x i8]* %121 to i8**
%123 = call i64 @read(i32 %118, i8** %122, i32 1)
%124 = icmp slt i64 %123, 0
br i1 %124, label %125, label %126
125: ; preds = %117
br label %146
126: ; preds = %117
%127 = load i32, i32* %31
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [7 x i8], [7 x i8]* %27, i64 0, i64 %128
%130 = load i8, i8* %129
%131 = sext i8 %130 to i32
%132 = load i32, i32* %31
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds [7 x i8], [7 x i8]* %17, i64 0, i64 %133
%135 = load i8, i8* %134
%136 = sext i8 %135 to i32
%137 = icmp ne i32 %131, %136
br i1 %137, label %138, label %145
138: ; preds = %126
%139 = load i32, i32* %24
%140 = call i32 (i32, ...) @write(i32 %139, [8 x i8]* %29, i64 8)
%141 = load i32, i32* %24
%142 = call i32 @close(i32 %141)
%143 = bitcast [7 x i8]* %27 to i8**
%144 = call i32 @memset(i8** %143, i32 0, i32 7)
br label %149
145: ; preds = %126
store i32 1, i32* %30
br label %146
146: ; preds = %145, %125
%147 = load i32, i32* %31
%148 = add nsw i32 %147, 1
store i32 %148, i32* %31
br label %114
149: ; preds = %138, %114
%150 = load i32, i32* %30
%151 = icmp eq i32 %150, 1
br i1 %151, label %152, label %161
152: ; preds = %149
%153 = load i32, i32* %24
%154 = call i32 (i32, ...) @write(i32 %153, i8* %41, i64 %39)
%155 = load i32, i32* %24
%156 = call i32 (i32, ...) @write(i32 %155, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
store i32 0, i32* %30
%157 = bitcast [7 x i8]* %27 to i8**
%158 = call i32 @memset(i8** %157, i32 0, i32 7)
%159 = load i32, i32* %24
%160 = call i32 @close(i32 %159)
br label %161
161: ; preds = %152, %149
br label %101
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i8*, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@SHA_DIGEST_LENGTH = global i32 0
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@SOCK_STREAM = global i32 0
@.str = [20 x i8] c"The internet sucks!\00"
@__const.main.welcome = [14 x i8] c"Password plz\0A\00"
@.str.1 = [32 x i8] c"The internet is a bag of dicks!\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = alloca [7 x i8]
%11 = alloca %struct.sockaddr_in
%12 = alloca %struct.sockaddr_in
%13 = alloca i32
%14 = alloca [7 x i8]
%15 = alloca [14 x i8]
%16 = alloca i64
store i8 100, i8* %3
store i8 97, i8* %4
store i8 116, i8* %5
store i8 102, i8* %6
store i8 105, i8* %7
store i8 108, i8* %8
store i8 101, i8* %9
%17 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 0
%18 = load i32, i32* @SHA_DIGEST_LENGTH
%19 = zext i32 %18 to i64
%20 = tail call i8* @llvm.stacksave()
%21 = alloca i8, i64 %19
%22 = bitcast [7 x i8]* %10 to i8**
%23 = call i32 @memcpy(i8** %22, i8* %3, i32 1)
%24 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 1
%25 = bitcast [7 x i8]* %24 to i8**
%26 = call i32 @memcpy(i8** %25, i8* %4, i32 1)
%27 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 2
%28 = bitcast [7 x i8]* %27 to i8**
%29 = call i32 @memcpy(i8** %28, i8* %5, i32 1)
%30 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 3
%31 = bitcast [7 x i8]* %30 to i8**
%32 = call i32 @memcpy(i8** %31, i8* %6, i32 1)
%33 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 4
%34 = bitcast [7 x i8]* %33 to i8**
%35 = call i32 @memcpy(i8** %34, i8* %7, i32 1)
%36 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 5
%37 = bitcast [7 x i8]* %36 to i8**
%38 = call i32 @memcpy(i8** %37, i8* %8, i32 1)
%39 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 6
%40 = bitcast [7 x i8]* %39 to i8**
%41 = call i32 @memcpy(i8** %40, i8* %9, i32 1)
%42 = bitcast %struct.sockaddr_in* %11 to i8*
%43 = load i32, i32* @AF_INET
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i64 0, i32 2
store i32 %43, i32* %44
%45 = icmp eq i32 %0, 2
br i1 %45, label %46, label %51
46: ; preds = %2
%47 = getelementptr inbounds i8*, i8** %1, i64 1
%48 = load i8*, i8** %47
%49 = ptrtoint i8* %48 to i64
%50 = trunc i64 %49 to i32
br label %51
51: ; preds = %2, %46
%52 = phi i32 [ %50, %46 ], [ 9001, %2 ]
%53 = call i8* @htons(i32 %52)
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i64 0, i32 1
store i8* %53, i8** %54
%55 = load i32, i32* @INADDR_ANY
%56 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i64 0, i32 0, i32 0
store i32 %55, i32* %56
%57 = call i32 @SHA1(i8* %17, i32 7, i8* %21)
%58 = load i32, i32* @AF_INET
%59 = load i32, i32* @SOCK_STREAM
%60 = call i32 @socket(i32 %58, i32 %59, i32 0)
%61 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%62 = call i64 @bind(i32 %60, %struct.sockaddr* %61, i32 24)
%63 = icmp slt i64 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %51
%65 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 -1
66: ; preds = %51
%67 = bitcast %struct.sockaddr_in* %12 to i8*
%68 = bitcast i32* %13 to i8*
store i32 0, i32* %13
%69 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 0, i64 0
%70 = getelementptr inbounds [14 x i8], [14 x i8]* %15, i64 0, i64 0
%71 = bitcast i64* %16 to i8*
store i64 28562436146556775, i64* %16
%72 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%73 = bitcast [7 x i8]* %14 to i8**
%74 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 1
%75 = bitcast [7 x i8]* %74 to i8**
%76 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 0, i64 1
%77 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 1
%78 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 2
%79 = bitcast [7 x i8]* %78 to i8**
%80 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 0, i64 2
%81 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 2
%82 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 3
%83 = bitcast [7 x i8]* %82 to i8**
%84 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 0, i64 3
%85 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 3
%86 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 4
%87 = bitcast [7 x i8]* %86 to i8**
%88 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 0, i64 4
%89 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 4
%90 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 5
%91 = bitcast [7 x i8]* %90 to i8**
%92 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 0, i64 5
%93 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 5
%94 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 6
%95 = bitcast [7 x i8]* %94 to i8**
%96 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 0, i64 6
%97 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 6
br label %98
98: ; preds = %173, %66
%99 = call i64 @listen(i32 %60, i32 1)
%100 = icmp slt i64 %99, 0
br i1 %100, label %101, label %103
101: ; preds = %98
%102 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %103
103: ; preds = %101, %98
%104 = call i32 @accept(i32 %60, %struct.sockaddr* %72, i32* %13)
%105 = call i32 (i32, ...) @write(i32 %104, [14 x i8]* %15, i64 14)
%106 = call i64 @read(i32 %104, i8** %73, i32 1)
%107 = icmp slt i64 %106, 0
br i1 %107, label %117, label %108
108: ; preds = %103
%109 = load i8, i8* %69
%110 = load i8, i8* %17
%111 = icmp eq i8 %109, %110
br i1 %111, label %117, label %112
112: ; preds = %161, %153, %145, %137, %129, %121, %108
%113 = phi i32 [ 0, %108 ], [ %118, %121 ], [ %126, %129 ], [ %134, %137 ], [ %142, %145 ], [ %150, %153 ], [ %158, %161 ]
%114 = call i32 (i32, ...) @write(i32 %104, i64* %16, i64 8)
%115 = call i32 @close(i32 %104)
%116 = call i32 @memset(i8** %73, i32 0, i32 7)
br label %165
117: ; preds = %108, %103
%118 = phi i32 [ 0, %103 ], [ 1, %108 ]
%119 = call i64 @read(i32 %104, i8** %75, i32 1)
%120 = icmp slt i64 %119, 0
br i1 %120, label %125, label %121
121: ; preds = %117
%122 = load i8, i8* %76
%123 = load i8, i8* %77
%124 = icmp eq i8 %122, %123
br i1 %124, label %125, label %112
125: ; preds = %121, %117
%126 = phi i32 [ %118, %117 ], [ 1, %121 ]
%127 = call i64 @read(i32 %104, i8** %79, i32 1)
%128 = icmp slt i64 %127, 0
br i1 %128, label %133, label %129
129: ; preds = %125
%130 = load i8, i8* %80
%131 = load i8, i8* %81
%132 = icmp eq i8 %130, %131
br i1 %132, label %133, label %112
133: ; preds = %129, %125
%134 = phi i32 [ %126, %125 ], [ 1, %129 ]
%135 = call i64 @read(i32 %104, i8** %83, i32 1)
%136 = icmp slt i64 %135, 0
br i1 %136, label %141, label %137
137: ; preds = %133
%138 = load i8, i8* %84
%139 = load i8, i8* %85
%140 = icmp eq i8 %138, %139
br i1 %140, label %141, label %112
141: ; preds = %137, %133
%142 = phi i32 [ %134, %133 ], [ 1, %137 ]
%143 = call i64 @read(i32 %104, i8** %87, i32 1)
%144 = icmp slt i64 %143, 0
br i1 %144, label %149, label %145
145: ; preds = %141
%146 = load i8, i8* %88
%147 = load i8, i8* %89
%148 = icmp eq i8 %146, %147
br i1 %148, label %149, label %112
149: ; preds = %145, %141
%150 = phi i32 [ %142, %141 ], [ 1, %145 ]
%151 = call i64 @read(i32 %104, i8** %91, i32 1)
%152 = icmp slt i64 %151, 0
br i1 %152, label %157, label %153
153: ; preds = %149
%154 = load i8, i8* %92
%155 = load i8, i8* %93
%156 = icmp eq i8 %154, %155
br i1 %156, label %157, label %112
157: ; preds = %153, %149
%158 = phi i32 [ %150, %149 ], [ 1, %153 ]
%159 = call i64 @read(i32 %104, i8** %95, i32 1)
%160 = icmp slt i64 %159, 0
br i1 %160, label %165, label %161
161: ; preds = %157
%162 = load i8, i8* %96
%163 = load i8, i8* %97
%164 = icmp eq i8 %162, %163
br i1 %164, label %168, label %112
165: ; preds = %157, %112
%166 = phi i32 [ %113, %112 ], [ %158, %157 ]
%167 = icmp eq i32 %166, 1
br i1 %167, label %168, label %173
168: ; preds = %161, %165
%169 = call i32 (i32, ...) @write(i32 %104, i8* %21, i64 %19)
%170 = call i32 (i32, ...) @write(i32 %104, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
%171 = call i32 @memset(i8** %73, i32 0, i32 7)
%172 = call i32 @close(i32 %104)
br label %173
173: ; preds = %168, %165
br label %98
}