#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*/ sprintf(char *, char *, long);
char *Dtfmt(long d, char *s) {
  int i;
  char v[7];
  s[8] = '\0';
  if (d < 101L) {
    for (i = 0; i != 8;)
      s[i++] = ' ';
    return (s);
  }
  d %= 1000000L;
  sprintf(v, "%6ld", d);
  s[0] = v[2] == '0' ? ' ' : v[2];
  s[1] = v[3];
  s[2] = '/';
  s[3] = v[4];
  s[4] = v[5];
  s[5] = '/';
  s[6] = v[0] == ' ' ? '0' : v[0];
  s[7] = v[1] == ' ' ? '0' : v[1];
  return (s);
}


x86 assembly (clang, -O0):
<Dtfmt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,0x8(%rax)
cmpq   $0x65,-0x10(%rbp)
jge    116c <Dtfmt+0x5c>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
je     115f <Dtfmt+0x4f>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
movb   $0x20,(%rax,%rcx,1)
jmp    113a <Dtfmt+0x2a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    124e <Dtfmt+0x13e>
mov    -0x10(%rbp),%rax
mov    $0xf4240,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x10(%rbp)
lea    -0x23(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe73(%rip),%rsi
call   1030 <sprintf@plt>
movsbl -0x21(%rbp),%eax
cmp    $0x30,%eax
jne    11ac <Dtfmt+0x9c>
mov    $0x20,%eax
mov    %eax,-0x28(%rbp)
jmp    11b3 <Dtfmt+0xa3>
movsbl -0x21(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x18(%rbp),%rax
movb   $0x2f,0x2(%rax)
mov    -0x1f(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x1e(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x4(%rax)
mov    -0x18(%rbp),%rax
movb   $0x2f,0x5(%rax)
movsbl -0x23(%rbp),%eax
cmp    $0x20,%eax
jne    1206 <Dtfmt+0xf6>
mov    $0x30,%eax
mov    %eax,-0x2c(%rbp)
jmp    120d <Dtfmt+0xfd>
movsbl -0x23(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x6(%rax)
movsbl -0x22(%rbp),%eax
cmp    $0x20,%eax
jne    1233 <Dtfmt+0x123>
mov    $0x30,%eax
mov    %eax,-0x30(%rbp)
jmp    123a <Dtfmt+0x12a>
movsbl -0x22(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x7(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Dtfmt>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movb   $0x0,0x8(%rsi)
cmp    $0x64,%rdi
jg     1134 <Dtfmt+0x24>
movabs $0x2020202020202020,%rax
20 20 20
mov    %rax,(%rbx)
jmp    11b6 <Dtfmt+0xa6>
mov    %rdi,%rcx
movabs $0x431bde82d7b634db,%rdx
de 1b 43
mov    %rdi,%rax
mul    %rdx
shr    $0x12,%rdx
imul   $0xf4240,%rdx,%rax
sub    %rax,%rcx
lea    0xea4(%rip),%rsi
lea    0x9(%rsp),%rdi
mov    %rcx,%rdx
call   1030 <sprintf@plt>
movzbl 0xb(%rsp),%eax
cmp    $0x30,%al
mov    $0x20,%ecx
cmovne %eax,%ecx
mov    %cl,(%rbx)
mov    0xc(%rsp),%al
mov    %al,0x1(%rbx)
movb   $0x2f,0x2(%rbx)
mov    0xd(%rsp),%al
mov    %al,0x3(%rbx)
mov    0xe(%rsp),%al
mov    %al,0x4(%rbx)
movb   $0x2f,0x5(%rbx)
movzbl 0x9(%rsp),%eax
cmp    $0x20,%al
mov    $0x30,%ecx
cmove  %ecx,%eax
mov    %al,0x6(%rbx)
movzbl 0xa(%rsp),%eax
cmp    $0x20,%al
cmove  %ecx,%eax
mov    %al,0x7(%rbx)
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%6ld\00"
define i8* @Dtfmt(i64 %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [7 x i8]
store i64 %0, i64* %4
store i8* %1, i8** %5
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i64 8
store i8 0, i8* %9
%10 = load i64, i64* %4
%11 = icmp slt i64 %10, 101
br i1 %11, label %12, label %24
12: ; preds = %2
store i32 0, i32* %6
br label %13
13: ; preds = %16, %12
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 8
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i8*, i8** %5
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
%20 = sext i32 %18 to i64
%21 = getelementptr inbounds i8, i8* %17, i64 %20
store i8 32, i8* %21
br label %13
22: ; preds = %13
%23 = load i8*, i8** %5
store i8* %23, i8** %3
br label %89
24: ; preds = %2
%25 = load i64, i64* %4
%26 = srem i64 %25, 1000000
store i64 %26, i64* %4
%27 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%28 = load i64, i64* %4
%29 = call i32 @sprintf(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %28)
%30 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 2
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 48
br i1 %33, label %34, label %35
34: ; preds = %24
br label %39
35: ; preds = %24
%36 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 2
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
br label %39
39: ; preds = %35, %34
%40 = phi i32 [ 32, %34 ], [ %38, %35 ]
%41 = trunc i32 %40 to i8
%42 = load i8*, i8** %5
%43 = getelementptr inbounds i8, i8* %42, i64 0
store i8 %41, i8* %43
%44 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 3
%45 = load i8, i8* %44
%46 = load i8*, i8** %5
%47 = getelementptr inbounds i8, i8* %46, i64 1
store i8 %45, i8* %47
%48 = load i8*, i8** %5
%49 = getelementptr inbounds i8, i8* %48, i64 2
store i8 47, i8* %49
%50 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 4
%51 = load i8, i8* %50
%52 = load i8*, i8** %5
%53 = getelementptr inbounds i8, i8* %52, i64 3
store i8 %51, i8* %53
%54 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 5
%55 = load i8, i8* %54
%56 = load i8*, i8** %5
%57 = getelementptr inbounds i8, i8* %56, i64 4
store i8 %55, i8* %57
%58 = load i8*, i8** %5
%59 = getelementptr inbounds i8, i8* %58, i64 5
store i8 47, i8* %59
%60 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 32
br i1 %63, label %64, label %65
64: ; preds = %39
br label %69
65: ; preds = %39
%66 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 0
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
br label %69
69: ; preds = %65, %64
%70 = phi i32 [ 48, %64 ], [ %68, %65 ]
%71 = trunc i32 %70 to i8
%72 = load i8*, i8** %5
%73 = getelementptr inbounds i8, i8* %72, i64 6
store i8 %71, i8* %73
%74 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 1
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = icmp eq i32 %76, 32
br i1 %77, label %78, label %79
78: ; preds = %69
br label %83
79: ; preds = %69
%80 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 1
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
br label %83
83: ; preds = %79, %78
%84 = phi i32 [ 48, %78 ], [ %82, %79 ]
%85 = trunc i32 %84 to i8
%86 = load i8*, i8** %5
%87 = getelementptr inbounds i8, i8* %86, i64 7
store i8 %85, i8* %87
%88 = load i8*, i8** %5
store i8* %88, i8** %3
br label %89
89: ; preds = %83, %22
%90 = load i8*, i8** %3
ret i8* %90
}

LLVM IR (-O2):
@.str = [5 x i8] c"%6ld\00"
define i8* @Dtfmt(i64 %0, i8* returned writeonly %1) {
%3 = alloca [7 x i8]
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8, i8* %1, i64 8
store i8 0, i8* %5
%6 = icmp slt i64 %0, 101
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = bitcast i8* %1 to i64*
store i64 2314885530818453536, i64* %8
br label %36
9: ; preds = %2
%10 = urem i64 %0, 1000000
%11 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 2
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 48
%15 = select i1 %14, i8 32, i8 %13
store i8 %15, i8* %1
%16 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 3
%17 = load i8, i8* %16
%18 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %17, i8* %18
%19 = getelementptr inbounds i8, i8* %1, i64 2
store i8 47, i8* %19
%20 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 4
%21 = load i8, i8* %20
%22 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %21, i8* %22
%23 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 5
%24 = load i8, i8* %23
%25 = getelementptr inbounds i8, i8* %1, i64 4
store i8 %24, i8* %25
%26 = getelementptr inbounds i8, i8* %1, i64 5
store i8 47, i8* %26
%27 = load i8, i8* %4
%28 = icmp eq i8 %27, 32
%29 = select i1 %28, i8 48, i8 %27
%30 = getelementptr inbounds i8, i8* %1, i64 6
store i8 %29, i8* %30
%31 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 1
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 32
%34 = select i1 %33, i8 48, i8 %32
%35 = getelementptr inbounds i8, i8* %1, i64 7
store i8 %34, i8* %35
br label %36
36: ; preds = %7, %9
ret i8* %1
}