#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_isspace(char const);
int /*<<< orphan*/ ft_strlowcase(char *);
scalar_t__ ft_strnequ(int /*<<< orphan*/, char *, int);
int ft_isinf(const char *s) {
  int index;
  index = 0;
  while (ft_isspace(s[index]))
    index++;
  if (ft_strnequ(ft_strlowcase((char *)&s[index]), "inf", 3))
    return (1);
  else if (ft_strnequ(ft_strlowcase((char *)&s[index]), "-inf", 4))
    return (-1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<ft_isinf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <ft_isspace@plt>
cmp    $0x0,%rax
je     116c <ft_isinf+0x3c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1143 <ft_isinf+0x13>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
call   1050 <ft_strlowcase@plt>
mov    %eax,%edi
lea    0xe7c(%rip),%rsi
mov    $0x3,%edx
call   1030 <ft_strnequ@plt>
cmp    $0x0,%rax
je     11a5 <ft_isinf+0x75>
movl   $0x1,-0x4(%rbp)
jmp    11e5 <ft_isinf+0xb5>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
call   1050 <ft_strlowcase@plt>
mov    %eax,%edi
lea    0xe42(%rip),%rsi
mov    $0x4,%edx
call   1030 <ft_strnequ@plt>
cmp    $0x0,%rax
je     11de <ft_isinf+0xae>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e5 <ft_isinf+0xb5>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isinf>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0xffffffffffffffff,%rbx
xchg   %ax,%ax
movsbl 0x1(%r14,%rbx,1),%edi
call   1040 <ft_isspace@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1140 <ft_isinf+0x10>
mov    %ebx,%eax
add    %rax,%r14
mov    %r14,%rdi
call   1050 <ft_strlowcase@plt>
lea    0xe99(%rip),%rsi
mov    %eax,%edi
mov    $0x3,%edx
call   1030 <ft_strnequ@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    11a1 <ft_isinf+0x71>
mov    %r14,%rdi
call   1050 <ft_strlowcase@plt>
lea    0xe70(%rip),%rsi
mov    %eax,%edi
mov    $0x4,%edx
call   1030 <ft_strnequ@plt>
neg    %rax
sbb    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"inf\00"
@.str.1 = [5 x i8] c"-inf\00"
define i32 @ft_isinf(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %13, %1
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = call i64 @ft_isspace(i8 signext %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %5
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %5
16: ; preds = %5
%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 = call i32 @ft_strlowcase(i8* %20)
%22 = call i64 @ft_strnequ(i32 %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %16
store i32 1, i32* %2
br label %35
25: ; preds = %16
%26 = load i8*, i8** %3
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = call i32 @ft_strlowcase(i8* %29)
%31 = call i64 @ft_strnequ(i32 %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %25
store i32 -1, i32* %2
br label %35
34: ; preds = %25
store i32 0, i32* %2
br label %35
35: ; preds = %34, %33, %24
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
@.str = [4 x i8] c"inf\00"
@.str.1 = [5 x i8] c"-inf\00"
define i32 @ft_isinf(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %8, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = tail call i64 @ft_isspace(i8 signext %5)
%7 = icmp eq i64 %6, 0
%8 = add nuw i64 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
%10 = and i64 %3, 4294967295
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = tail call i32 @ft_strlowcase(i8* %11)
%13 = tail call i64 @ft_strnequ(i32 %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %9
%16 = tail call i32 @ft_strlowcase(i8* %11)
%17 = tail call i64 @ft_strnequ(i32 %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%18 = icmp ne i64 %17, 0
%19 = sext i1 %18 to i32
br label %20
20: ; preds = %15, %9
%21 = phi i32 [ 1, %9 ], [ %19, %15 ]
ret i32 %21
}