#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 scalar_t__ time_t;
struct t_relay_weechat_msg {
  int dummy;
};
typedef int /*<<< orphan*/ str_time;

/* Variables and functions */
int /*<<< orphan*/ relay_weechat_msg_add_bytes(struct t_relay_weechat_msg *,
                                               ...);
int /*<<< orphan*/ snprintf(char *, int, char *, long long);
unsigned char strlen(char *);
void relay_weechat_msg_add_time(struct t_relay_weechat_msg *msg, time_t time) {
  char str_time[128];
  unsigned char length;
  snprintf(str_time, sizeof(str_time), "%lld", (long long)time);
  length = strlen(str_time);
  relay_weechat_msg_add_bytes(msg, &length, 1);
  relay_weechat_msg_add_bytes(msg, str_time, length);
}


x86 assembly (clang, -O0):
<relay_weechat_msg_add_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x80,%esi
lea    0xea6(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
mov    %al,-0x91(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x91(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1040 <relay_weechat_msg_add_bytes@plt>
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
movzbl -0x91(%rbp),%edx
mov    $0x0,%al
call   1040 <relay_weechat_msg_add_bytes@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<relay_weechat_msg_add_time>:
push   %r14
push   %rbx
sub    $0x98,%rsp
mov    %rsi,%rcx
mov    %rdi,%rbx
lea    0xeb9(%rip),%rdx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x80,%esi
call   1050 <snprintf@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %al,0xf(%rsp)
lea    0xf(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <relay_weechat_msg_add_bytes@plt>
movzbl 0xf(%rsp),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <relay_weechat_msg_add_bytes@plt>
add    $0x98,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.t_relay_weechat_msg = type { i32 }
@.str = [5 x i8] c"%lld\00"
define void @relay_weechat_msg_add_time(%struct.t_relay_weechat_msg* %0, i64 %1) {
%3 = alloca %struct.t_relay_weechat_msg*
%4 = alloca i64
%5 = alloca [128 x i8]
%6 = alloca i8
store %struct.t_relay_weechat_msg* %0, %struct.t_relay_weechat_msg** %3
store i64 %1, i64* %4
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%8 = load i64, i64* %4
%9 = call i32 @snprintf(i8* %7, i32 128, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %8)
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%11 = call zeroext i8 @strlen(i8* %10)
store i8 %11, i8* %6
%12 = load %struct.t_relay_weechat_msg*, %struct.t_relay_weechat_msg** %3
%13 = call i32 (%struct.t_relay_weechat_msg*, ...) @relay_weechat_msg_add_bytes(%struct.t_relay_weechat_msg* %12, i8* %6, i32 1)
%14 = load %struct.t_relay_weechat_msg*, %struct.t_relay_weechat_msg** %3
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%16 = load i8, i8* %6
%17 = zext i8 %16 to i32
%18 = call i32 (%struct.t_relay_weechat_msg*, ...) @relay_weechat_msg_add_bytes(%struct.t_relay_weechat_msg* %14, i8* %15, i32 %17)
ret void
}

LLVM IR (-O2):
%struct.t_relay_weechat_msg = type { i32 }
@.str = [5 x i8] c"%lld\00"
define void @relay_weechat_msg_add_time(%struct.t_relay_weechat_msg* %0, i64 %1) {
%3 = alloca [128 x i8]
%4 = alloca i8
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = call i32 @snprintf(i8* %5, i32 128, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %1)
%7 = call zeroext i8 @strlen(i8* %5)
store i8 %7, i8* %4
%8 = call i32 (%struct.t_relay_weechat_msg*, ...) @relay_weechat_msg_add_bytes(%struct.t_relay_weechat_msg* %0, i8* %4, i32 1)
%9 = load i8, i8* %4
%10 = zext i8 %9 to i32
%11 = call i32 (%struct.t_relay_weechat_msg*, ...) @relay_weechat_msg_add_bytes(%struct.t_relay_weechat_msg* %0, i8* %5, i32 %10)
ret void
}