int checknum(s)
char const *s;
{
  register char const *sp;
  register int dotcount = 0;
  for (sp = s;; sp++) {
    switch (*sp) {
    case 0:
      if (dotcount & 1)
        return 1;
      else
        break;
    case '.':
      dotcount++;
      continue;
    default:
      if ((((unsigned)(*sp) - '0') <= 9))
        continue;
      break;
    }
    break;
  }
  workerror("%s is not a revision number", s);
  return 0;
}


x86 assembly (clang, -O0):
<checknum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x20(%rbp)
test   %eax,%eax
je     1153 <checknum+0x43>
jmp    1142 <checknum+0x32>
mov    -0x20(%rbp),%eax
sub    $0x2e,%eax
je     1173 <checknum+0x63>
jmp    1181 <checknum+0x71>
mov    -0x1c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     116e <checknum+0x5e>
movl   $0x1,-0x4(%rbp)
jmp    11cd <checknum+0xbd>
jmp    119e <checknum+0x8e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a3 <checknum+0x93>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
cmp    $0x9,%eax
ja     1199 <checknum+0x89>
jmp    11a3 <checknum+0x93>
jmp    119e <checknum+0x8e>
jmp    11b4 <checknum+0xa4>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    112b <checknum+0x1b>
mov    -0x10(%rbp),%rsi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <workerror@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checknum>:
push   %rbx
mov    %rdi,%rsi
xor    %eax,%eax
mov    %rdi,%rcx
jmp    1127 <checknum+0x17>
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
add    $0x1,%rcx
movsbl (%rcx),%edx
cmp    $0x2e,%edx
je     1120 <checknum+0x10>
test   %edx,%edx
je     1141 <checknum+0x31>
add    $0xffffffd0,%edx
cmp    $0x9,%edx
ja     114a <checknum+0x3a>
add    $0x1,%rcx
jmp    1127 <checknum+0x17>
mov    $0x1,%ebx
test   $0x1,%al
jne    115a <checknum+0x4a>
lea    0xeaf(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <workerror@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"%s is not a revision number\00"
define i32 @checknum(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %5
%6 = load i8*, i8** %3
store i8* %6, i8** %4
br label %7
7: ; preds = %29, %1
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
switch i32 %10, label %20 [
i32 0, label %11
i32 46, label %17
]
11: ; preds = %7
%12 = load i32, i32* %5
%13 = and i32 %12, 1
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 1, i32* %2
br label %35
16: ; preds = %11
br label %28
17: ; preds = %7
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %29
20: ; preds = %7
%21 = load i8*, i8** %4
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = sub i32 %23, 48
%25 = icmp ule i32 %24, 9
br i1 %25, label %26, label %27
26: ; preds = %20
br label %29
27: ; preds = %20
br label %28
28: ; preds = %27, %16
br label %32
29: ; preds = %26, %17
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %4
br label %7
32: ; preds = %28
%33 = load i8*, i8** %3
%34 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @workerror to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %33)
store i32 0, i32* %2
br label %35
35: ; preds = %32, %15
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
@.str = [28 x i8] c"%s is not a revision number\00"
define i32 @checknum(i8* %0) {
br label %2
2: ; preds = %15, %1
%3 = phi i8* [ %0, %1 ], [ %17, %15 ]
%4 = phi i32 [ 0, %1 ], [ %16, %15 ]
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
switch i32 %6, label %12 [
i32 0, label %7
i32 46, label %10
]
7: ; preds = %2
%8 = and i32 %4, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %18, label %20
10: ; preds = %2
%11 = add nsw i32 %4, 1
br label %15
12: ; preds = %2
%13 = add nsw i32 %6, -48
%14 = icmp ult i32 %13, 10
br i1 %14, label %15, label %18
15: ; preds = %12, %10
%16 = phi i32 [ %4, %12 ], [ %11, %10 ]
%17 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
18: ; preds = %12, %7
%19 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @workerror to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %20
20: ; preds = %7, %18
%21 = phi i32 [ 0, %18 ], [ 1, %7 ]
ret i32 %21
}