#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 addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
};
typedef int /*<<< orphan*/ hints;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int EOF;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ command(int, char *, char *, ...);
int /*<<< orphan*/ connect(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ getaddrinfo(char *, char *, struct addrinfo *,
                               struct addrinfo **);
int getopt(int, char **, char *);
char *malloc(int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
char *optarg;
int parse(int, char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  char *buffer = NULL;
  char *nick = NULL;
  char *channel = NULL;
  char *host = NULL;
  char *port = NULL;
  int ch;
  int connection;
  struct addrinfo hints, *res;
  while ((ch = getopt(argc, argv, "n:c:h:p:")) != EOF) {
    switch (ch) {
    case 'n':
      nick = optarg;
      break;
    case 'c':
      channel = optarg;
      break;
    case 'h':
      host = optarg;
      break;
    case 'p':
      port = optarg;
      break;
    default:
      usage();
      return 0;
    }
  }
  if (!channel) {
    usage();
    return 0;
  }
  if (!host) {
    usage();
    return 0;
  }
  if (!nick) {
    if (!(nick = malloc(5))) {
      return 1;
    }
    strcat(nick, "sBot");
  }
  if (!port) {
    if (!(port = malloc(5))) {
      return 1;
    }
    strcat(port, "6667");
  }
  printf("Connecting to %s:%s as %s.\n", host, port, nick);
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_INET;
  hints.ai_socktype = SOCK_STREAM;
  getaddrinfo(host, port, &hints, &res);
  connection = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
  if (connection == -1) {
    return 1;
  }
  connect(connection, res->ai_addr, res->ai_addrlen);
  printf("Assigning nick: %s\n", nick);
  command(connection, "USER %s 0 0 :%s\r\n", nick, nick);
  command(connection, "NICK %s\r\n", nick);
  if (!(buffer = malloc(1024))) {
    return 1;
  }
  while (read(connection, buffer, 1024) > 0) {
    switch (parse(connection, buffer)) {
    case 1:
      printf("\nPONGed");
    default:
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe2c(%rip),%rdx
call   1090 <getopt@plt>
mov    %eax,-0x3c(%rbp)
mov    0x2dbd(%rip),%rcx
cmp    (%rcx),%eax
je     12b0 <main+0xf0>
mov    -0x3c(%rbp),%eax
add    $0xffffff9d,%eax
mov    %eax,%ecx
mov    %rcx,-0x68(%rbp)
sub    $0xd,%eax
ja     1298 <main+0xd8>
mov    -0x68(%rbp),%rax
lea    0xdbd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2da5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    12ab <main+0xeb>
mov    0x2d92(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    12ab <main+0xeb>
mov    0x2d7f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    12ab <main+0xeb>
mov    0x2d6c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    12ab <main+0xeb>
mov    $0x0,%al
call   1080 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    14c6 <main+0x306>
jmp    11fe <main+0x3e>
cmpq   $0x0,-0x28(%rbp)
jne    12ce <main+0x10e>
mov    $0x0,%al
call   1080 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    14c6 <main+0x306>
cmpq   $0x0,-0x30(%rbp)
jne    12ec <main+0x12c>
mov    $0x0,%al
call   1080 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    14c6 <main+0x306>
cmpq   $0x0,-0x20(%rbp)
jne    132b <main+0x16b>
mov    $0x5,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    131b <main+0x15b>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x306>
mov    -0x20(%rbp),%rdi
lea    0xd1b(%rip),%rsi
call   10a0 <strcat@plt>
cmpq   $0x0,-0x38(%rbp)
jne    136a <main+0x1aa>
mov    $0x5,%edi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    135a <main+0x19a>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x306>
mov    -0x38(%rbp),%rdi
lea    0xce1(%rip),%rsi
call   10a0 <strcat@plt>
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xcce(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x58(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1050 <memset@plt>
mov    0x2c45(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2c21(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
lea    -0x58(%rbp),%rdx
lea    -0x60(%rbp),%rcx
call   10d0 <getaddrinfo@plt>
mov    -0x60(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x60(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x60(%rbp),%rax
mov    0x8(%rax),%edx
call   10e0 <socket@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0xffffffff,-0x40(%rbp)
jne    13f4 <main+0x234>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x306>
mov    -0x40(%rbp),%edi
mov    -0x60(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x60(%rbp),%rax
mov    (%rax),%edx
call   10c0 <connect@plt>
mov    -0x20(%rbp),%rsi
lea    0xc53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x40(%rbp),%edi
mov    -0x20(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xc4e(%rip),%rsi
mov    $0x0,%al
call   1030 <command@plt>
mov    -0x40(%rbp),%edi
mov    -0x20(%rbp),%rdx
lea    0xc4b(%rip),%rsi
mov    $0x0,%al
call   1030 <command@plt>
mov    $0x400,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    146d <main+0x2ad>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x306>
jmp    1472 <main+0x2b2>
mov    -0x40(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0x400,%edx
call   1060 <read@plt>
cmp    $0x0,%rax
jle    14bf <main+0x2ff>
mov    -0x40(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   10b0 <parse@plt>
sub    $0x1,%eax
jne    14b5 <main+0x2f5>
jmp    14a7 <main+0x2e7>
lea    0xbe9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14ba <main+0x2fa>
jmp    1472 <main+0x2b2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe5e(%rip),%rdx
call   1090 <getopt@plt>
mov    0x2df2(%rip),%r14
cmp    (%r14),%eax
jne    1207 <main+0x47>
xor    %r15d,%r15d
xor    %eax,%eax
call   1080 <usage@plt>
mov    %r15d,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ecx,%ecx
mov    %rcx,0x10(%rsp)
lea    0xdeb(%rip),%r15
mov    0x2ddc(%rip),%r12
lea    0xe15(%rip),%r13
xor    %ecx,%ecx
mov    %rcx,0x8(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x20(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x18(%rsp)
jmp    125b <main+0x9b>
nopw   0x0(%rax,%rax,1)
mov    (%r12),%rax
mov    %rax,0x10(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1090 <getopt@plt>
cmp    (%r14),%eax
je     129b <main+0xdb>
add    $0xffffff9d,%eax
cmp    $0xd,%eax
ja     11eb <main+0x2b>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
mov    (%r12),%rax
mov    %rax,0x20(%rsp)
jmp    1249 <main+0x89>
nopw   0x0(%rax,%rax,1)
mov    (%r12),%rax
mov    %rax,0x8(%rsp)
jmp    1249 <main+0x89>
nopl   0x0(%rax,%rax,1)
mov    (%r12),%rax
mov    %rax,0x18(%rsp)
jmp    1249 <main+0x89>
cmpq   $0x0,0x20(%rsp)
je     11eb <main+0x2b>
cmpq   $0x0,0x8(%rsp)
je     11eb <main+0x2b>
mov    0x18(%rsp),%r12
test   %r12,%r12
mov    0x10(%rsp),%rbx
je     12ee <main+0x12e>
test   %rbx,%rbx
jne    1318 <main+0x158>
mov    $0x5,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     145f <main+0x29f>
mov    %rax,%rbx
lea    0xd62(%rip),%rsi
mov    %rax,%rdi
call   10a0 <strcat@plt>
jmp    1318 <main+0x158>
mov    $0x5,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     145f <main+0x29f>
mov    %rax,%r12
lea    0xd36(%rip),%rsi
mov    %rax,%rdi
call   10a0 <strcat@plt>
test   %rbx,%rbx
je     12c7 <main+0x107>
lea    0xd2c(%rip),%rdi
mov    0x8(%rsp),%rbp
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x30(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1050 <memset@plt>
mov    0x2c91(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x40(%rsp)
mov    0x2c6c(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x3c(%rsp)
lea    0x28(%rsp),%rcx
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   10d0 <getaddrinfo@plt>
mov    0x28(%rsp),%rax
mov    0x10(%rax),%edi
mov    0x8(%rax),%edx
mov    0xc(%rax),%esi
call   10e0 <socket@plt>
mov    $0x1,%r15d
cmp    $0xffffffff,%eax
je     11f5 <main+0x35>
mov    %eax,%ebx
mov    0x28(%rsp),%rax
mov    (%rax),%edx
mov    0x4(%rax),%esi
mov    %ebx,%edi
call   10c0 <connect@plt>
lea    0xcb6(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xcb9(%rip),%rsi
mov    %ebx,%edi
mov    %r12,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1030 <command@plt>
lea    0xcb5(%rip),%rsi
mov    %ebx,%edi
mov    %r12,%rdx
xor    %eax,%eax
call   1030 <command@plt>
mov    $0x400,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     11f5 <main+0x35>
mov    %rax,%rbp
mov    %ebx,%edi
mov    %rax,%rsi
mov    $0x400,%edx
call   1060 <read@plt>
mov    $0x0,%r15d
test   %rax,%rax
jle    11f5 <main+0x35>
lea    0xc78(%rip),%r14
jmp    1444 <main+0x284>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0x400,%edx
call   1060 <read@plt>
test   %rax,%rax
jle    146a <main+0x2aa>
mov    %ebx,%edi
mov    %rbp,%rsi
call   10b0 <parse@plt>
cmp    $0x1,%eax
jne    1430 <main+0x270>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1430 <main+0x270>
mov    $0x1,%r15d
jmp    11f5 <main+0x35>
xor    %r15d,%r15d
jmp    11f5 <main+0x35>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i32, i32, i32 }
@.str = [9 x i8] c"n:c:h:p:\00"
@EOF = global i32 0
@optarg = global i8* null
@.str.1 = [5 x i8] c"sBot\00"
@.str.2 = [5 x i8] c"6667\00"
@.str.3 = [28 x i8] c"Connecting to %s:%s as %s.\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.4 = [20 x i8] c"Assigning nick: %s\0A\00"
@.str.5 = [18 x i8] c"USER %s 0 0 :%s\0D\0A\00"
@.str.6 = [10 x i8] c"NICK %s\0D\0A\00"
@.str.7 = [8 x i8] c"\0APONGed\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 i32
%12 = alloca i32
%13 = alloca %struct.addrinfo
%14 = alloca %struct.addrinfo*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i8* null, i8** %8
store i8* null, i8** %9
store i8* null, i8** %10
br label %15
15: ; preds = %33, %2
%16 = load i32, i32* %4
%17 = load i8**, i8*** %5
%18 = call i32 @getopt(i32 %16, i8** %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 %18, i32* %11
%19 = load i32, i32* @EOF
%20 = icmp ne i32 %18, %19
br i1 %20, label %21, label %34
21: ; preds = %15
%22 = load i32, i32* %11
switch i32 %22, label %31 [
i32 110, label %23
i32 99, label %25
i32 104, label %27
i32 112, label %29
]
23: ; preds = %21
%24 = load i8*, i8** @optarg
store i8* %24, i8** %7
br label %33
25: ; preds = %21
%26 = load i8*, i8** @optarg
store i8* %26, i8** %8
br label %33
27: ; preds = %21
%28 = load i8*, i8** @optarg
store i8* %28, i8** %9
br label %33
29: ; preds = %21
%30 = load i8*, i8** @optarg
store i8* %30, i8** %10
br label %33
31: ; preds = %21
%32 = call i32 (...) @usage()
store i32 0, i32* %3
br label %126
33: ; preds = %29, %27, %25, %23
br label %15
34: ; preds = %15
%35 = load i8*, i8** %8
%36 = icmp ne i8* %35, null
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = call i32 (...) @usage()
store i32 0, i32* %3
br label %126
39: ; preds = %34
%40 = load i8*, i8** %9
%41 = icmp ne i8* %40, null
br i1 %41, label %44, label %42
42: ; preds = %39
%43 = call i32 (...) @usage()
store i32 0, i32* %3
br label %126
44: ; preds = %39
%45 = load i8*, i8** %7
%46 = icmp ne i8* %45, null
br i1 %46, label %54, label %47
47: ; preds = %44
%48 = call i8* @malloc(i32 5)
store i8* %48, i8** %7
%49 = icmp ne i8* %48, null
br i1 %49, label %51, label %50
50: ; preds = %47
store i32 1, i32* %3
br label %126
51: ; preds = %47
%52 = load i8*, i8** %7
%53 = call i32 @strcat(i8* %52, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %54
54: ; preds = %51, %44
%55 = load i8*, i8** %10
%56 = icmp ne i8* %55, null
br i1 %56, label %64, label %57
57: ; preds = %54
%58 = call i8* @malloc(i32 5)
store i8* %58, i8** %10
%59 = icmp ne i8* %58, null
br i1 %59, label %61, label %60
60: ; preds = %57
store i32 1, i32* %3
br label %126
61: ; preds = %57
%62 = load i8*, i8** %10
%63 = call i32 @strcat(i8* %62, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %64
64: ; preds = %61, %54
%65 = load i8*, i8** %9
%66 = load i8*, i8** %10
%67 = load i8*, i8** %7
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %65, i8* %66, i8* %67)
%69 = call i32 @memset(%struct.addrinfo* %13, i32 0, i32 20)
%70 = load i32, i32* @AF_INET
%71 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %13, i32 0, i32 4
store i32 %70, i32* %71
%72 = load i32, i32* @SOCK_STREAM
%73 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %13, i32 0, i32 3
store i32 %72, i32* %73
%74 = load i8*, i8** %9
%75 = load i8*, i8** %10
%76 = call i32 @getaddrinfo(i8* %74, i8* %75, %struct.addrinfo* %13, %struct.addrinfo** %14)
%77 = load %struct.addrinfo*, %struct.addrinfo** %14
%78 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %77, i32 0, i32 4
%79 = load i32, i32* %78
%80 = load %struct.addrinfo*, %struct.addrinfo** %14
%81 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %80, i32 0, i32 3
%82 = load i32, i32* %81
%83 = load %struct.addrinfo*, %struct.addrinfo** %14
%84 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %83, i32 0, i32 2
%85 = load i32, i32* %84
%86 = call i32 @socket(i32 %79, i32 %82, i32 %85)
store i32 %86, i32* %12
%87 = load i32, i32* %12
%88 = icmp eq i32 %87, -1
br i1 %88, label %89, label %90
89: ; preds = %64
store i32 1, i32* %3
br label %126
90: ; preds = %64
%91 = load i32, i32* %12
%92 = load %struct.addrinfo*, %struct.addrinfo** %14
%93 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %92, i32 0, i32 1
%94 = load i32, i32* %93
%95 = load %struct.addrinfo*, %struct.addrinfo** %14
%96 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %95, i32 0, i32 0
%97 = load i32, i32* %96
%98 = call i32 @connect(i32 %91, i32 %94, i32 %97)
%99 = load i8*, i8** %7
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %99)
%101 = load i32, i32* %12
%102 = load i8*, i8** %7
%103 = load i8*, i8** %7
%104 = call i32 (i32, i8*, i8*, ...) @command(i32 %101, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %102, i8* %103)
%105 = load i32, i32* %12
%106 = load i8*, i8** %7
%107 = call i32 (i32, i8*, i8*, ...) @command(i32 %105, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %106)
%108 = call i8* @malloc(i32 1024)
store i8* %108, i8** %6
%109 = icmp ne i8* %108, null
br i1 %109, label %111, label %110
110: ; preds = %90
store i32 1, i32* %3
br label %126
111: ; preds = %90
br label %112
112: ; preds = %124, %111
%113 = load i32, i32* %12
%114 = load i8*, i8** %6
%115 = call i64 @read(i32 %113, i8* %114, i32 1024)
%116 = icmp sgt i64 %115, 0
br i1 %116, label %117, label %125
117: ; preds = %112
%118 = load i32, i32* %12
%119 = load i8*, i8** %6
%120 = call i32 @parse(i32 %118, i8* %119)
switch i32 %120, label %123 [
i32 1, label %121
]
121: ; preds = %117
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %123
123: ; preds = %117, %121
br label %124
124: ; preds = %123
br label %112
125: ; preds = %112
store i32 0, i32* %3
br label %126
126: ; preds = %125, %110, %89, %60, %50, %42, %37, %31
%127 = load i32, i32* %3
ret i32 %127
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, i32, i32 }
@.str = [9 x i8] c"n:c:h:p:\00"
@EOF = global i32 0
@optarg = global i8* null
@.str.1 = [5 x i8] c"sBot\00"
@.str.2 = [5 x i8] c"6667\00"
@.str.3 = [28 x i8] c"Connecting to %s:%s as %s.\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.4 = [20 x i8] c"Assigning nick: %s\0A\00"
@.str.5 = [18 x i8] c"USER %s 0 0 :%s\0D\0A\00"
@.str.6 = [10 x i8] c"NICK %s\0D\0A\00"
@.str.7 = [8 x i8] c"\0APONGed\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = bitcast %struct.addrinfo* %3 to i8*
%6 = bitcast %struct.addrinfo** %4 to i8*
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %92, label %10
10: ; preds = %2, %24
%11 = phi i32 [ %29, %24 ], [ %7, %2 ]
%12 = phi i8* [ %28, %24 ], [ null, %2 ]
%13 = phi i8* [ %27, %24 ], [ null, %2 ]
%14 = phi i8* [ %26, %24 ], [ null, %2 ]
%15 = phi i8* [ %25, %24 ], [ null, %2 ]
switch i32 %11, label %92 [
i32 110, label %16
i32 99, label %18
i32 104, label %20
i32 112, label %22
]
16: ; preds = %10
%17 = load i8*, i8** @optarg
br label %24
18: ; preds = %10
%19 = load i8*, i8** @optarg
br label %24
20: ; preds = %10
%21 = load i8*, i8** @optarg
br label %24
22: ; preds = %10
%23 = load i8*, i8** @optarg
br label %24
24: ; preds = %22, %20, %18, %16
%25 = phi i8* [ %15, %22 ], [ %15, %20 ], [ %15, %18 ], [ %17, %16 ]
%26 = phi i8* [ %14, %22 ], [ %14, %20 ], [ %19, %18 ], [ %14, %16 ]
%27 = phi i8* [ %13, %22 ], [ %21, %20 ], [ %13, %18 ], [ %13, %16 ]
%28 = phi i8* [ %23, %22 ], [ %12, %20 ], [ %12, %18 ], [ %12, %16 ]
%29 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%30 = load i32, i32* @EOF
%31 = icmp eq i32 %29, %30
br i1 %31, label %32, label %10
32: ; preds = %24
%33 = icmp eq i8* %26, null
%34 = icmp eq i8* %27, null
%35 = select i1 %33, i1 true, i1 %34
br i1 %35, label %92, label %36
36: ; preds = %32
%37 = icmp eq i8* %25, null
br i1 %37, label %38, label %43
38: ; preds = %36
%39 = tail call dereferenceable_or_null(5) i8* @malloc(i32 5)
%40 = icmp eq i8* %39, null
br i1 %40, label %94, label %41
41: ; preds = %38
%42 = tail call i32 @strcat(i8* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %43
43: ; preds = %41, %36
%44 = phi i8* [ %25, %36 ], [ %39, %41 ]
%45 = icmp eq i8* %28, null
br i1 %45, label %46, label %51
46: ; preds = %43
%47 = tail call dereferenceable_or_null(5) i8* @malloc(i32 5)
%48 = icmp eq i8* %47, null
br i1 %48, label %94, label %49
49: ; preds = %46
%50 = tail call i32 @strcat(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %51
51: ; preds = %49, %43
%52 = phi i8* [ %28, %43 ], [ %47, %49 ]
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %27, i8* %52, i8* %44)
%54 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 20)
%55 = load i32, i32* @AF_INET
%56 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %55, i32* %56
%57 = load i32, i32* @SOCK_STREAM
%58 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %57, i32* %58
%59 = call i32 @getaddrinfo(i8* %27, i8* %52, %struct.addrinfo* %3, %struct.addrinfo** %4)
%60 = load %struct.addrinfo*, %struct.addrinfo** %4
%61 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %60, i64 0, i32 4
%62 = load i32, i32* %61
%63 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %60, i64 0, i32 3
%64 = load i32, i32* %63
%65 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %60, i64 0, i32 2
%66 = load i32, i32* %65
%67 = call i32 @socket(i32 %62, i32 %64, i32 %66)
%68 = icmp eq i32 %67, -1
br i1 %68, label %94, label %69
69: ; preds = %51
%70 = load %struct.addrinfo*, %struct.addrinfo** %4
%71 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %70, i64 0, i32 1
%72 = load i32, i32* %71
%73 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %70, i64 0, i32 0
%74 = load i32, i32* %73
%75 = call i32 @connect(i32 %67, i32 %72, i32 %74)
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %44)
%77 = call i32 (i32, i8*, i8*, ...) @command(i32 %67, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %44, i8* %44)
%78 = call i32 (i32, i8*, i8*, ...) @command(i32 %67, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %44)
%79 = call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%80 = icmp eq i8* %79, null
br i1 %80, label %94, label %81
81: ; preds = %69
%82 = call i64 @read(i32 %67, i8* %79, i32 1024)
%83 = icmp sgt i64 %82, 0
br i1 %83, label %84, label %94
84: ; preds = %81, %89
%85 = call i32 @parse(i32 %67, i8* %79)
%86 = icmp eq i32 %85, 1
br i1 %86, label %87, label %89
87: ; preds = %84
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %89
89: ; preds = %87, %84
%90 = call i64 @read(i32 %67, i8* %79, i32 1024)
%91 = icmp sgt i64 %90, 0
br i1 %91, label %84, label %94
92: ; preds = %10, %32, %2
%93 = tail call i32 (...) @usage()
br label %94
94: ; preds = %89, %92, %81, %69, %51, %46, %38
%95 = phi i32 [ 1, %38 ], [ 1, %46 ], [ 1, %51 ], [ 1, %69 ], [ 0, %81 ], [ 0, %92 ], [ 0, %89 ]
ret i32 %95
}