#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*/ ft_isdigit(char);
int ft_strisdigit(char *str) {
  int i;
  i = -1;
  if (!str)
    return (0);
  while (str[++i])
    if (!ft_isdigit(str[i]))
      return (0);
  return (1);
}


x86 assembly (clang, -O0):
<ft_strisdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113a <ft_strisdigit+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    118b <ft_strisdigit+0x7b>
jmp    113f <ft_strisdigit+0x2f>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %ecx,%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1184 <ft_strisdigit+0x74>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <ft_isdigit@plt>
cmp    $0x0,%eax
jne    117f <ft_strisdigit+0x6f>
movl   $0x0,-0x4(%rbp)
jmp    118b <ft_strisdigit+0x7b>
jmp    113f <ft_strisdigit+0x2f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strisdigit>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     113e <ft_strisdigit+0x2e>
mov    %rdi,%rbx
nopl   (%rax)
movzbl (%rbx),%eax
test   %al,%al
je     1139 <ft_strisdigit+0x29>
movsbl %al,%edi
call   1030 <ft_isdigit@plt>
add    $0x1,%rbx
test   %eax,%eax
jne    1120 <ft_strisdigit+0x10>
jmp    113e <ft_strisdigit+0x2e>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ft_strisdigit(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 -1, i32* %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %8, label %7
7: ; preds = %1
store i32 0, i32* %2
br label %28
8: ; preds = %1
br label %9
9: ; preds = %26, %8
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
store i32 %12, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %10, i64 %13
%15 = load i8, i8* %14
%16 = icmp ne i8 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %9
%18 = load i8*, i8** %3
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = call i32 @ft_isdigit(i8 signext %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %17
store i32 0, i32* %2
br label %28
26: ; preds = %17
br label %9
27: ; preds = %9
store i32 1, i32* %2
br label %28
28: ; preds = %27, %25, %7
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @ft_strisdigit(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %12, label %3
3: ; preds = %1, %9
%4 = phi i64 [ %5, %9 ], [ -1, %1 ]
%5 = add nsw i64 %4, 1
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = tail call i32 @ft_isdigit(i8 signext %7)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %3
12: ; preds = %3, %9, %1
%13 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 0, %9 ]
ret i32 %13
}