#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_25_lines(char const *, float *, float *, int *);
float ft_atof(const char *s) {
  float val;
  float sign;
  int nbr[2];
  nbr[0] = 0;
  val = 0;
  sign = 1;
  if (*s == '-') {
    s++;
    sign = -1;
  }
  while (*s) {
    if (*s == '.') {
      nbr[0] = 1;
      s++;
      continue;
    };
    ft_25_lines(s, &sign, &val, nbr);
    s++;
  };
  return (val * sign);
}


x86 assembly (clang, -O0):
<ft_atof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xecd(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1161 <ft_atof+0x51>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
movss  0xea8(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1166 <ft_atof+0x56>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11c1 <ft_atof+0xb1>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    119b <ft_atof+0x8b>
movl   $0x1,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1166 <ft_atof+0x56>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rcx
lea    -0x10(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <ft_25_lines@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1166 <ft_atof+0x56>
movss  -0xc(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_atof>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x3f800000,0x8(%rsp)
3f
cmpb   $0x2d,(%rdi)
jne    1147 <ft_atof+0x37>
add    $0x1,%rbx
movl   $0xbf800000,0x8(%rsp)
bf
lea    0x8(%rsp),%r14
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%r12
jmp    116c <ft_atof+0x5c>
nopl   0x0(%rax,%rax,1)
movl   $0x1,0x10(%rsp)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x2e,%al
je     1160 <ft_atof+0x50>
test   %al,%al
je     118e <ft_atof+0x7e>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1030 <ft_25_lines@plt>
add    $0x1,%rbx
jmp    116c <ft_atof+0x5c>
movss  0xc(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float @ft_atof(i8* %0) {
%2 = alloca i8*
%3 = alloca float
%4 = alloca float
%5 = alloca [2 x i32]
store i8* %0, i8** %2
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
store i32 0, i32* %6
store float 0.000000e+00, float* %3
store float 1.000000e+00, float* %4
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 45
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %2
store float -1.000000e+00, float* %4
br label %14
14: ; preds = %11, %1
br label %15
15: ; preds = %28, %24, %14
%16 = load i8*, i8** %2
%17 = load i8, i8* %16
%18 = icmp ne i8 %17, 0
br i1 %18, label %19, label %34
19: ; preds = %15
%20 = load i8*, i8** %2
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 46
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
store i32 1, i32* %25
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %2
br label %15
28: ; preds = %19
%29 = load i8*, i8** %2
%30 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%31 = call i32 @ft_25_lines(i8* %29, float* %4, float* %3, i32* %30)
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %2
br label %15
34: ; preds = %15
%35 = load float, float* %3
%36 = load float, float* %4
%37 = fmul float %35, %36
ret float %37
}

LLVM IR (-O2):
define float @ft_atof(i8* %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca [2 x i32]
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = bitcast [2 x i32]* %4 to i8*
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
store i32 0, i32* %8
store float 0.000000e+00, float* %2
store float 1.000000e+00, float* %3
%9 = load i8, i8* %0
%10 = icmp eq i8 %9, 45
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = getelementptr inbounds i8, i8* %0, i64 1
store float -1.000000e+00, float* %3
br label %13
13: ; preds = %11, %1
%14 = phi i8* [ %0, %1 ], [ %12, %11 ]
br label %15
15: ; preds = %13, %19
%16 = phi i8* [ %20, %19 ], [ %14, %13 ]
%17 = load i8, i8* %16
switch i8 %17, label %21 [
i8 0, label %23
i8 46, label %18
]
18: ; preds = %15
store i32 1, i32* %8
br label %19
19: ; preds = %18, %21
%20 = getelementptr inbounds i8, i8* %16, i64 1
br label %15
21: ; preds = %15
%22 = call i32 @ft_25_lines(i8* %16, float* %3, float* %2, i32* %8)
br label %19
23: ; preds = %15
%24 = load float, float* %2
%25 = load float, float* %3
%26 = fmul float %24, %25
ret float %26
}