#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*/ isdigit(char);
size_t strlen(char *);
bool is_fulldigit(char *str) {
  for (size_t i = 0; i < strlen(str); i++) {
    if (!isdigit(str[i]))
      return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<is_fulldigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jae    1191 <is_fulldigit+0x71>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    117b <is_fulldigit+0x5b>
movl   $0x0,-0x4(%rbp)
jmp    1198 <is_fulldigit+0x78>
jmp    1180 <is_fulldigit+0x60>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1134 <is_fulldigit+0x14>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_fulldigit>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%al
mov    $0x1,%r14d
test   %al,%al
je     1171 <is_fulldigit+0x51>
mov    %rdi,%rbx
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     116e <is_fulldigit+0x4e>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    %rax,%rbp
jae    1171 <is_fulldigit+0x51>
movsbl (%rbx,%rbp,1),%edi
call   1030 <isdigit@plt>
add    $0x1,%rbp
test   %eax,%eax
jne    1150 <is_fulldigit+0x30>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @is_fulldigit(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 0, i64* %4
br label %5
5: ; preds = %19, %1
%6 = load i64, i64* %4
%7 = load i8*, i8** %3
%8 = call i64 @strlen(i8* %7)
%9 = icmp ult i64 %6, %8
br i1 %9, label %10, label %22
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i64, i64* %4
%13 = getelementptr inbounds i8, i8* %11, i64 %12
%14 = load i8, i8* %13
%15 = call i32 @isdigit(i8 signext %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %10
store i32 0, i32* %2
br label %23
18: ; preds = %10
br label %19
19: ; preds = %18
%20 = load i64, i64* %4
%21 = add i64 %20, 1
store i64 %21, i64* %4
br label %5
22: ; preds = %5
store i32 1, i32* %2
br label %23
23: ; preds = %22, %17
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @is_fulldigit(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1
%5 = tail call i32 @isdigit(i8 signext %2)
%6 = icmp eq i32 %5, 0
br i1 %6, label %17, label %7
7: ; preds = %4, %11
%8 = phi i64 [ %16, %11 ], [ 1, %4 ]
%9 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %0, i64 %8
%13 = load i8, i8* %12
%14 = tail call i32 @isdigit(i8 signext %13)
%15 = icmp eq i32 %14, 0
%16 = add nuw i64 %8, 1
br i1 %15, label %17, label %7
17: ; preds = %11, %7, %4, %1
%18 = phi i32 [ 1, %1 ], [ 0, %4 ], [ 1, %7 ], [ 0, %11 ]
ret i32 %18
}