#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*/ digits_to_string(char *, int, int);
int /*<<< orphan*/ printf(char *, char *);
void date_stamp(int year, int month, int day) {
  char stamp[10];
  stamp[0] = '\0';
  digits_to_string(stamp, year, 9999);
  printf("%s/", stamp);
  stamp[0] = '\0';
  digits_to_string(stamp, month, 12);
  printf("%s/", stamp);
  stamp[0] = '\0';
  digits_to_string(stamp, day, 31);
  printf("%s", stamp);
  return;
}


x86 assembly (clang, -O0):
<date_stamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movb   $0x0,-0x16(%rbp)
lea    -0x16(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x270f,%edx
call   1040 <digits_to_string@plt>
lea    -0x16(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
movb   $0x0,-0x16(%rbp)
lea    -0x16(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    $0xc,%edx
call   1040 <digits_to_string@plt>
lea    -0x16(%rbp),%rsi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
movb   $0x0,-0x16(%rbp)
lea    -0x16(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x1f,%edx
call   1040 <digits_to_string@plt>
lea    -0x16(%rbp),%rsi
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_stamp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%esi
movb   $0x0,0xe(%rsp)
lea    0xe(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x270f,%edx
call   1040 <digits_to_string@plt>
lea    0xeb1(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
movb   $0x0,0xe(%rsp)
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0xc,%edx
call   1040 <digits_to_string@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
movb   $0x0,0xe(%rsp)
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0x1f,%edx
call   1040 <digits_to_string@plt>
lea    0xe6f(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s/\00"
@.str.1 = [3 x i8] c"%s\00"
define void @date_stamp(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [10 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
store i8 0, i8* %8
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%10 = load i32, i32* %4
%11 = call i32 @digits_to_string(i8* %9, i32 %10, i32 9999)
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
store i8 0, i8* %14
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%16 = load i32, i32* %5
%17 = call i32 @digits_to_string(i8* %15, i32 %16, i32 12)
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
store i8 0, i8* %20
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%22 = load i32, i32* %6
%23 = call i32 @digits_to_string(i8* %21, i32 %22, i32 31)
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %24)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s/\00"
@.str.1 = [3 x i8] c"%s\00"
define void @date_stamp(i32 %0, i32 %1, i32 %2) {
%4 = alloca [10 x i8]
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
store i8 0, i8* %5
%6 = call i32 @digits_to_string(i8* %5, i32 %0, i32 9999)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
store i8 0, i8* %5
%8 = call i32 @digits_to_string(i8* %5, i32 %1, i32 12)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
store i8 0, i8* %5
%10 = call i32 @digits_to_string(i8* %5, i32 %2, i32 31)
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret void
}