#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 sprintf(char *, char *, char, char, char, char, char, char, char, char);
char *statstr_dup(char *, int);
char *ResultsDate(char *fdate) {
  char tstr[12];
  int len;
  len = sprintf(tstr, "%c%c/%c%c/%c%c%c%c", fdate[4], fdate[5], fdate[6],
                fdate[7], fdate[0], fdate[1], fdate[2], fdate[3]);
  if (len < 0)
    len = 0;
  return statstr_dup(tstr, len);
}


x86 assembly (clang, -O0):
<ResultsDate>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x38,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x1c(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x5(%rax),%cl
mov    -0x10(%rbp),%rax
mov    0x6(%rax),%r8b
mov    -0x10(%rbp),%rax
mov    0x7(%rax),%r9b
mov    -0x10(%rbp),%rax
mov    (%rax),%bl
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%r11b
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%r10b
mov    -0x10(%rbp),%rax
lea    0xe90(%rip),%rsi
movsbl %dl,%edx
movsbl %cl,%ecx
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %bl,%ebx
mov    %ebx,(%rsp)
movsbl %r11b,%r11d
mov    %r11d,0x8(%rsp)
movsbl %r10b,%r10d
mov    %r10d,0x10(%rsp)
movsbl 0x3(%rax),%eax
mov    %eax,0x18(%rsp)
call   1040 <sprintf@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    11b7 <ResultsDate+0x97>
movl   $0x0,-0x20(%rbp)
lea    -0x1c(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1030 <statstr_dup@plt>
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<ResultsDate>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movsbl 0x4(%rdi),%edx
movsbl 0x5(%rdi),%ecx
movsbl 0x6(%rdi),%r8d
movsbl 0x7(%rdi),%r9d
movsbl (%rdi),%r10d
movsbl 0x1(%rdi),%r11d
movsbl 0x2(%rdi),%eax
movsbl 0x3(%rdi),%ebx
lea    0xeaf(%rip),%rsi
lea    0xc(%rsp),%r14
mov    %r14,%rdi
push   %rbx
push   %rax
push   %r11
push   %r10
call   1040 <sprintf@plt>
add    $0x20,%rsp
xor    %esi,%esi
test   %eax,%eax
cmovns %eax,%esi
mov    %r14,%rdi
call   1030 <statstr_dup@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"%c%c/%c%c/%c%c%c%c\00"
define i8* @ResultsDate(i8* %0) {
%2 = alloca i8*
%3 = alloca [12 x i8]
%4 = alloca i32
store i8* %0, i8** %2
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 4
%8 = load i8, i8* %7
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 5
%11 = load i8, i8* %10
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 6
%14 = load i8, i8* %13
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 7
%17 = load i8, i8* %16
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8, i8* %22
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i64 2
%26 = load i8, i8* %25
%27 = load i8*, i8** %2
%28 = getelementptr inbounds i8, i8* %27, i64 3
%29 = load i8, i8* %28
%30 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8 signext %8, i8 signext %11, i8 signext %14, i8 signext %17, i8 signext %20, i8 signext %23, i8 signext %26, i8 signext %29)
store i32 %30, i32* %4
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %1
store i32 0, i32* %4
br label %34
34: ; preds = %33, %1
%35 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%36 = load i32, i32* %4
%37 = call i8* @statstr_dup(i8* %35, i32 %36)
ret i8* %37
}

LLVM IR (-O2):
@.str = [19 x i8] c"%c%c/%c%c/%c%c%c%c\00"
define i8* @ResultsDate(i8* nocapture %0) {
%2 = alloca [12 x i8]
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = load i8, i8* %4
%6 = getelementptr inbounds i8, i8* %0, i64 5
%7 = load i8, i8* %6
%8 = getelementptr inbounds i8, i8* %0, i64 6
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %0, i64 7
%11 = load i8, i8* %10
%12 = load i8, i8* %0
%13 = getelementptr inbounds i8, i8* %0, i64 1
%14 = load i8, i8* %13
%15 = getelementptr inbounds i8, i8* %0, i64 2
%16 = load i8, i8* %15
%17 = getelementptr inbounds i8, i8* %0, i64 3
%18 = load i8, i8* %17
%19 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8 signext %5, i8 signext %7, i8 signext %9, i8 signext %11, i8 signext %12, i8 signext %14, i8 signext %16, i8 signext %18)
%20 = icmp sgt i32 %19, 0
%21 = select i1 %20, i32 %19, i32 0
%22 = call i8* @statstr_dup(i8* %3, i32 %21)
ret i8* %22
}