#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 */

/* Variables and functions */
int /*<<< orphan*/ hex_to_str(unsigned char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  unsigned char buf[1024];
  buf[37] = 0x14;
  buf[38] = 0x07;
  buf[39] = 0x30;
  buf[40] = 0x21;
  buf[41] = 0x36;
  buf[42] = 0x56;
  char time[13] = {'0'};
  hex_to_str(&buf[37], time, 6);
  printf("time - %s\n", time);
  char datetime[] = "2014-01-01 00:00:00";
  datetime[2] = time[0];
  datetime[3] = time[1];
  datetime[5] = time[2];
  datetime[6] = time[3];
  datetime[8] = time[4];
  datetime[9] = time[5];
  datetime[11] = time[6];
  datetime[12] = time[7];
  datetime[14] = time[8];
  datetime[15] = time[9];
  datetime[17] = time[10];
  datetime[18] = time[11];
  printf("datetime = %s\n", datetime);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x14,-0x3eb(%rbp)
movb   $0x7,-0x3ea(%rbp)
movb   $0x30,-0x3e9(%rbp)
movb   $0x21,-0x3e8(%rbp)
movb   $0x36,-0x3e7(%rbp)
movb   $0x56,-0x3e6(%rbp)
mov    0xe96(%rip),%rax
mov    %rax,-0x41d(%rbp)
mov    0xe91(%rip),%eax
mov    %eax,-0x415(%rbp)
mov    0xe89(%rip),%al
mov    %al,-0x411(%rbp)
lea    -0x410(%rbp),%rdi
add    $0x25,%rdi
lea    -0x41d(%rbp),%rsi
mov    $0x6,%edx
call   1030 <hex_to_str@plt>
lea    -0x41d(%rbp),%rsi
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
mov    0xe71(%rip),%rax
mov    %rax,-0x440(%rbp)
mov    0xe6b(%rip),%rax
mov    %rax,-0x438(%rbp)
mov    0xe66(%rip),%eax
mov    %eax,-0x430(%rbp)
mov    -0x41d(%rbp),%al
mov    %al,-0x43e(%rbp)
mov    -0x41c(%rbp),%al
mov    %al,-0x43d(%rbp)
mov    -0x41b(%rbp),%al
mov    %al,-0x43b(%rbp)
mov    -0x41a(%rbp),%al
mov    %al,-0x43a(%rbp)
mov    -0x419(%rbp),%al
mov    %al,-0x438(%rbp)
mov    -0x418(%rbp),%al
mov    %al,-0x437(%rbp)
mov    -0x417(%rbp),%al
mov    %al,-0x435(%rbp)
mov    -0x416(%rbp),%al
mov    %al,-0x434(%rbp)
mov    -0x415(%rbp),%al
mov    %al,-0x432(%rbp)
mov    -0x414(%rbp),%al
mov    %al,-0x431(%rbp)
mov    -0x413(%rbp),%al
mov    %al,-0x42f(%rbp)
mov    -0x412(%rbp),%al
mov    %al,-0x42e(%rbp)
lea    -0x440(%rbp),%rsi
lea    0xd9a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x430,%rsp
lea    0x55(%rsp),%rdi
movl   $0x21300714,0x55(%rsp)
21
movw   $0x5636,0x59(%rsp)
mov    0xec2(%rip),%rax
mov    %rax,0x5(%rsp)
mov    0xeb1(%rip),%rax
mov    %rax,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <hex_to_str@plt>
lea    0xea3(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
movaps 0xeb7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x30303a,0x20(%rsp)
movzwl (%rsp),%eax
movzwl 0x2(%rsp),%ecx
mov    %ax,0x12(%rsp)
mov    %cx,0x15(%rsp)
movzwl 0x4(%rsp),%eax
mov    %ax,0x18(%rsp)
movzwl 0x6(%rsp),%eax
mov    %ax,0x1b(%rsp)
movzwl 0x8(%rsp),%eax
mov    %ax,0x1e(%rsp)
mov    0xa(%rsp),%al
mov    %al,0x21(%rsp)
mov    0xb(%rsp),%al
mov    %al,0x22(%rsp)
lea    0xe4a(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.time = <{ i8, [12 x i8] }> <{ i8 48, [12 x i8] zeroinitializer }>
@.str = [11 x i8] c"time - %s\0A\00"
@__const.main.datetime = [20 x i8] c"2014-01-01 00:00:00\00"
@.str.1 = [15 x i8] c"datetime = %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca [13 x i8]
%8 = alloca [20 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 37
store i8 20, i8* %9
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 38
store i8 7, i8* %10
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 39
store i8 48, i8* %11
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 40
store i8 33, i8* %12
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 41
store i8 54, i8* %13
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 42
store i8 86, i8* %14
%15 = bitcast [13 x i8]* %7 to i8*
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 37
%17 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 0
%18 = call i32 @hex_to_str(i8* %16, i8* %17, i32 6)
%19 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 0
%20 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = bitcast [20 x i8]* %8 to i8*
%22 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 0
%23 = load i8, i8* %22
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 2
store i8 %23, i8* %24
%25 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 1
%26 = load i8, i8* %25
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 3
store i8 %26, i8* %27
%28 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 2
%29 = load i8, i8* %28
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 5
store i8 %29, i8* %30
%31 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 3
%32 = load i8, i8* %31
%33 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 6
store i8 %32, i8* %33
%34 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 4
%35 = load i8, i8* %34
%36 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 8
store i8 %35, i8* %36
%37 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 5
%38 = load i8, i8* %37
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 9
store i8 %38, i8* %39
%40 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 6
%41 = load i8, i8* %40
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 11
store i8 %41, i8* %42
%43 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 7
%44 = load i8, i8* %43
%45 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 12
store i8 %44, i8* %45
%46 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 8
%47 = load i8, i8* %46
%48 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 14
store i8 %47, i8* %48
%49 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 9
%50 = load i8, i8* %49
%51 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 15
store i8 %50, i8* %51
%52 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 10
%53 = load i8, i8* %52
%54 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 17
store i8 %53, i8* %54
%55 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 11
%56 = load i8, i8* %55
%57 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 18
store i8 %56, i8* %57
%58 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%59 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %58)
ret i32 0
}

LLVM IR (-O2):
@__const.main.time = <{ i8, [12 x i8] }> <{ i8 48, [12 x i8] zeroinitializer }>
@.str = [11 x i8] c"time - %s\0A\00"
@__const.main.datetime = [20 x i8] c"2014-01-01 00:00:00\00"
@.str.1 = [15 x i8] c"datetime = %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = alloca [13 x i8]
%5 = alloca [20 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 37
store i8 20, i8* %7
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 38
store i8 7, i8* %8
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 39
store i8 48, i8* %9
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 40
store i8 33, i8* %10
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 41
store i8 54, i8* %11
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 42
store i8 86, i8* %12
%13 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 0
%14 = call i32 @hex_to_str(i8* %7, i8* %13, i32 6)
%15 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %13)
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%17 = load i8, i8* %13
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 2
store i8 %17, i8* %18
%19 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 1
%20 = load i8, i8* %19
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 3
store i8 %20, i8* %21
%22 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 2
%23 = load i8, i8* %22
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 5
store i8 %23, i8* %24
%25 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 3
%26 = load i8, i8* %25
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 6
store i8 %26, i8* %27
%28 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 4
%29 = load i8, i8* %28
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 8
store i8 %29, i8* %30
%31 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 5
%32 = load i8, i8* %31
%33 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 9
store i8 %32, i8* %33
%34 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 6
%35 = load i8, i8* %34
%36 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 11
store i8 %35, i8* %36
%37 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 7
%38 = load i8, i8* %37
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 12
store i8 %38, i8* %39
%40 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 8
%41 = load i8, i8* %40
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 14
store i8 %41, i8* %42
%43 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 9
%44 = load i8, i8* %43
%45 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 15
store i8 %44, i8* %45
%46 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 10
%47 = load i8, i8* %46
%48 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 17
store i8 %47, i8* %48
%49 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 11
%50 = load i8, i8* %49
%51 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 18
store i8 %50, i8* %51
%52 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %16)
ret i32 0
}