#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 tm_year;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
  int /*<<< orphan*/ tm_mon;
  int /*<<< orphan*/ tm_wday;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, int, int,
                           int, int, int);
char *switch_month(int /*<<< orphan*/);
char *switch_wday(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void module_time(char *s) {
  time_t rawtime;
  struct tm *timeinfo;
  time(&rawtime);
  timeinfo = localtime(&rawtime);
  int year = timeinfo->tm_year + 1900;
  char *wday = switch_wday(timeinfo->tm_wday);
  char *mon = switch_month(timeinfo->tm_mon);
  sprintf(s, "%s:: %s, %s %02d, %d  %02d:%02d:%02d :: ", s, wday, mon,
          timeinfo->tm_mday, year, timeinfo->tm_hour, timeinfo->tm_min,
          timeinfo->tm_sec);
}


x86 assembly (clang, -O0):
<module_time>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x58,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
call   1050 <time@plt>
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
add    $0x76c,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%edi
call   1070 <switch_wday@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    0x14(%rax),%edi
call   1040 <switch_month@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%r9d
mov    -0x24(%rbp),%ebx
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%r11d
mov    -0x20(%rbp),%rax
mov    0xc(%rax),%r10d
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%eax
lea    0xe26(%rip),%rsi
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1060 <sprintf@plt>
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<module_time>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1050 <time@plt>
mov    %r14,%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    $0x76c,%r12d
add    (%rax),%r12d
mov    0x18(%rax),%edi
call   1070 <switch_wday@plt>
mov    %rax,%r14
mov    0x14(%rbx),%edi
call   1040 <switch_month@plt>
mov    0x4(%rbx),%r9d
mov    0x8(%rbx),%r10d
mov    0xc(%rbx),%r11d
mov    0x10(%rbx),%ebx
lea    0xe5b(%rip),%rsi
mov    %r15,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %rax,%r8
push   %rbx
push   %r11
push   %r10
push   %r12
call   1060 <sprintf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32 }
@.str = [41 x i8] c"%s:: %s, %s %02d, %d %02d:%02d:%02d :: \00"
define void @module_time(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca %struct.tm*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %2
%8 = call i32 @time(i32* %3)
%9 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %9, %struct.tm** %4
%10 = load %struct.tm*, %struct.tm** %4
%11 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1900
store i32 %13, i32* %5
%14 = load %struct.tm*, %struct.tm** %4
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i32 0, i32 6
%16 = load i32, i32* %15
%17 = call i8* @switch_wday(i32 %16)
store i8* %17, i8** %6
%18 = load %struct.tm*, %struct.tm** %4
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 5
%20 = load i32, i32* %19
%21 = call i8* @switch_month(i32 %20)
store i8* %21, i8** %7
%22 = load i8*, i8** %2
%23 = load i8*, i8** %2
%24 = load i8*, i8** %6
%25 = load i8*, i8** %7
%26 = load %struct.tm*, %struct.tm** %4
%27 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 1
%28 = load i32, i32* %27
%29 = load i32, i32* %5
%30 = load %struct.tm*, %struct.tm** %4
%31 = getelementptr inbounds %struct.tm, %struct.tm* %30, i32 0, i32 2
%32 = load i32, i32* %31
%33 = load %struct.tm*, %struct.tm** %4
%34 = getelementptr inbounds %struct.tm, %struct.tm* %33, i32 0, i32 3
%35 = load i32, i32* %34
%36 = load %struct.tm*, %struct.tm** %4
%37 = getelementptr inbounds %struct.tm, %struct.tm* %36, i32 0, i32 4
%38 = load i32, i32* %37
%39 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %23, i8* %24, i8* %25, i32 %28, i32 %29, i32 %32, i32 %35, i32 %38)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32 }
@.str = [41 x i8] c"%s:: %s, %s %02d, %d %02d:%02d:%02d :: \00"
define void @module_time(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @time(i32* %2)
%5 = call %struct.tm* @localtime(i32* %2)
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 0
%7 = load i32, i32* %6
%8 = add nsw i32 %7, 1900
%9 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 6
%10 = load i32, i32* %9
%11 = call i8* @switch_wday(i32 %10)
%12 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 5
%13 = load i32, i32* %12
%14 = call i8* @switch_month(i32 %13)
%15 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 1
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 2
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 3
%20 = load i32, i32* %19
%21 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 4
%22 = load i32, i32* %21
%23 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %11, i8* %14, i32 %16, i32 %8, i32 %18, i32 %20, i32 %22)
ret void
}