#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 */
scalar_t__ isdigit(char);
int allstars(char *buffer) {
  while (isdigit(*buffer))
    ++buffer;
  while (*buffer == '\t' || *buffer == '*')
    ++buffer;
  if (*buffer == '\r')
    ++buffer;
  if (*buffer == '\n')
    ++buffer;
  return (*buffer == '\0');
}


x86 assembly (clang, -O0):
<allstars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1143 <allstars+0x33>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <allstars+0xc>
jmp    1148 <allstars+0x38>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x9(%rbp)
je     116d <allstars+0x5d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    117d <allstars+0x6d>
jmp    118e <allstars+0x7e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1148 <allstars+0x38>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
jne    11aa <allstars+0x9a>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    11c6 <allstars+0xb6>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allstars>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%rbx),%edi
call   1030 <isdigit@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1120 <allstars+0x10>
jmp    1144 <allstars+0x34>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
movzbl -0x1(%rbx),%eax
cmp    $0x9,%al
je     1140 <allstars+0x30>
cmp    $0x2a,%al
je     1140 <allstars+0x30>
cmp    $0xd,%al
jne    1158 <allstars+0x48>
mov    (%rbx),%al
jmp    115c <allstars+0x4c>
add    $0xffffffffffffffff,%rbx
xor    %ecx,%ecx
cmp    $0xa,%al
sete   %cl
xor    %eax,%eax
cmpb   $0x0,(%rbx,%rcx,1)
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @allstars(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %8, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = call i64 @isdigit(i8 signext %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
br label %3
11: ; preds = %3
br label %12
12: ; preds = %24, %11
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 9
br i1 %16, label %22, label %17
17: ; preds = %12
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 42
br label %22
22: ; preds = %17, %12
%23 = phi i1 [ true, %12 ], [ %21, %17 ]
br i1 %23, label %24, label %27
24: ; preds = %22
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %2
br label %12
27: ; preds = %22
%28 = load i8*, i8** %2
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 13
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load i8*, i8** %2
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %2
br label %35
35: ; preds = %32, %27
%36 = load i8*, i8** %2
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 10
br i1 %39, label %40, label %43
40: ; preds = %35
%41 = load i8*, i8** %2
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %2
br label %43
43: ; preds = %40, %35
%44 = load i8*, i8** %2
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 0
%48 = zext i1 %47 to i32
ret i32 %48
}

LLVM IR (-O2):
define i32 @allstars(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @isdigit(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2, %11
%9 = phi i8* [ %12, %11 ], [ %3, %2 ]
%10 = load i8, i8* %9
switch i8 %10, label %16 [
i8 9, label %11
i8 42, label %11
i8 13, label %13
]
11: ; preds = %8, %8
%12 = getelementptr inbounds i8, i8* %9, i64 1
br label %8
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %9, i64 1
%15 = load i8, i8* %14
br label %16
16: ; preds = %8, %13
%17 = phi i8 [ %15, %13 ], [ %10, %8 ]
%18 = phi i8* [ %14, %13 ], [ %9, %8 ]
%19 = icmp eq i8 %17, 10
%20 = zext i1 %19 to i64
%21 = getelementptr i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
%24 = zext i1 %23 to i32
ret i32 %24
}