#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 */
scalar_t__ convert_date(char *, char const *, char const *, char const *, int);
int /*<<< orphan*/ dbg_fprintf(char *, char const *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
char *xstrdup(char *);
char *get_visitors_date(const char *odate, const char *from, const char *to) {
  char date[25 + 1] = "";
  memset(date, 0, sizeof *date);
  if (convert_date(date, odate, from, to, 25 + 1) == 0)
    return xstrdup(date);
  do {
    dbg_fprintf("invalid date: %s", odate);
  } while (0);
  return xstrdup("---");
}


x86 assembly (clang, -O0):
<get_visitors_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x1a,%edx
call   1030 <memset@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <memset@plt>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1a,%r8d
call   1060 <convert_date@plt>
cmp    $0x0,%rax
jne    11ab <get_visitors_date+0x6b>
lea    -0x40(%rbp),%rdi
call   1040 <xstrdup@plt>
mov    %rax,-0x8(%rbp)
jmp    11d0 <get_visitors_date+0x90>
jmp    11b0 <get_visitors_date+0x70>
mov    -0x10(%rbp),%rsi
lea    0xe45(%rip),%rdi
call   1050 <dbg_fprintf@plt>
lea    0xe4a(%rip),%rdi
call   1040 <xstrdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_visitors_date>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movups %xmm0,0xa(%rsp)
movaps %xmm0,(%rsp)
mov    %rsp,%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <memset@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
mov    $0x1a,%r8d
call   1060 <convert_date@plt>
test   %rax,%rax
je     11a6 <get_visitors_date+0x66>
lea    0xe6b(%rip),%rdi
mov    %rbx,%rsi
call   1050 <dbg_fprintf@plt>
lea    0xe6d(%rip),%rdi
jmp    11a9 <get_visitors_date+0x69>
mov    %rsp,%rdi
call   1040 <xstrdup@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"invalid date: %s\00"
@.str.1 = [4 x i8] c"---\00"
define i8* @get_visitors_date(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca [26 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%9 = bitcast [26 x i8]* %8 to i8*
%10 = getelementptr inbounds [26 x i8], [26 x i8]* %8, i64 0, i64 0
%11 = call i32 @memset(i8* %10, i32 0, i32 1)
%12 = getelementptr inbounds [26 x i8], [26 x i8]* %8, i64 0, i64 0
%13 = load i8*, i8** %5
%14 = load i8*, i8** %6
%15 = load i8*, i8** %7
%16 = call i64 @convert_date(i8* %12, i8* %13, i8* %14, i8* %15, i32 26)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %3
%19 = getelementptr inbounds [26 x i8], [26 x i8]* %8, i64 0, i64 0
%20 = call i8* @xstrdup(i8* %19)
store i8* %20, i8** %4
br label %27
21: ; preds = %3
br label %22
22: ; preds = %21
%23 = load i8*, i8** %5
%24 = call i32 @dbg_fprintf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %22
%26 = call i8* @xstrdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i8* %26, i8** %4
br label %27
27: ; preds = %25, %18
%28 = load i8*, i8** %4
ret i8* %28
}

LLVM IR (-O2):
@.str = [17 x i8] c"invalid date: %s\00"
@.str.1 = [4 x i8] c"---\00"
define i8* @get_visitors_date(i8* %0, i8* %1, i8* %2) {
%4 = alloca [26 x i8]
%5 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 1)
%7 = call i64 @convert_date(i8* %5, i8* %0, i8* %1, i8* %2, i32 26)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i8* @xstrdup(i8* %5)
br label %14
11: ; preds = %3
%12 = call i32 @dbg_fprintf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
%13 = call i8* @xstrdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %11, %9
%15 = phi i8* [ %10, %9 ], [ %13, %11 ]
ret i8* %15
}