#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*/ printf(char *, char *);
char isdigit_my(char *s) {
  int i = 0;
  char not_digit = 0;
  printf("in isdigit forwarded string: '%s'.\n\n", s);
  while (s[i] != '\0') {
    if (s[i] >= '0' && s[i] <= '9') {
    } else
      not_digit = 1;
    i++;
  }
  if (not_digit == 0)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isdigit_my>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movb   $0x0,-0x15(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     118d <isdigit_my+0x7d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     117b <isdigit_my+0x6b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jg     117b <isdigit_my+0x6b>
jmp    117f <isdigit_my+0x6f>
movb   $0x1,-0x15(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <isdigit_my+0x27>
movsbl -0x15(%rbp),%eax
cmp    $0x0,%eax
jne    11a3 <isdigit_my+0x93>
movb   $0x1,-0x1(%rbp)
jmp    11a7 <isdigit_my+0x97>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isdigit_my>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    (%rbx),%cl
test   %cl,%cl
je     115e <isdigit_my+0x4e>
add    $0x1,%rbx
xor    %eax,%eax
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xd0,%cl
cmp    $0xa,%cl
movzbl %al,%eax
cmovae %edx,%eax
movzbl (%rbx),%ecx
add    $0x1,%rbx
test   %cl,%cl
jne    1140 <isdigit_my+0x30>
test   %al,%al
sete   %al
pop    %rbx
ret
mov    $0x1,%al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"in isdigit forwarded string: '%s'.\0A\0A\00"
define signext i8 @isdigit_my(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %3
store i32 0, i32* %4
store i8 0, i8* %5
%6 = load i8*, i8** %3
%7 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %34, %1
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %37
16: ; preds = %8
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp sge i32 %22, 48
br i1 %23, label %24, label %33
24: ; preds = %16
%25 = load i8*, i8** %3
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp sle i32 %30, 57
br i1 %31, label %32, label %33
32: ; preds = %24
br label %34
33: ; preds = %24, %16
store i8 1, i8* %5
br label %34
34: ; preds = %33, %32
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %8
37: ; preds = %8
%38 = load i8, i8* %5
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %37
store i8 1, i8* %2
br label %43
42: ; preds = %37
store i8 0, i8* %2
br label %43
43: ; preds = %42, %41
%44 = load i8, i8* %2
ret i8 %44
}

LLVM IR (-O2):
@.str = [37 x i8] c"in isdigit forwarded string: '%s'.\0A\0A\00"
define signext i8 @isdigit_my(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %19, label %5
5: ; preds = %1, %5
%6 = phi i64 [ %12, %5 ], [ 0, %1 ]
%7 = phi i8 [ %14, %5 ], [ %3, %1 ]
%8 = phi i8 [ %11, %5 ], [ 0, %1 ]
%9 = add i8 %7, -48
%10 = icmp ult i8 %9, 10
%11 = select i1 %10, i8 %8, i8 1
%12 = add nuw nsw i64 %6, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5
%17 = icmp eq i8 %11, 0
%18 = zext i1 %17 to i8
br label %19
19: ; preds = %16, %1
%20 = phi i8 [ 1, %1 ], [ %18, %16 ]
ret i8 %20
}