#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;

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
char *strstr(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *dhcp6r_clock() {
  time_t tim;
  char *s, *p;
  time(&tim);
  s = ctime(&tim);
  p = s;
  do {
    p = strstr(p, " ");
    if (p != NULL) {
      if (*(p - 1) == '/')
        *p = '0';
      else
        *p = '/';
    }
  } while (p != NULL);
  p = strstr(s, "\n");
  if (p != NULL)
    *p = '\0';
  return s;
}


x86 assembly (clang, -O0):
<dhcp6r_clock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <time@plt>
lea    -0x4(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     119e <dhcp6r_clock+0x6e>
mov    -0x18(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x2f,%eax
jne    1192 <dhcp6r_clock+0x62>
mov    -0x18(%rbp),%rax
movb   $0x30,(%rax)
jmp    1199 <dhcp6r_clock+0x69>
mov    -0x18(%rbp),%rax
movb   $0x2f,(%rax)
jmp    119e <dhcp6r_clock+0x6e>
jmp    11a3 <dhcp6r_clock+0x73>
cmpq   $0x0,-0x18(%rbp)
jne    1156 <dhcp6r_clock+0x26>
mov    -0x10(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11d4 <dhcp6r_clock+0xa4>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dhcp6r_clock>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <ctime@plt>
mov    %rax,%rbx
nopl   (%rax)
mov    %rax,%rdi
mov    $0x20,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1170 <dhcp6r_clock+0x40>
cmpb   $0x2f,-0x1(%rax)
sete   %cl
add    $0x2f,%cl
mov    %cl,(%rax)
jmp    1150 <dhcp6r_clock+0x20>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1185 <dhcp6r_clock+0x55>
movb   $0x0,(%rax)
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"\0A\00"
define i8* @dhcp6r_clock() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = call i32 @time(i32* %1)
%5 = call i8* @ctime(i32* %1)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %3
br label %7
7: ; preds = %24, %0
%8 = load i8*, i8** %3
%9 = call i8* @strstr(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %23
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 -1
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 47
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = load i8*, i8** %3
store i8 48, i8* %19
br label %22
20: ; preds = %12
%21 = load i8*, i8** %3
store i8 47, i8* %21
br label %22
22: ; preds = %20, %18
br label %23
23: ; preds = %22, %7
br label %24
24: ; preds = %23
%25 = load i8*, i8** %3
%26 = icmp ne i8* %25, null
br i1 %26, label %7, label %27
27: ; preds = %24
%28 = load i8*, i8** %2
%29 = call i8* @strstr(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %29, i8** %3
%30 = load i8*, i8** %3
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %34
32: ; preds = %27
%33 = load i8*, i8** %3
store i8 0, i8* %33
br label %34
34: ; preds = %32, %27
%35 = load i8*, i8** %2
ret i8* %35
}

LLVM IR (-O2):
define i8* @dhcp6r_clock() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call i8* @ctime(i32* %1)
%5 = call i8* @strchr(i8* dereferenceable(1) %4, i32 32)
%6 = icmp eq i8* %5, null
br i1 %6, label %15, label %7
7: ; preds = %0, %7
%8 = phi i8* [ %13, %7 ], [ %5, %0 ]
%9 = getelementptr inbounds i8, i8* %8, i64 -1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 47
%12 = select i1 %11, i8 48, i8 47
store i8 %12, i8* %8
%13 = call i8* @strchr(i8* dereferenceable(1) %8, i32 32)
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %7
15: ; preds = %7, %0
%16 = call i8* @strchr(i8* dereferenceable(1) %4, i32 10)
%17 = icmp eq i8* %16, null
br i1 %17, label %19, label %18
18: ; preds = %15
store i8 0, i8* %16
br label %19
19: ; preds = %18, %15
ret i8* %4
}