#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_mday;
  int tm_mon;
  int tm_year;
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ putString(char *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void Get_Date_Time(int x) {
  struct tm *T;
  time_t t0;
  char b[12];
  t0 = time(NULL);
  T = localtime(&t0);
  if (x)
    sprintf(b, "%.2d/%.2d/%.4d", T->tm_mday, T->tm_mon + 1, T->tm_year + 1900);
  else
    sprintf(b, "%.2d:%.2d:%.2d", T->tm_hour, T->tm_min, T->tm_sec);
  putString(b);
}


x86 assembly (clang, -O0):
<Get_Date_Time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     11a2 <Get_Date_Time+0x62>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r8d
add    $0x76c,%r8d
lea    0xe68(%rip),%rsi
call   1050 <sprintf@plt>
jmp    11c8 <Get_Date_Time+0x88>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%r8d
lea    0xe4c(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1060 <putString@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_Date_Time>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,(%rsp)
mov    %rsp,%rdi
call   1030 <localtime@plt>
test   %ebx,%ebx
je     1178 <Get_Date_Time+0x38>
mov    (%rax),%edx
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    $0x76c,%r8d
add    0x8(%rax),%r8d
lea    0xe8a(%rip),%rsi
jmp    1189 <Get_Date_Time+0x49>
mov    0xc(%rax),%edx
mov    0x10(%rax),%ecx
mov    0x14(%rax),%r8d
lea    0xe86(%rip),%rsi
lea    0x4(%rsp),%rdi
call   1050 <sprintf@plt>
lea    0x4(%rsp),%rdi
call   1060 <putString@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [15 x i8] c"%.2d/%.2d/%.4d\00"
@.str.1 = [15 x i8] c"%.2d:%.2d:%.2d\00"
define void @Get_Date_Time(i32 %0) {
%2 = alloca i32
%3 = alloca [12 x i8]
%4 = bitcast i32* %2 to i8*
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%6 = tail call i32 @time(i32* null)
store i32 %6, i32* %2
%7 = call %struct.tm* @localtime(i32* %2)
%8 = icmp eq i32 %0, 0
br i1 %8, label %19, label %9
9: ; preds = %1
%10 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 0
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 1
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
%15 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 2
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1900
%18 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %14, i32 %17)
br label %27
19: ; preds = %1
%20 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 3
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 4
%23 = load i32, i32* %22
%24 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 5
%25 = load i32, i32* %24
%26 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %23, i32 %25)
br label %27
27: ; preds = %19, %9
%28 = call i32 @putString(i8* %5)
ret void
}