#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 strlen(char const *);
int is_it_a_commit_id(const char *commit_id) {
  if (strlen(commit_id) != 40) {
    return 0;
  } else {
    while (*commit_id != '\0') {
      if (*commit_id != '6' && *commit_id != '1' && *commit_id != 'c') {
        return 0;
      }
      commit_id++;
    }
    return 1;
  }
}


x86 assembly (clang, -O0):
<is_it_a_commit_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x28,%eax
je     113a <is_it_a_commit_id+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    11a3 <is_it_a_commit_id+0x93>
jmp    113f <is_it_a_commit_id+0x2f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     119c <is_it_a_commit_id+0x8c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x36,%eax
je     118b <is_it_a_commit_id+0x7b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x31,%eax
je     118b <is_it_a_commit_id+0x7b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x63,%eax
je     118b <is_it_a_commit_id+0x7b>
movl   $0x0,-0x4(%rbp)
jmp    11a3 <is_it_a_commit_id+0x93>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113f <is_it_a_commit_id+0x2f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_it_a_commit_id>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x28,%ecx
jne    1155 <is_it_a_commit_id+0x45>
movabs $0x4000000000021,%rcx
nopl   0x0(%rax)
movzbl (%rbx),%edx
lea    -0x31(%rdx),%esi
cmp    $0x32,%sil
ja     114c <is_it_a_commit_id+0x3c>
movzbl %sil,%esi
bt     %rsi,%rcx
jae    114c <is_it_a_commit_id+0x3c>
add    $0x1,%rbx
jmp    1130 <is_it_a_commit_id+0x20>
test   %dl,%dl
jne    1155 <is_it_a_commit_id+0x45>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_it_a_commit_id(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strlen(i8* %4)
%6 = icmp ne i32 %5, 40
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %34
8: ; preds = %1
br label %9
9: ; preds = %30, %8
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %33
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 54
br i1 %18, label %19, label %30
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 49
br i1 %23, label %24, label %30
24: ; preds = %19
%25 = load i8*, i8** %3
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 99
br i1 %28, label %29, label %30
29: ; preds = %24
store i32 0, i32* %2
br label %34
30: ; preds = %24, %19, %14
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %3
br label %9
33: ; preds = %9
store i32 1, i32* %2
br label %34
34: ; preds = %33, %29, %7
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @is_it_a_commit_id(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 40
br i1 %3, label %4, label %10
4: ; preds = %1, %7
%5 = phi i8* [ %8, %7 ], [ %0, %1 ]
%6 = load i8, i8* %5
switch i8 %6, label %9 [
i8 0, label %10
i8 54, label %7
i8 49, label %7
i8 99, label %7
]
7: ; preds = %4, %4, %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
9: ; preds = %4
br label %10
10: ; preds = %4, %9, %1
%11 = phi i32 [ 0, %1 ], [ 0, %9 ], [ 1, %4 ]
ret i32 %11
}