#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;
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gmtime_r(int /*<<< orphan*/ *, struct tm *);
int irc_notice(int, char const *, char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int on_user_time(int fd, __attribute__((unused)) const char *from,
                 const char *to, __attribute__((unused)) char *msg) {
  char buf[64];
  struct tm tm;
  time_t t;
  time(&t);
  gmtime_r(&t, &tm);
  strftime(buf, sizeof buf, "%a, %d %b %Y %H:%M:%S +0000", &tm);
  return irc_notice(fd, to, "the time is %s", buf);
}


x86 assembly (clang, -O0):
<on_user_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x6c(%rbp),%rdi
call   1040 <time@plt>
lea    -0x6c(%rbp),%rdi
lea    -0x68(%rbp),%rsi
call   1030 <gmtime_r@plt>
lea    -0x60(%rbp),%rdi
mov    $0x40,%esi
lea    0xe83(%rip),%rdx
lea    -0x68(%rbp),%rcx
call   1060 <strftime@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
lea    -0x60(%rbp),%rcx
lea    0xe84(%rip),%rdx
call   1050 <irc_notice@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<on_user_time>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rdx,%r14
mov    %edi,%ebp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <time@plt>
lea    0x8(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <gmtime_r@plt>
lea    0xe8d(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
mov    %r15,%rcx
call   1060 <strftime@plt>
lea    0xe8d(%rip),%rdx
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rcx
call   1050 <irc_notice@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [28 x i8] c"%a, %d %b %Y %H:%M:%S +0000\00"
@.str.1 = [15 x i8] c"the time is %s\00"
define i32 @on_user_time(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [64 x i8]
%10 = alloca %struct.tm
%11 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%12 = call i32 @time(i32* %11)
%13 = call i32 @gmtime_r(i32* %11, %struct.tm* %10)
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%15 = call i32 @strftime(i8* %14, i32 64, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), %struct.tm* %10)
%16 = load i32, i32* %5
%17 = load i8*, i8** %7
%18 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%19 = call i32 @irc_notice(i32 %16, i8* %17, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %18)
ret i32 %19
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [28 x i8] c"%a, %d %b %Y %H:%M:%S +0000\00"
@.str.1 = [15 x i8] c"the time is %s\00"
define i32 @on_user_time(i32 %0, i8* nocapture readnone %1, i8* %2, i8* nocapture readnone %3) {
%5 = alloca [64 x i8]
%6 = alloca %struct.tm
%7 = alloca i32
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%9 = bitcast %struct.tm* %6 to i8*
%10 = bitcast i32* %7 to i8*
%11 = call i32 @time(i32* %7)
%12 = call i32 @gmtime_r(i32* %7, %struct.tm* %6)
%13 = call i32 @strftime(i8* %8, i32 64, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
%14 = call i32 @irc_notice(i32 %0, i8* %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %8)
ret i32 %14
}