#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 */
int /*<<< orphan*/ date_get_by_epoch(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ mk_time_(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
scalar_t__ strlen(char *);
int date_is_valid(char *ps_date, char *ps_format) {
  time_t t_mt;
  char s_ndate[255];
  int i_status = 0;
  if (strlen(ps_date) == strlen(ps_format)) {
    t_mt = mk_time_(ps_date, ps_format);
    date_get_by_epoch(s_ndate, ps_format, &t_mt);
    i_status = (!(strcmp(ps_date, s_ndate))) ? 1 : 0;
  }
  return i_status;
}


x86 assembly (clang, -O0):
<date_is_valid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x124(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x130(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x130(%rbp),%rax
cmp    %rcx,%rax
jne    11d9 <date_is_valid+0x99>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <mk_time_@plt>
mov    %eax,-0x14(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1060 <date_get_by_epoch@plt>
mov    -0x8(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
setne  %dl
xor    $0xff,%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
mov    %eax,-0x124(%rbp)
mov    -0x124(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_is_valid>:
push   %r15
push   %r14
push   %rbx
sub    $0x110,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rbx
jne    11a4 <date_is_valid+0x64>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <mk_time_@plt>
mov    %eax,0xc(%rsp)
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <date_get_by_epoch@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    $0x110,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @date_is_valid(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [255 x i8]
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %7
%8 = load i8*, i8** %3
%9 = call i64 @strlen(i8* %8)
%10 = load i8*, i8** %4
%11 = call i64 @strlen(i8* %10)
%12 = icmp eq i64 %9, %11
br i1 %12, label %13, label %27
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = load i8*, i8** %4
%16 = call i32 @mk_time_(i8* %14, i8* %15)
store i32 %16, i32* %5
%17 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%18 = load i8*, i8** %4
%19 = call i32 @date_get_by_epoch(i8* %17, i8* %18, i32* %5)
%20 = load i8*, i8** %3
%21 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%22 = call i32 @strcmp(i8* %20, i8* %21)
%23 = icmp ne i32 %22, 0
%24 = xor i1 %23, true
%25 = zext i1 %24 to i64
%26 = select i1 %24, i32 1, i32 0
store i32 %26, i32* %7
br label %27
27: ; preds = %13, %2
%28 = load i32, i32* %7
ret i32 %28
}

LLVM IR (-O2):
define i32 @date_is_valid(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca [255 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%7 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%8 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = tail call i32 @mk_time_(i8* %0, i8* %1)
store i32 %11, i32* %3
%12 = call i32 @date_get_by_epoch(i8* %6, i8* %1, i32* %3)
%13 = call i32 @strcmp(i8* dereferenceable(1) %0, i8* %6)
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %10, %2
%17 = phi i32 [ %15, %10 ], [ 0, %2 ]
ret i32 %17
}