#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*/ assert(int);
scalar_t__ isdigit(char const);
int printf_num_parse(const char **p) {
  assert(p && *p);
  if (**p == '*') {
    (*p)++;
    return 1;
  } else
    while (isdigit(**p)) {
      (*p)++;
    }
  return 0;
}


x86 assembly (clang, -O0):
<printf_num_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     114a <printf_num_parse+0x2a>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
jne    1184 <printf_num_parse+0x64>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11c1 <printf_num_parse+0xa1>
jmp    1189 <printf_num_parse+0x69>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11b5 <printf_num_parse+0x95>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1189 <printf_num_parse+0x69>
jmp    11ba <printf_num_parse+0x9a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printf_num_parse>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %rdi,%rdi
je     1137 <printf_num_parse+0x17>
xor    %edi,%edi
cmpq   $0x0,(%rbx)
setne  %dil
jmp    1139 <printf_num_parse+0x19>
xor    %edi,%edi
call   1040 <assert@plt>
mov    (%rbx),%rax
mov    (%rax),%cl
cmp    $0x2a,%cl
jne    115d <printf_num_parse+0x3d>
add    $0x1,%rax
mov    %rax,(%rbx)
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
movsbl %cl,%edi
call   1030 <isdigit@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1154 <printf_num_parse+0x34>
nopl   0x0(%rax)
mov    (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rbx)
movsbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1170 <printf_num_parse+0x50>
jmp    1154 <printf_num_parse+0x34>

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

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