#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;
};
struct compile_state {
  int dummy;
};
typedef int /*<<< orphan*/ scratch;

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ register_builtin_macro(struct compile_state *, char *,
                                          char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void register_builtin_macros(struct compile_state *state) {
  char buf[30];
  char scratch[30];
  time_t now;
  struct tm *tm;
  now = time(NULL);
  tm = localtime(&now);
  register_builtin_macro(state, "__ROMCC__", "0");
  register_builtin_macro(state, "__ROMCC_MINOR__", "73");
  register_builtin_macro(state, "__FILE__", "\"This should be the filename\"");
  register_builtin_macro(state, "__LINE__", "54321");
  strftime(scratch, sizeof(scratch), "%b %e %Y", tm);
  sprintf(buf, "\"%s\"", scratch);
  register_builtin_macro(state, "__DATE__", buf);
  strftime(scratch, sizeof(scratch), "%H:%M:%S", tm);
  sprintf(buf, "\"%s\"", scratch);
  register_builtin_macro(state, "__TIME__", buf);
  register_builtin_macro(state, "__STDC__", "0");
  register_builtin_macro(state, "__STDC_VERSION__", "199901L");
}


x86 assembly (clang, -O0):
<register_builtin_macros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x54(%rbp)
lea    -0x54(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe80(%rip),%rsi
lea    0xe83(%rip),%rdx
call   1040 <register_builtin_macro@plt>
mov    -0x8(%rbp),%rdi
lea    0xe75(%rip),%rsi
lea    0xe7e(%rip),%rdx
call   1040 <register_builtin_macro@plt>
mov    -0x8(%rbp),%rdi
lea    0xe71(%rip),%rsi
lea    0xe73(%rip),%rdx
call   1040 <register_builtin_macro@plt>
mov    -0x8(%rbp),%rdi
lea    0xe81(%rip),%rsi
lea    0xe83(%rip),%rdx
call   1040 <register_builtin_macro@plt>
lea    -0x50(%rbp),%rdi
mov    -0x60(%rbp),%rcx
mov    $0x1e,%esi
lea    0xe70(%rip),%rdx
call   1060 <strftime@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    0xe65(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    0xe56(%rip),%rsi
call   1040 <register_builtin_macro@plt>
lea    -0x50(%rbp),%rdi
mov    -0x60(%rbp),%rcx
mov    $0x1e,%esi
lea    0xe46(%rip),%rdx
call   1060 <strftime@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    0xe24(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    0xe27(%rip),%rsi
call   1040 <register_builtin_macro@plt>
mov    -0x8(%rbp),%rdi
lea    0xe20(%rip),%rsi
lea    0xda5(%rip),%rdx
call   1040 <register_builtin_macro@plt>
mov    -0x8(%rbp),%rdi
lea    0xe12(%rip),%rsi
lea    0xe1c(%rip),%rdx
call   1040 <register_builtin_macro@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<register_builtin_macros>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%r15
lea    0xe80(%rip),%rsi
lea    0xe83(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rdx
call   1040 <register_builtin_macro@plt>
lea    0xe73(%rip),%rsi
lea    0xe7c(%rip),%rdx
mov    %rbx,%rdi
call   1040 <register_builtin_macro@plt>
lea    0xe70(%rip),%rsi
lea    0xe72(%rip),%rdx
mov    %rbx,%rdi
call   1040 <register_builtin_macro@plt>
lea    0xe81(%rip),%rsi
lea    0xe83(%rip),%rdx
mov    %rbx,%rdi
call   1040 <register_builtin_macro@plt>
lea    0xe7a(%rip),%rdx
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    $0x1e,%esi
mov    %r15,%rcx
call   1060 <strftime@plt>
lea    0xe67(%rip),%rbp
lea    0x30(%rsp),%r13
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1070 <sprintf@plt>
lea    0xe52(%rip),%rsi
mov    %rbx,%rdi
mov    %r13,%rdx
call   1040 <register_builtin_macro@plt>
lea    0xe49(%rip),%rdx
mov    %r12,%rdi
mov    $0x1e,%esi
mov    %r15,%rcx
call   1060 <strftime@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1070 <sprintf@plt>
lea    0xe2d(%rip),%rsi
mov    %rbx,%rdi
mov    %r13,%rdx
call   1040 <register_builtin_macro@plt>
lea    0xe24(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1040 <register_builtin_macro@plt>
lea    0xe1b(%rip),%rsi
lea    0xe25(%rip),%rdx
mov    %rbx,%rdi
call   1040 <register_builtin_macro@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.compile_state = type { i32 }
%struct.tm = type { i32 }
@.str = [10 x i8] c"__ROMCC__\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [16 x i8] c"__ROMCC_MINOR__\00"
@.str.3 = [3 x i8] c"73\00"
@.str.4 = [9 x i8] c"__FILE__\00"
@.str.5 = [30 x i8] c"\22This should be the filename\22\00"
@.str.6 = [9 x i8] c"__LINE__\00"
@.str.7 = [6 x i8] c"54321\00"
@.str.8 = [9 x i8] c"%b %e %Y\00"
@.str.9 = [5 x i8] c"\22%s\22\00"
@.str.10 = [9 x i8] c"__DATE__\00"
@.str.11 = [9 x i8] c"%H:%M:%S\00"
@.str.12 = [9 x i8] c"__TIME__\00"
@.str.13 = [9 x i8] c"__STDC__\00"
@.str.14 = [17 x i8] c"__STDC_VERSION__\00"
@.str.15 = [8 x i8] c"199901L\00"
define void @register_builtin_macros(%struct.compile_state* %0) {
%2 = alloca %struct.compile_state*
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
%5 = alloca i32
%6 = alloca %struct.tm*
store %struct.compile_state* %0, %struct.compile_state** %2
%7 = call i32 @time(i32* null)
store i32 %7, i32* %5
%8 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %8, %struct.tm** %6
%9 = load %struct.compile_state*, %struct.compile_state** %2
%10 = call i32 @register_builtin_macro(%struct.compile_state* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = load %struct.compile_state*, %struct.compile_state** %2
%12 = call i32 @register_builtin_macro(%struct.compile_state* %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%13 = load %struct.compile_state*, %struct.compile_state** %2
%14 = call i32 @register_builtin_macro(%struct.compile_state* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%15 = load %struct.compile_state*, %struct.compile_state** %2
%16 = call i32 @register_builtin_macro(%struct.compile_state* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%17 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%18 = load %struct.tm*, %struct.tm** %6
%19 = call i32 @strftime(i8* %17, i32 30, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), %struct.tm* %18)
%20 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%21 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%22 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %21)
%23 = load %struct.compile_state*, %struct.compile_state** %2
%24 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%25 = call i32 @register_builtin_macro(%struct.compile_state* %23, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%27 = load %struct.tm*, %struct.tm** %6
%28 = call i32 @strftime(i8* %26, i32 30, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), %struct.tm* %27)
%29 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%30 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%31 = call i32 @sprintf(i8* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %30)
%32 = load %struct.compile_state*, %struct.compile_state** %2
%33 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%34 = call i32 @register_builtin_macro(%struct.compile_state* %32, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i8* %33)
%35 = load %struct.compile_state*, %struct.compile_state** %2
%36 = call i32 @register_builtin_macro(%struct.compile_state* %35, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%37 = load %struct.compile_state*, %struct.compile_state** %2
%38 = call i32 @register_builtin_macro(%struct.compile_state* %37, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.compile_state = type { i32 }
%struct.tm = type { i32 }
@.str = [10 x i8] c"__ROMCC__\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [16 x i8] c"__ROMCC_MINOR__\00"
@.str.3 = [3 x i8] c"73\00"
@.str.4 = [9 x i8] c"__FILE__\00"
@.str.5 = [30 x i8] c"\22This should be the filename\22\00"
@.str.6 = [9 x i8] c"__LINE__\00"
@.str.7 = [6 x i8] c"54321\00"
@.str.8 = [9 x i8] c"%b %e %Y\00"
@.str.9 = [5 x i8] c"\22%s\22\00"
@.str.10 = [9 x i8] c"__DATE__\00"
@.str.11 = [9 x i8] c"%H:%M:%S\00"
@.str.12 = [9 x i8] c"__TIME__\00"
@.str.13 = [9 x i8] c"__STDC__\00"
@.str.14 = [17 x i8] c"__STDC_VERSION__\00"
@.str.15 = [8 x i8] c"199901L\00"
define void @register_builtin_macros(%struct.compile_state* %0) {
%2 = alloca [30 x i8]
%3 = alloca [30 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%7 = bitcast i32* %4 to i8*
%8 = tail call i32 @time(i32* null)
store i32 %8, i32* %4
%9 = call %struct.tm* @localtime(i32* %4)
%10 = call i32 @register_builtin_macro(%struct.compile_state* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @register_builtin_macro(%struct.compile_state* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @register_builtin_macro(%struct.compile_state* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 @register_builtin_macro(%struct.compile_state* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%14 = call i32 @strftime(i8* %6, i32 30, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), %struct.tm* %9)
%15 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %6)
%16 = call i32 @register_builtin_macro(%struct.compile_state* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* %5)
%17 = call i32 @strftime(i8* %6, i32 30, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), %struct.tm* %9)
%18 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* %6)
%19 = call i32 @register_builtin_macro(%struct.compile_state* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i8* %5)
%20 = call i32 @register_builtin_macro(%struct.compile_state* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @register_builtin_macro(%struct.compile_state* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0))
ret void
}