#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 tm {
  int dummy;
};
struct timeval {
  int member_0;
  int /*<<< orphan*/ member_1;
  int /*<<< orphan*/ tv_sec;
};
struct pproxy_connection_handle {
  int dummy;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ pproxy_conn_insert_pause(struct pproxy_connection_handle *,
                                            struct timeval *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
void connectCallback(struct pproxy_connection_handle *handle) {
  struct timeval tv;
  struct tm *tm;
  char buf[64];
  gettimeofday(&tv, NULL);
  tm = localtime(&tv.tv_sec);
  strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
  fprintf(stderr, "%s: pausing post-CONNECT for 30 seconds...\n", buf);
  struct timeval pause = {30, 0};
  pproxy_conn_insert_pause(handle, &pause);
}


x86 assembly (clang, -O0):
<connectCallback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
lea    -0x18(%rbp),%rdi
add    $0x8,%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x40,%esi
lea    0xe72(%rip),%rdx
call   1070 <strftime@plt>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    -0x60(%rbp),%rdx
lea    0xe6e(%rip),%rsi
call   1060 <fprintf@plt>
mov    0xe91(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xe8f(%rip),%eax
mov    %eax,-0x68(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1040 <pproxy_conn_insert_pause@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<connectCallback>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rdi,%r14
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
lea    0x18(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xe89(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
mov    %rax,%rcx
call   1070 <strftime@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    0xe79(%rip),%rsi
mov    %rbx,%rdx
call   1060 <fprintf@plt>
mov    0xea2(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xe8f(%rip),%rax
mov    %rax,(%rsp)
mov    %rsp,%rsi
mov    %r14,%rdi
call   1040 <pproxy_conn_insert_pause@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32, i32 }
%struct.pproxy_connection_handle = type { i32 }
%struct.tm = type { i32 }
@.str = [21 x i8] c"%Y-%m-%d %H:%M:%S %Z\00"
@stderr = global i32 0
@.str.1 = [44 x i8] c"%s: pausing post-CONNECT for 30 seconds...\0A\00"
@__const.connectCallback.pause = %struct.timeval { i32 30, i32 0, i32 0 }
define void @connectCallback(%struct.pproxy_connection_handle* %0) {
%2 = alloca %struct.pproxy_connection_handle*
%3 = alloca %struct.timeval
%4 = alloca %struct.tm*
%5 = alloca [64 x i8]
%6 = alloca %struct.timeval
store %struct.pproxy_connection_handle* %0, %struct.pproxy_connection_handle** %2
%7 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 2
%9 = call %struct.tm* @localtime(i32* %8)
store %struct.tm* %9, %struct.tm** %4
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%11 = load %struct.tm*, %struct.tm** %4
%12 = call i32 @strftime(i8* %10, i32 64, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.tm* %11)
%13 = load i32, i32* @stderr
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%15 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = bitcast %struct.timeval* %6 to i8*
%17 = load %struct.pproxy_connection_handle*, %struct.pproxy_connection_handle** %2
%18 = call i32 @pproxy_conn_insert_pause(%struct.pproxy_connection_handle* %17, %struct.timeval* %6)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32, i32 }
%struct.pproxy_connection_handle = type { i32 }
%struct.tm = type { i32 }
@.str = [21 x i8] c"%Y-%m-%d %H:%M:%S %Z\00"
@stderr = global i32 0
@.str.1 = [44 x i8] c"%s: pausing post-CONNECT for 30 seconds...\0A\00"
@__const.connectCallback.pause = %struct.timeval { i32 30, i32 0, i32 0 }
define void @connectCallback(%struct.pproxy_connection_handle* %0) {
%2 = alloca %struct.timeval
%3 = alloca [64 x i8]
%4 = alloca %struct.timeval
%5 = bitcast %struct.timeval* %2 to i8*
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%7 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 2
%9 = call %struct.tm* @localtime(i32* %8)
%10 = call i32 @strftime(i8* %6, i32 64, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.tm* %9)
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%13 = bitcast %struct.timeval* %4 to i8*
%14 = call i32 @pproxy_conn_insert_pause(%struct.pproxy_connection_handle* %0, %struct.timeval* %4)
ret void
}