#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 */
typedef int /*<<< orphan*/ time_t;
typedef int /*<<< orphan*/ ltime;

/* Variables and functions */
int /*<<< orphan*/ ip(char const *);
int /*<<< orphan*/ line();
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ number(unsigned int);
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ string(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void log_tcpopen(const char client[4], unsigned int port) {
  time_t t = 0;
  char ltime[21];
  time(&t);
  strftime(ltime, sizeof(ltime), "%b %d %Y %T", localtime(&t));
  string(ltime);
  string(" tcpopen ");
  ip(client);
  string(":");
  number(port);
  line();
}


x86 assembly (clang, -O0):
<log_tcpopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1050 <time@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%ecx
mov    $0x15,%esi
lea    0xe4e(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x30(%rbp),%rdi
call   1040 <string@plt>
lea    0xe45(%rip),%rdi
call   1040 <string@plt>
mov    -0x8(%rbp),%rdi
call   1090 <ip@plt>
lea    0xe3a(%rip),%rdi
call   1040 <string@plt>
mov    -0xc(%rbp),%edi
call   1060 <number@plt>
mov    $0x0,%al
call   1080 <line@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_tcpopen>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <time@plt>
mov    %rbp,%rdi
call   1030 <localtime@plt>
lea    0xe5e(%rip),%rdx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x15,%esi
mov    %eax,%ecx
call   1070 <strftime@plt>
mov    %rbp,%rdi
call   1040 <string@plt>
lea    0xe47(%rip),%rdi
call   1040 <string@plt>
mov    %rbx,%rdi
call   1090 <ip@plt>
lea    0xe3d(%rip),%rdi
call   1040 <string@plt>
mov    %r14d,%edi
call   1060 <number@plt>
xor    %eax,%eax
call   1080 <line@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%b %d %Y %T\00"
@.str.1 = [10 x i8] c" tcpopen \00"
@.str.2 = [2 x i8] c":\00"
define void @log_tcpopen(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca [21 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%7 = call i32 @time(i32* %5)
%8 = getelementptr inbounds [21 x i8], [21 x i8]* %6, i64 0, i64 0
%9 = call i32 @localtime(i32* %5)
%10 = call i32 @strftime(i8* %8, i32 21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [21 x i8], [21 x i8]* %6, i64 0, i64 0
%12 = call i32 @string(i8* %11)
%13 = call i32 @string(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%14 = load i8*, i8** %3
%15 = call i32 @ip(i8* %14)
%16 = call i32 @string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* %4
%18 = call i32 @number(i32 %17)
%19 = call i32 (...) @line()
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%b %d %Y %T\00"
@.str.1 = [10 x i8] c" tcpopen \00"
@.str.2 = [2 x i8] c":\00"
define void @log_tcpopen(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca [21 x i8]
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%7 = call i32 @time(i32* %3)
%8 = call i32 @localtime(i32* %3)
%9 = call i32 @strftime(i8* %6, i32 21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @string(i8* %6)
%11 = call i32 @string(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @ip(i8* %0)
%13 = call i32 @string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @number(i32 %1)
%15 = call i32 (...) @line()
ret void
}