int check_valid_birth_date(char *id) {
  if (id[0] < '0' || id[0] > '9')
    return 0;
  if (id[1] < '0' || id[1] > '9')
    return 0;
  if (id[2] < '0' || id[2] > '5')
    return 0;
  else {
    if (id[2] == '1' || id[3] > '2')
      return 0;
    if (id[2] == '3' || id[3] > '2')
      return 0;
    if (id[2] == '5' || id[3] > '2')
      return 0;
  }
  if (id[4] < '0' || id[4] > '3')
    return 0;
  if (id[4] == '3' && id[5] > '1')
    return 0;
  if (id[5] < '0' || id[5] > '9')
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<check_valid_birth_date>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     1128 <check_valid_birth_date+0x28>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jle    1134 <check_valid_birth_date+0x34>
movl   $0x0,-0x4(%rbp)
jmp    12b0 <check_valid_birth_date+0x1b0>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x30,%eax
jl     1156 <check_valid_birth_date+0x56>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x39,%eax
jle    1162 <check_valid_birth_date+0x62>
movl   $0x0,-0x4(%rbp)
jmp    12b0 <check_valid_birth_date+0x1b0>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x30,%eax
jl     1184 <check_valid_birth_date+0x84>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x35,%eax
jle    1190 <check_valid_birth_date+0x90>
movl   $0x0,-0x4(%rbp)
jmp    12b0 <check_valid_birth_date+0x1b0>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x31,%eax
je     11b2 <check_valid_birth_date+0xb2>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x32,%eax
jle    11be <check_valid_birth_date+0xbe>
movl   $0x0,-0x4(%rbp)
jmp    12b0 <check_valid_birth_date+0x1b0>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x33,%eax
je     11e0 <check_valid_birth_date+0xe0>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x32,%eax
jle    11ec <check_valid_birth_date+0xec>
movl   $0x0,-0x4(%rbp)
jmp    12b0 <check_valid_birth_date+0x1b0>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x35,%eax
je     120e <check_valid_birth_date+0x10e>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x32,%eax
jle    121a <check_valid_birth_date+0x11a>
movl   $0x0,-0x4(%rbp)
jmp    12b0 <check_valid_birth_date+0x1b0>
jmp    121f <check_valid_birth_date+0x11f>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x30,%eax
jl     1241 <check_valid_birth_date+0x141>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x33,%eax
jle    124d <check_valid_birth_date+0x14d>
movl   $0x0,-0x4(%rbp)
jmp    12b0 <check_valid_birth_date+0x1b0>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x33,%eax
jne    127b <check_valid_birth_date+0x17b>
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
cmp    $0x31,%eax
jle    127b <check_valid_birth_date+0x17b>
movl   $0x0,-0x4(%rbp)
jmp    12b0 <check_valid_birth_date+0x1b0>
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
cmp    $0x30,%eax
jl     129d <check_valid_birth_date+0x19d>
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
cmp    $0x39,%eax
jle    12a9 <check_valid_birth_date+0x1a9>
movl   $0x0,-0x4(%rbp)
jmp    12b0 <check_valid_birth_date+0x1b0>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_valid_birth_date>:
mov    (%rdi),%cl
add    $0xc6,%cl
xor    %eax,%eax
cmp    $0xf6,%cl
jb     115a <check_valid_birth_date+0x5a>
mov    0x1(%rdi),%cl
add    $0xc6,%cl
cmp    $0xf6,%cl
jb     115a <check_valid_birth_date+0x5a>
mov    0x2(%rdi),%cl
cmp    $0x31,%cl
je     115a <check_valid_birth_date+0x5a>
lea    -0x36(%rcx),%edx
cmp    $0xfa,%dl
jb     115a <check_valid_birth_date+0x5a>
cmpb   $0x32,0x3(%rdi)
jg     115a <check_valid_birth_date+0x5a>
cmp    $0x33,%cl
je     115a <check_valid_birth_date+0x5a>
cmp    $0x35,%cl
je     115a <check_valid_birth_date+0x5a>
mov    0x4(%rdi),%dl
lea    -0x34(%rdx),%ecx
cmp    $0xfc,%cl
jb     115a <check_valid_birth_date+0x5a>
mov    0x5(%rdi),%cl
cmp    $0x33,%dl
jne    114f <check_valid_birth_date+0x4f>
cmp    $0x31,%cl
jg     115a <check_valid_birth_date+0x5a>
add    $0xd0,%cl
xor    %eax,%eax
cmp    $0xa,%cl
setb   %al
ret

LLVM IR (-O0):
define i32 @check_valid_birth_date(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp slt i32 %7, 48
br i1 %8, label %15, label %9
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp sgt i32 %13, 57
br i1 %14, label %15, label %16
15: ; preds = %9, %1
store i32 0, i32* %2
br label %122
16: ; preds = %9
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp slt i32 %20, 48
br i1 %21, label %28, label %22
22: ; preds = %16
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp sgt i32 %26, 57
br i1 %27, label %28, label %29
28: ; preds = %22, %16
store i32 0, i32* %2
br label %122
29: ; preds = %22
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i64 2
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp slt i32 %33, 48
br i1 %34, label %41, label %35
35: ; preds = %29
%36 = load i8*, i8** %3
%37 = getelementptr inbounds i8, i8* %36, i64 2
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp sgt i32 %39, 53
br i1 %40, label %41, label %42
41: ; preds = %35, %29
store i32 0, i32* %2
br label %122
42: ; preds = %35
%43 = load i8*, i8** %3
%44 = getelementptr inbounds i8, i8* %43, i64 2
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 49
br i1 %47, label %54, label %48
48: ; preds = %42
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i64 3
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp sgt i32 %52, 50
br i1 %53, label %54, label %55
54: ; preds = %48, %42
store i32 0, i32* %2
br label %122
55: ; preds = %48
%56 = load i8*, i8** %3
%57 = getelementptr inbounds i8, i8* %56, i64 2
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 51
br i1 %60, label %67, label %61
61: ; preds = %55
%62 = load i8*, i8** %3
%63 = getelementptr inbounds i8, i8* %62, i64 3
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp sgt i32 %65, 50
br i1 %66, label %67, label %68
67: ; preds = %61, %55
store i32 0, i32* %2
br label %122
68: ; preds = %61
%69 = load i8*, i8** %3
%70 = getelementptr inbounds i8, i8* %69, i64 2
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 53
br i1 %73, label %80, label %74
74: ; preds = %68
%75 = load i8*, i8** %3
%76 = getelementptr inbounds i8, i8* %75, i64 3
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp sgt i32 %78, 50
br i1 %79, label %80, label %81
80: ; preds = %74, %68
store i32 0, i32* %2
br label %122
81: ; preds = %74
br label %82
82: ; preds = %81
%83 = load i8*, i8** %3
%84 = getelementptr inbounds i8, i8* %83, i64 4
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = icmp slt i32 %86, 48
br i1 %87, label %94, label %88
88: ; preds = %82
%89 = load i8*, i8** %3
%90 = getelementptr inbounds i8, i8* %89, i64 4
%91 = load i8, i8* %90
%92 = sext i8 %91 to i32
%93 = icmp sgt i32 %92, 51
br i1 %93, label %94, label %95
94: ; preds = %88, %82
store i32 0, i32* %2
br label %122
95: ; preds = %88
%96 = load i8*, i8** %3
%97 = getelementptr inbounds i8, i8* %96, i64 4
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = icmp eq i32 %99, 51
br i1 %100, label %101, label %108
101: ; preds = %95
%102 = load i8*, i8** %3
%103 = getelementptr inbounds i8, i8* %102, i64 5
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
%106 = icmp sgt i32 %105, 49
br i1 %106, label %107, label %108
107: ; preds = %101
store i32 0, i32* %2
br label %122
108: ; preds = %101, %95
%109 = load i8*, i8** %3
%110 = getelementptr inbounds i8, i8* %109, i64 5
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = icmp slt i32 %112, 48
br i1 %113, label %120, label %114
114: ; preds = %108
%115 = load i8*, i8** %3
%116 = getelementptr inbounds i8, i8* %115, i64 5
%117 = load i8, i8* %116
%118 = sext i8 %117 to i32
%119 = icmp sgt i32 %118, 57
br i1 %119, label %120, label %121
120: ; preds = %114, %108
store i32 0, i32* %2
br label %122
121: ; preds = %114
store i32 1, i32* %2
br label %122
122: ; preds = %121, %120, %107, %94, %80, %67, %54, %41, %28, %15
%123 = load i32, i32* %2
ret i32 %123
}

LLVM IR (-O2):
define i32 @check_valid_birth_date(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -58
%4 = icmp ult i8 %3, -10
br i1 %4, label %37, label %5
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = add i8 %7, -58
%9 = icmp ult i8 %8, -10
br i1 %9, label %37, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = load i8, i8* %11
%13 = add i8 %12, -54
%14 = icmp ult i8 %13, -6
%15 = icmp eq i8 %12, 49
%16 = or i1 %15, %14
br i1 %16, label %37, label %17
17: ; preds = %10
%18 = getelementptr inbounds i8, i8* %0, i64 3
%19 = load i8, i8* %18
%20 = icmp sgt i8 %19, 50
br i1 %20, label %37, label %21
21: ; preds = %17
switch i8 %12, label %22 [
i8 51, label %37
i8 53, label %37
]
22: ; preds = %21
%23 = getelementptr inbounds i8, i8* %0, i64 4
%24 = load i8, i8* %23
%25 = add i8 %24, -52
%26 = icmp ult i8 %25, -4
br i1 %26, label %37, label %27
27: ; preds = %22
%28 = icmp eq i8 %24, 51
%29 = getelementptr inbounds i8, i8* %0, i64 5
%30 = load i8, i8* %29
%31 = icmp sgt i8 %30, 49
%32 = select i1 %28, i1 %31, i1 false
br i1 %32, label %37, label %33
33: ; preds = %27
%34 = add i8 %30, -48
%35 = icmp ult i8 %34, 10
%36 = zext i1 %35 to i32
br label %37
37: ; preds = %27, %33, %22, %21, %21, %17, %10, %5, %1
%38 = phi i32 [ 0, %1 ], [ 0, %5 ], [ 0, %10 ], [ 0, %17 ], [ 0, %21 ], [ 0, %21 ], [ 0, %22 ], [ %36, %33 ], [ 0, %27 ]
ret i32 %38
}