#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
main() {
  char data[11];
  char d[3], m[3], a[5];
  int i, tam;
  printf("Entre com uma data: ");
  gets(data);
  for (i = 0; i < 11; i++) {
    if (i < 2)
      d[i] = data[i];
    if ((i > 2) && (i < 5))
      m[i - 3] = data[i];
    if (i > 5)
      a[i - 6] = data[i];
  }
  d[2] = '\0';
  m[2] = '\0';
  printf("Dia %s, mes %s, ano %s", d, m, a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xf(%rbp),%rdi
call   1040 <gets@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0xb,-0x20(%rbp)
jge    11ca <main+0xaa>
cmpl   $0x2,-0x20(%rbp)
jge    1171 <main+0x51>
movslq -0x20(%rbp),%rax
mov    -0xf(%rbp,%rax,1),%cl
movslq -0x20(%rbp),%rax
mov    %cl,-0x12(%rbp,%rax,1)
cmpl   $0x2,-0x20(%rbp)
jle    1199 <main+0x79>
cmpl   $0x5,-0x20(%rbp)
jge    1199 <main+0x79>
movslq -0x20(%rbp),%rax
mov    -0xf(%rbp,%rax,1),%cl
mov    -0x20(%rbp),%eax
sub    $0x3,%eax
cltq
mov    %cl,-0x15(%rbp,%rax,1)
cmpl   $0x5,-0x20(%rbp)
jle    11b7 <main+0x97>
movslq -0x20(%rbp),%rax
mov    -0xf(%rbp,%rax,1),%cl
mov    -0x20(%rbp),%eax
sub    $0x6,%eax
cltq
mov    %cl,-0x1a(%rbp,%rax,1)
jmp    11bc <main+0x9c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114d <main+0x2d>
movb   $0x0,-0x10(%rbp)
movb   $0x0,-0x13(%rbp)
lea    -0x12(%rbp),%rsi
lea    -0x15(%rbp),%rdx
lea    -0x1a(%rbp),%rcx
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd(%rsp),%rdi
call   1040 <gets@plt>
movzwl 0xd(%rsp),%eax
movzwl 0x10(%rsp),%ecx
mov    %ax,0x5(%rsp)
mov    %cx,0x2(%rsp)
mov    0x13(%rsp),%al
mov    %al,0x8(%rsp)
mov    0x14(%rsp),%eax
mov    %eax,0x9(%rsp)
movb   $0x0,0x7(%rsp)
movb   $0x0,0x4(%rsp)
lea    0xea4(%rip),%rdi
lea    0x5(%rsp),%rsi
lea    0x2(%rsp),%rdx
lea    0x8(%rsp),%rcx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Entre com uma data: \00"
@.str.1 = [23 x i8] c"Dia %s, mes %s, ano %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
%3 = alloca [3 x i8]
%4 = alloca [3 x i8]
%5 = alloca [5 x i8]
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%10 = call i32 @gets(i8* %9)
store i32 0, i32* %6
br label %11
11: ; preds = %53, %0
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 11
br i1 %13, label %14, label %56
14: ; preds = %11
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 %23
store i8 %21, i8* %24
br label %25
25: ; preds = %17, %14
%26 = load i32, i32* %6
%27 = icmp sgt i32 %26, 2
br i1 %27, label %28, label %40
28: ; preds = %25
%29 = load i32, i32* %6
%30 = icmp slt i32 %29, 5
br i1 %30, label %31, label %40
31: ; preds = %28
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = load i32, i32* %6
%37 = sub nsw i32 %36, 3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 %38
store i8 %35, i8* %39
br label %40
40: ; preds = %31, %28, %25
%41 = load i32, i32* %6
%42 = icmp sgt i32 %41, 5
br i1 %42, label %43, label %52
43: ; preds = %40
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = load i32, i32* %6
%49 = sub nsw i32 %48, 6
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 %50
store i8 %47, i8* %51
br label %52
52: ; preds = %43, %40
br label %53
53: ; preds = %52
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
store i32 %55, i32* %6
br label %11
56: ; preds = %11
%57 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 2
store i8 0, i8* %57
%58 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 2
store i8 0, i8* %58
%59 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%60 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%61 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %59, i8* %60, i8* %61)
%63 = load i32, i32* %1
ret i32 %63
}

LLVM IR (-O2):
@.str = [21 x i8] c"Entre com uma data: \00"
@.str.1 = [23 x i8] c"Dia %s, mes %s, ano %s\00"
define i32 @main() {
%1 = alloca [11 x i8]
%2 = alloca [3 x i8]
%3 = alloca [3 x i8]
%4 = alloca [5 x i8]
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @gets(i8* %5)
%11 = load i8, i8* %5
store i8 %11, i8* %6
%12 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 1
%13 = load i8, i8* %12
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
store i8 %13, i8* %14
%15 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 3
%16 = load i8, i8* %15
%17 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
store i8 %16, i8* %17
%18 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 4
%19 = load i8, i8* %18
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 1
store i8 %19, i8* %20
%21 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 6
%22 = load i8, i8* %21
%23 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
store i8 %22, i8* %23
%24 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 7
%25 = load i8, i8* %24
%26 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 1
store i8 %25, i8* %26
%27 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 8
%28 = load i8, i8* %27
%29 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 2
store i8 %28, i8* %29
%30 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 9
%31 = load i8, i8* %30
%32 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 3
store i8 %31, i8* %32
%33 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 10
%34 = load i8, i8* %33
%35 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 4
store i8 %34, i8* %35
%36 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 2
store i8 0, i8* %36
%37 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 2
store i8 0, i8* %37
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %7, i8* %8)
ret i32 0
}