#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 */
char *skip_decimal(char const *);
char *skip_digits(char const *);
char *skip_exponent(char const *);
char *skip_sign(char const *);
const char *find_end_of_floating_point_number(const char *str) {
  const char *begin = str;
  const char *ptr;
  int digits_skipped = 0;
  int decimal_skipped = 0;
  str = skip_sign(str);
  ptr = skip_digits(str);
  digits_skipped = ptr - str;
  str = ptr;
  ptr = skip_decimal(str);
  decimal_skipped = ptr - str;
  str = ptr;
  str = skip_digits(str);
  if (!decimal_skipped && digits_skipped) {
    ptr = skip_exponent(str);
    str = (ptr == str ? begin : ptr);
  } else if (decimal_skipped)
    str = skip_exponent(str);
  else
    str = begin;
  return str;
}


x86 assembly (clang, -O0):
<find_end_of_floating_point_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <skip_sign@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <skip_digits@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <skip_decimal@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <skip_digits@plt>
mov    %rax,-0x8(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    1213 <find_end_of_floating_point_number+0xd3>
cmpl   $0x0,-0x1c(%rbp)
je     1213 <find_end_of_floating_point_number+0xd3>
mov    -0x8(%rbp),%rdi
call   1040 <skip_exponent@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jne    11fe <find_end_of_floating_point_number+0xbe>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1206 <find_end_of_floating_point_number+0xc6>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    123c <find_end_of_floating_point_number+0xfc>
cmpl   $0x0,-0x20(%rbp)
je     122f <find_end_of_floating_point_number+0xef>
mov    -0x8(%rbp),%rdi
call   1040 <skip_exponent@plt>
mov    %rax,-0x8(%rbp)
jmp    1237 <find_end_of_floating_point_number+0xf7>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    123c <find_end_of_floating_point_number+0xfc>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_end_of_floating_point_number>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
call   1050 <skip_sign@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1060 <skip_digits@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <skip_decimal@plt>
mov    %eax,%ebp
sub    %ebx,%ebp
mov    %rax,%rdi
call   1060 <skip_digits@plt>
mov    %rax,%r15
cmp    %r12d,%ebx
je     118f <find_end_of_floating_point_number+0x4f>
test   %ebp,%ebp
jne    118f <find_end_of_floating_point_number+0x4f>
mov    %r15,%rdi
call   1040 <skip_exponent@plt>
cmp    %r15,%rax
cmovne %rax,%r14
jmp    11a3 <find_end_of_floating_point_number+0x63>
test   %ebp,%ebp
je     11a3 <find_end_of_floating_point_number+0x63>
mov    %r15,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <skip_exponent@plt>
mov    %r14,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @find_end_of_floating_point_number(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i8*, i8** %2
store i8* %7, i8** %3
store i32 0, i32* %5
store i32 0, i32* %6
%8 = load i8*, i8** %2
%9 = call i8* @skip_sign(i8* %8)
store i8* %9, i8** %2
%10 = load i8*, i8** %2
%11 = call i8* @skip_digits(i8* %10)
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = load i8*, i8** %2
%14 = ptrtoint i8* %12 to i64
%15 = ptrtoint i8* %13 to i64
%16 = sub i64 %14, %15
%17 = trunc i64 %16 to i32
store i32 %17, i32* %5
%18 = load i8*, i8** %4
store i8* %18, i8** %2
%19 = load i8*, i8** %2
%20 = call i8* @skip_decimal(i8* %19)
store i8* %20, i8** %4
%21 = load i8*, i8** %4
%22 = load i8*, i8** %2
%23 = ptrtoint i8* %21 to i64
%24 = ptrtoint i8* %22 to i64
%25 = sub i64 %23, %24
%26 = trunc i64 %25 to i32
store i32 %26, i32* %6
%27 = load i8*, i8** %4
store i8* %27, i8** %2
%28 = load i8*, i8** %2
%29 = call i8* @skip_digits(i8* %28)
store i8* %29, i8** %2
%30 = load i32, i32* %6
%31 = icmp ne i32 %30, 0
br i1 %31, label %47, label %32
32: ; preds = %1
%33 = load i32, i32* %5
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %47
35: ; preds = %32
%36 = load i8*, i8** %2
%37 = call i8* @skip_exponent(i8* %36)
store i8* %37, i8** %4
%38 = load i8*, i8** %4
%39 = load i8*, i8** %2
%40 = icmp eq i8* %38, %39
br i1 %40, label %41, label %43
41: ; preds = %35
%42 = load i8*, i8** %3
br label %45
43: ; preds = %35
%44 = load i8*, i8** %4
br label %45
45: ; preds = %43, %41
%46 = phi i8* [ %42, %41 ], [ %44, %43 ]
store i8* %46, i8** %2
br label %56
47: ; preds = %32, %1
%48 = load i32, i32* %6
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = load i8*, i8** %2
%52 = call i8* @skip_exponent(i8* %51)
store i8* %52, i8** %2
br label %55
53: ; preds = %47
%54 = load i8*, i8** %3
store i8* %54, i8** %2
br label %55
55: ; preds = %53, %50
br label %56
56: ; preds = %55, %45
%57 = load i8*, i8** %2
ret i8* %57
}

LLVM IR (-O2):
define i8* @find_end_of_floating_point_number(i8* %0) {
%2 = tail call i8* @skip_sign(i8* %0)
%3 = tail call i8* @skip_digits(i8* %2)
%4 = ptrtoint i8* %3 to i64
%5 = ptrtoint i8* %2 to i64
%6 = sub i64 %4, %5
%7 = trunc i64 %6 to i32
%8 = tail call i8* @skip_decimal(i8* %3)
%9 = ptrtoint i8* %8 to i64
%10 = sub i64 %9, %4
%11 = trunc i64 %10 to i32
%12 = tail call i8* @skip_digits(i8* %8)
%13 = icmp eq i32 %11, 0
%14 = icmp ne i32 %7, 0
%15 = and i1 %14, %13
br i1 %15, label %16, label %20
16: ; preds = %1
%17 = tail call i8* @skip_exponent(i8* %12)
%18 = icmp eq i8* %17, %12
%19 = select i1 %18, i8* %0, i8* %17
br label %23
20: ; preds = %1
br i1 %13, label %23, label %21
21: ; preds = %20
%22 = tail call i8* @skip_exponent(i8* %12)
br label %23
23: ; preds = %20, %21, %16
%24 = phi i8* [ %19, %16 ], [ %22, %21 ], [ %0, %20 ]
ret i8* %24
}