#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*/ printf(char *, ...);
int main() {
  char datum[] = "2015-08-26";
  char *c = &datum[0];
  int i = 0;
  while (*(c + i) != '\0') {
    if ((*(c + i) >= 48 && *(c + i) <= 57) && (i != 4) && (i != 7))
      i++;
    else if ((i == 4 && (*(c + i) == '-')) || (i == 7 && (*(c + i) == '-')))
      i++;
    else {
      printf("Nejedná sa o formát dátumu\n");
      break;
    }
  }
  printf("%d\n", i);
  if (*(c + i) == '\0')
    printf("Všetko je okej -> %s\n", c);
  else
    printf("Niečo sa dojebalo.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0xf(%rbp)
mov    0xed7(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xecf(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0xf(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1217 <main+0x107>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     11ae <main+0x9e>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jg     11ae <main+0x9e>
cmpl   $0x4,-0x1c(%rbp)
je     11ae <main+0x9e>
cmpl   $0x7,-0x1c(%rbp)
je     11ae <main+0x9e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1212 <main+0x102>
cmpl   $0x4,-0x1c(%rbp)
jne    11cd <main+0xbd>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
je     11ec <main+0xdc>
cmpl   $0x7,-0x1c(%rbp)
jne    11fa <main+0xea>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
jne    11fa <main+0xea>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    120d <main+0xfd>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1217 <main+0x107>
jmp    1212 <main+0x102>
jmp    114d <main+0x3d>
mov    -0x1c(%rbp),%esi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    1254 <main+0x144>
mov    -0x18(%rbp),%rsi
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x152>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0x2d38302d35313032,%rax
30 38 2d
mov    %rax,0x8(%rsp)
movl   $0x36322d,0xf(%rsp)
mov    $0x32,%al
xor    %ebx,%ebx
jmp    1161 <main+0x41>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x2d,%al
jne    118a <main+0x6a>
movzbl 0x9(%rsp,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
je     1196 <main+0x76>
cmp    $0x30,%al
jl     1180 <main+0x60>
cmp    $0x39,%al
ja     1180 <main+0x60>
cmp    $0x4,%ebx
je     118a <main+0x6a>
cmp    $0x7,%ebx
jne    1154 <main+0x34>
jmp    118a <main+0x6a>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x7,%ebx
je     1150 <main+0x30>
cmp    $0x4,%ebx
je     1150 <main+0x30>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%r14d
lea    0xe6b(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpb   $0x0,0x8(%rsp,%r14,1)
je     11bf <main+0x9f>
lea    0xe6e(%rip),%rdi
call   1030 <puts@plt>
jmp    11d2 <main+0xb2>
lea    0xe49(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.datum = [11 x i8] c"2015-08-26\00"
@.str = [31 x i8] c"Nejedn\C3\A1 sa o form\C3\A1t d\C3\A1tumu\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [23 x i8] c"V\C5\A1etko je okej -> %s\0A\00"
@.str.3 = [21 x i8] c"Nie\C4\8Do sa dojebalo.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [11 x i8]* %2 to i8*
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
store i8* %6, i8** %3
store i32 0, i32* %4
br label %7
7: ; preds = %68, %0
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %69
15: ; preds = %7
%16 = load i8*, i8** %3
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp sge i32 %21, 48
br i1 %22, label %23, label %40
23: ; preds = %15
%24 = load i8*, i8** %3
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp sle i32 %29, 57
br i1 %30, label %31, label %40
31: ; preds = %23
%32 = load i32, i32* %4
%33 = icmp ne i32 %32, 4
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = load i32, i32* %4
%36 = icmp ne i32 %35, 7
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %68
40: ; preds = %34, %31, %23, %15
%41 = load i32, i32* %4
%42 = icmp eq i32 %41, 4
br i1 %42, label %43, label %51
43: ; preds = %40
%44 = load i8*, i8** %3
%45 = load i32, i32* %4
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 45
br i1 %50, label %62, label %51
51: ; preds = %43, %40
%52 = load i32, i32* %4
%53 = icmp eq i32 %52, 7
br i1 %53, label %54, label %65
54: ; preds = %51
%55 = load i8*, i8** %3
%56 = load i32, i32* %4
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 45
br i1 %61, label %62, label %65
62: ; preds = %54, %43
%63 = load i32, i32* %4
%64 = add nsw i32 %63, 1
store i32 %64, i32* %4
br label %67
65: ; preds = %54, %51
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %69
67: ; preds = %62
br label %68
68: ; preds = %67, %37
br label %7
69: ; preds = %65, %7
%70 = load i32, i32* %4
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %70)
%72 = load i8*, i8** %3
%73 = load i32, i32* %4
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8, i8* %72, i64 %74
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %69
%80 = load i8*, i8** %3
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %80)
br label %84
82: ; preds = %69
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %84
84: ; preds = %82, %79
ret i32 0
}

LLVM IR (-O2):
@__const.main.datum = [11 x i8] c"2015-08-26\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [23 x i8] c"V\C5\A1etko je okej -> %s\0A\00"
@str = [20 x i8] c"Nie\C4\8Do sa dojebalo.\00"
@str.4 = [30 x i8] c"Nejedn\C3\A1 sa o form\C3\A1t d\C3\A1tumu\00"
define i32 @main() {
%1 = alloca [11 x i8]
%2 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %19
%4 = phi i64 [ 0, %0 ], [ %20, %19 ]
%5 = phi i8 [ 50, %0 ], [ %22, %19 ]
%6 = icmp sgt i8 %5, 47
%7 = freeze i8 %5
%8 = icmp ult i8 %7, 58
%9 = and i1 %6, %8
%10 = trunc i64 %4 to i32
br i1 %9, label %11, label %12
11: ; preds = %3
switch i32 %10, label %19 [
i32 4, label %17
i32 7, label %17
]
12: ; preds = %3
switch i32 %10, label %17 [
i32 4, label %13
i32 7, label %15
]
13: ; preds = %12
%14 = icmp eq i8 %7, 45
br i1 %14, label %19, label %17
15: ; preds = %12
%16 = icmp eq i8 %7, 45
br i1 %16, label %19, label %17
17: ; preds = %11, %11, %13, %12, %15
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, i64 0, i64 0))
br label %24
19: ; preds = %13, %15, %11
%20 = add nuw i64 %4, 1
%21 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %24, label %3
24: ; preds = %19, %17
%25 = phi i64 [ %4, %17 ], [ %20, %19 ]
%26 = trunc i64 %25 to i32
%27 = and i64 %25, 4294967295
%28 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 %27
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%30 = load i8, i8* %28
%31 = icmp eq i8 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %24
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %2)
br label %36
34: ; preds = %24
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
ret i32 0
}