#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*/ do_exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ service_responder(char *);
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv, char **envp) {
  if (argc != 2) {
    fprintf(stdout, "Usage: service [portno]\n");
    do_exit(1);
  }
  srandom(time(NULL));
  service_responder(argv[1]);
  do_exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1193 <main+0x43>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1040 <do_exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <service_responder@plt>
xor    %edi,%edi
call   1040 <do_exit@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1178 <main+0x28>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
lea    0xe97(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1040 <do_exit@plt>
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
mov    0x8(%rbx),%rdi
call   1070 <service_responder@plt>
xor    %edi,%edi
call   1040 <do_exit@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [25 x i8] c"Usage: service [portno]\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i32, i32* @stdout
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @do_exit(i32 1)
br label %14
14: ; preds = %10, %3
%15 = call i32 @time(i32* null)
%16 = call i32 @srandom(i32 %15)
%17 = load i8**, i8*** %6
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @service_responder(i8* %19)
%21 = call i32 @do_exit(i32 0)
%22 = load i32, i32* %4
ret i32 %22
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [25 x i8] c"Usage: service [portno]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture readnone %2) {
%4 = icmp eq i32 %0, 2
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = load i32, i32* @stdout
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @do_exit(i32 1)
br label %9
9: ; preds = %5, %3
%10 = tail call i32 @time(i32* null)
%11 = tail call i32 @srandom(i32 %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @service_responder(i8* %13)
%15 = tail call i32 @do_exit(i32 0)
ret i32 0
}