#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__ ft_is_wht_spc(char);
scalar_t__ ft_isdigit(char);
int ft_isnumeric(char *str) {
  while (ft_is_wht_spc(*str))
    ++str;
  if (!ft_isdigit(*str))
    return (0);
  while (ft_isdigit(*str))
    ++str;
  while (ft_is_wht_spc(*str))
    ++str;
  if (!*str)
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<ft_isnumeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ft_is_wht_spc@plt>
cmp    $0x0,%rax
je     1153 <ft_isnumeric+0x33>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112c <ft_isnumeric+0xc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <ft_isdigit@plt>
cmp    $0x0,%rax
jne    1175 <ft_isnumeric+0x55>
movl   $0x0,-0x4(%rbp)
jmp    11ed <ft_isnumeric+0xcd>
jmp    117a <ft_isnumeric+0x5a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <ft_isdigit@plt>
cmp    $0x0,%rax
je     11a1 <ft_isnumeric+0x81>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    117a <ft_isnumeric+0x5a>
jmp    11a6 <ft_isnumeric+0x86>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ft_is_wht_spc@plt>
cmp    $0x0,%rax
je     11cd <ft_isnumeric+0xad>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11a6 <ft_isnumeric+0x86>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11e6 <ft_isnumeric+0xc6>
movl   $0x1,-0x4(%rbp)
jmp    11ed <ft_isnumeric+0xcd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isnumeric>:
push   %rbx
mov    %rdi,%rbx
add    $0xfffffffffffffffe,%rbx
nopl   0x0(%rax,%rax,1)
movsbl 0x2(%rbx),%edi
call   1030 <ft_is_wht_spc@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1130 <ft_isnumeric+0x10>
movsbl 0x1(%rbx),%edi
call   1040 <ft_isdigit@plt>
test   %rax,%rax
je     118c <ft_isnumeric+0x6c>
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1040 <ft_isdigit@plt>
test   %rax,%rax
jne    1150 <ft_isnumeric+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rbx),%edi
call   1030 <ft_is_wht_spc@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1170 <ft_isnumeric+0x50>
xor    %eax,%eax
cmpb   $0x0,-0x1(%rbx)
sete   %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ft_isnumeric(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 @ft_is_wht_spc(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
%9 = load i8, i8* %3
%10 = tail call i64 @ft_isdigit(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %28, label %12
12: ; preds = %8, %12
%13 = phi i8* [ %17, %12 ], [ %3, %8 ]
%14 = load i8, i8* %13
%15 = tail call i64 @ft_isdigit(i8 signext %14)
%16 = icmp eq i64 %15, 0
%17 = getelementptr inbounds i8, i8* %13, i64 1
br i1 %16, label %18, label %12
18: ; preds = %12, %18
%19 = phi i8* [ %23, %18 ], [ %13, %12 ]
%20 = load i8, i8* %19
%21 = tail call i64 @ft_is_wht_spc(i8 signext %20)
%22 = icmp eq i64 %21, 0
%23 = getelementptr inbounds i8, i8* %19, i64 1
br i1 %22, label %24, label %18
24: ; preds = %18
%25 = load i8, i8* %19
%26 = icmp eq i8 %25, 0
%27 = zext i1 %26 to i32
br label %28
28: ; preds = %24, %8
%29 = phi i32 [ 0, %8 ], [ %27, %24 ]
ret i32 %29
}