#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*/ TCPdaytime(char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  char *host = "localhost";
  char *service = "daytime";
  switch (argc) {
  case 1:
    host = "localhost";
    break;
  case 3:
    service = argv[2];
  case 2:
    host = argv[1];
    break;
  default:
    fprintf(stderr, "usage: TCPdaytime [host [port]]\n");
    exit(1);
  }
  TCPdaytime(host, service);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeb2(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x1,%eax
je     1192 <main+0x62>
jmp    1170 <main+0x40>
mov    -0x24(%rbp),%eax
sub    $0x2,%eax
je     11ae <main+0x7e>
jmp    1181 <main+0x51>
mov    -0x24(%rbp),%eax
sub    $0x3,%eax
je     11a2 <main+0x72>
jmp    11bf <main+0x8f>
lea    0xe67(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11de <main+0xae>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    11de <main+0xae>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
lea    0xe43(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <TCPdaytime@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsi,%rax
lea    0xecf(%rip),%rsi
cmp    $0x1,%edi
je     1154 <main+0x24>
cmp    $0x2,%edi
je     114e <main+0x1e>
cmp    $0x3,%edi
jne    1167 <main+0x37>
mov    0x10(%rax),%rsi
mov    0x8(%rax),%rdi
jmp    115b <main+0x2b>
lea    0xea5(%rip),%rdi
call   1030 <TCPdaytime@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [8 x i8] c"daytime\00"
@stderr = global i32 0
@.str.2 = [33 x i8] c"usage: TCPdaytime [host [port]]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %7
%8 = load i32, i32* %4
switch i32 %8, label %18 [
i32 1, label %9
i32 3, label %10
i32 2, label %14
]
9: ; preds = %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %6
br label %22
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 2
%13 = load i8*, i8** %12
store i8* %13, i8** %7
br label %14
14: ; preds = %2, %10
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
store i8* %17, i8** %6
br label %22
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %14, %9
%23 = load i8*, i8** %6
%24 = load i8*, i8** %7
%25 = call i32 @TCPdaytime(i8* %23, i8* %24)
%26 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [8 x i8] c"daytime\00"
@stderr = global i32 0
@.str.2 = [33 x i8] c"usage: TCPdaytime [host [port]]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %10 [
i32 1, label %14
i32 3, label %3
i32 2, label %6
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 2
%5 = load i8*, i8** %4
br label %6
6: ; preds = %2, %3
%7 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %2 ], [ %5, %3 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
br label %14
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %2, %6
%15 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %2 ]
%16 = phi i8* [ %7, %6 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %2 ]
%17 = tail call i32 @TCPdaytime(i8* %15, i8* %16)
%18 = tail call i32 @exit(i32 0)
unreachable
}