#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *midstr(char *, char *, int, int);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
int strlen(char *);
int main(int argc, char **argv) {
  char year[32];
  char month[32];
  char day[32];
  if (argc != 2 || strlen(argv[1]) < 8) {
    fprintf(stderr, "Usage: %s MM/DD/YY\n", argv[0]);
    exit(1);
  }
  printf("%s%s%s\n", midstr(year, argv[1], 6, 2), midstr(month, argv[1], 0, 2),
         midstr(day, argv[1], 3, 2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1189 <main+0x39>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <strlen@plt>
cmp    $0x8,%eax
jge    11af <main+0x5f>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe60(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x6,%edx
mov    $0x2,%ecx
call   1060 <midstr@plt>
mov    %rax,-0x80(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
xor    %edx,%edx
mov    $0x2,%ecx
call   1060 <midstr@plt>
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x3,%edx
mov    $0x2,%ecx
call   1060 <midstr@plt>
mov    -0x80(%rbp),%rsi
mov    -0x78(%rbp),%rdx
mov    %rax,%rcx
lea    0xdfd(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    11d9 <main+0x89>
mov    0x8(%rbx),%rdi
call   1030 <strlen@plt>
cmp    $0x7,%eax
jle    11d9 <main+0x89>
mov    0x8(%rbx),%rsi
lea    0x40(%rsp),%rdi
mov    $0x6,%edx
mov    $0x2,%ecx
call   1060 <midstr@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rsi
lea    0x20(%rsp),%rdi
xor    %edx,%edx
mov    $0x2,%ecx
call   1060 <midstr@plt>
mov    %rax,%r15
mov    0x8(%rbx),%rsi
mov    %rsp,%rdi
mov    $0x3,%edx
mov    $0x2,%ecx
call   1060 <midstr@plt>
lea    0xe55(%rip),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %rax,%rcx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e00(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe14(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s MM/DD/YY\0A\00"
@.str.1 = [8 x i8] c"%s%s%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [32 x i8]
%7 = alloca [32 x i8]
%8 = alloca [32 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %17, label %11
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strlen(i8* %14)
%16 = icmp slt i32 %15, 8
br i1 %16, label %17, label %24
17: ; preds = %11, %2
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %11
%25 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i8* @midstr(i8* %25, i8* %28, i32 6, i32 2)
%30 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i8* @midstr(i8* %30, i8* %33, i32 0, i32 2)
%35 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i8* @midstr(i8* %35, i8* %38, i32 3, i32 2)
%40 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %29, i8* %34, i8* %39)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s MM/DD/YY\0A\00"
@.str.1 = [8 x i8] c"%s%s%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32 x i8]
%4 = alloca [32 x i8]
%5 = alloca [32 x i8]
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @strlen(i8* %12)
%14 = icmp slt i32 %13, 8
br i1 %14, label %15, label %20
15: ; preds = %10, %2
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %1
%18 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %10
%21 = load i8*, i8** %11
%22 = call i8* @midstr(i8* %6, i8* %21, i32 6, i32 2)
%23 = load i8*, i8** %11
%24 = call i8* @midstr(i8* %7, i8* %23, i32 0, i32 2)
%25 = load i8*, i8** %11
%26 = call i8* @midstr(i8* %8, i8* %25, i32 3, i32 2)
%27 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %22, i8* %24, i8* %26)
ret i32 0
}