#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*/ printf(char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ zeronet_date_to_readable(char *);
int test_zeronet_date_to_readable() {
  char datestr[(1024 * 256)];
  char expected[(1024 * 256)];
  int i;
  sprintf(datestr, "%s", "1424568226.069");
  sprintf(expected, "%s", "Sun Feb 22 01:23:46 2015");
  for (i = 0; i < (int)strlen(expected); i++) {
    if ((expected[i] == '\n') || (expected[i] == 10))
      expected[i] = 0;
  }
  zeronet_date_to_readable(datestr);
  if (strcmp(datestr, expected) != 0) {
    printf("1424568226.069\n%s != %s\n", datestr, expected);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_zeronet_date_to_readable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80020,%rsp
lea    -0x40010(%rbp),%rdi
lea    0xe97(%rip),%rsi
lea    0xe93(%rip),%rdx
call   1070 <sprintf@plt>
lea    -0x80010(%rbp),%rdi
lea    0xe7d(%rip),%rsi
lea    0xe88(%rip),%rdx
call   1070 <sprintf@plt>
movl   $0x0,-0x80014(%rbp)
mov    -0x80014(%rbp),%eax
mov    %eax,-0x80018(%rbp)
lea    -0x80010(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x80018(%rbp),%eax
cmp    %ecx,%eax
jge    121a <test_zeronet_date_to_readable+0xca>
movslq -0x80014(%rbp),%rax
movsbl -0x80010(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
je     11f2 <test_zeronet_date_to_readable+0xa2>
movslq -0x80014(%rbp),%rax
movsbl -0x80010(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    1201 <test_zeronet_date_to_readable+0xb1>
movslq -0x80014(%rbp),%rax
movb   $0x0,-0x80010(%rbp,%rax,1)
jmp    1206 <test_zeronet_date_to_readable+0xb6>
mov    -0x80014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80014(%rbp)
jmp    1199 <test_zeronet_date_to_readable+0x49>
lea    -0x40010(%rbp),%rdi
call   1060 <zeronet_date_to_readable@plt>
lea    -0x40010(%rbp),%rdi
lea    -0x80010(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1269 <test_zeronet_date_to_readable+0x119>
lea    -0x40010(%rbp),%rsi
lea    -0x80010(%rbp),%rdx
lea    0xdd3(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1270 <test_zeronet_date_to_readable+0x120>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_zeronet_date_to_readable>:
push   %r14
push   %rbx
sub    $0x80008,%rsp
movabs $0x3238363534323431,%rax
36 38 32
mov    %rax,0x40000(%rsp)
movabs $0x3936302e363232,%rax
mov    %rax,0x40007(%rsp)
movups 0xe9a(%rip),%xmm0
movaps %xmm0,(%rsp)
movups 0xe98(%rip),%xmm0
movups %xmm0,0x9(%rsp)
mov    %rsp,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    11c2 <test_zeronet_date_to_readable+0x82>
mov    $0x53,%al
mov    $0x1,%ebx
mov    %rsp,%r14
cmp    $0xa,%al
jne    11a5 <test_zeronet_date_to_readable+0x65>
nop
movb   $0x0,-0x1(%rsp,%rbx,1)
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    11c2 <test_zeronet_date_to_readable+0x82>
movzbl (%rsp,%rbx,1),%eax
add    $0x1,%rbx
cmp    $0xa,%al
je     11a0 <test_zeronet_date_to_readable+0x60>
jmp    11a5 <test_zeronet_date_to_readable+0x65>
lea    0x40000(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <zeronet_date_to_readable@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1200 <test_zeronet_date_to_readable+0xc0>
lea    0xe3f(%rip),%rdi
lea    0x40000(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <printf@plt>
mov    $0x1,%eax
jmp    1202 <test_zeronet_date_to_readable+0xc2>
xor    %eax,%eax
add    $0x80008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [15 x i8] c"1424568226.069\00"
@.str.2 = [25 x i8] c"Sun Feb 22 01:23:46 2015\00"
@.str.3 = [25 x i8] c"1424568226.069\0A%s != %s\0A\00"
define i32 @test_zeronet_date_to_readable() {
%1 = alloca i32
%2 = alloca [262144 x i8]
%3 = alloca [262144 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [262144 x i8], [262144 x i8]* %2, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [262144 x i8], [262144 x i8]* %3, i64 0, i64 0
%8 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %9
9: ; preds = %34, %0
%10 = load i32, i32* %4
%11 = getelementptr inbounds [262144 x i8], [262144 x i8]* %3, i64 0, i64 0
%12 = call i64 @strlen(i8* %11)
%13 = trunc i64 %12 to i32
%14 = icmp slt i32 %10, %13
br i1 %14, label %15, label %37
15: ; preds = %9
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [262144 x i8], [262144 x i8]* %3, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 10
br i1 %21, label %29, label %22
22: ; preds = %15
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [262144 x i8], [262144 x i8]* %3, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 10
br i1 %28, label %29, label %33
29: ; preds = %22, %15
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [262144 x i8], [262144 x i8]* %3, i64 0, i64 %31
store i8 0, i8* %32
br label %33
33: ; preds = %29, %22
br label %34
34: ; preds = %33
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %9
37: ; preds = %9
%38 = getelementptr inbounds [262144 x i8], [262144 x i8]* %2, i64 0, i64 0
%39 = call i32 @zeronet_date_to_readable(i8* %38)
%40 = getelementptr inbounds [262144 x i8], [262144 x i8]* %2, i64 0, i64 0
%41 = getelementptr inbounds [262144 x i8], [262144 x i8]* %3, i64 0, i64 0
%42 = call i64 @strcmp(i8* %40, i8* %41)
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %37
%45 = getelementptr inbounds [262144 x i8], [262144 x i8]* %2, i64 0, i64 0
%46 = getelementptr inbounds [262144 x i8], [262144 x i8]* %3, i64 0, i64 0
%47 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %45, i8* %46)
store i32 1, i32* %1
br label %49
48: ; preds = %37
store i32 0, i32* %1
br label %49
49: ; preds = %48, %44
%50 = load i32, i32* %1
ret i32 %50
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"1424568226.069\00"
@.str.2 = [25 x i8] c"Sun Feb 22 01:23:46 2015\00"
@.str.3 = [25 x i8] c"1424568226.069\0A%s != %s\0A\00"
define i32 @test_zeronet_date_to_readable() {
%1 = alloca [262144 x i8]
%2 = alloca [262144 x i8]
%3 = getelementptr inbounds [262144 x i8], [262144 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [262144 x i8], [262144 x i8]* %2, i64 0, i64 0
%5 = call i64 @strlen(i8* %4)
%6 = trunc i64 %5 to i32
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %23
8: ; preds = %0, %20
%9 = phi i8 [ %22, %20 ], [ 83, %0 ]
%10 = phi i64 [ %15, %20 ], [ 0, %0 ]
%11 = icmp eq i8 %9, 10
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = getelementptr inbounds [262144 x i8], [262144 x i8]* %2, i64 0, i64 %10
store i8 0, i8* %13
br label %14
14: ; preds = %8, %12
%15 = add nuw nsw i64 %10, 1
%16 = call i64 @strlen(i8* %4)
%17 = shl i64 %16, 32
%18 = ashr exact i64 %17, 32
%19 = icmp slt i64 %15, %18
br i1 %19, label %20, label %23
20: ; preds = %14
%21 = getelementptr inbounds [262144 x i8], [262144 x i8]* %2, i64 0, i64 %15
%22 = load i8, i8* %21
br label %8
23: ; preds = %14, %0
%24 = call i32 @zeronet_date_to_readable(i8* %3)
%25 = call i64 @strcmp(i8* %3, i8* %4)
%26 = icmp eq i64 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %23
%28 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %3, i8* %4)
br label %29
29: ; preds = %23, %27
%30 = phi i32 [ 1, %27 ], [ 0, %23 ]
ret i32 %30
}