#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__ strtol(char const *, char **, int);
int xvc_get_number_of_fraction_digits_from_float_string(const char *input) {
  int pre = 0, post = 0;
  char *ptr;
  pre = (int)strtol(input, &ptr, 10);
  if (*ptr != '\0')
    ptr++;
  while (*ptr != '\0') {
    post++;
    ptr++;
  }
  return post;
}


x86 assembly (clang, -O0):
<xvc_get_number_of_fraction_digits_from_float_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115b <xvc_get_number_of_fraction_digits_from_float_string+0x4b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1160 <xvc_get_number_of_fraction_digits_from_float_string+0x50>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     118a <xvc_get_number_of_fraction_digits_from_float_string+0x7a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1160 <xvc_get_number_of_fraction_digits_from_float_string+0x50>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xvc_get_number_of_fraction_digits_from_float_string>:
push   %rax
mov    %rsp,%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    (%rsp),%rcx
xor    %eax,%eax
cmpb   $0x0,(%rcx)
je     114b <xvc_get_number_of_fraction_digits_from_float_string+0x3b>
cmpb   $0x0,0x1(%rcx)
je     114b <xvc_get_number_of_fraction_digits_from_float_string+0x3b>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,0x2(%rcx,%rax,1)
lea    0x1(%rax),%rax
jne    1140 <xvc_get_number_of_fraction_digits_from_float_string+0x30>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @xvc_get_number_of_fraction_digits_from_float_string(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i64 @strtol(i8* %0, i8** %2, i32 10)
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %19, label %8
8: ; preds = %1
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %8, %12
%13 = phi i32 [ %15, %12 ], [ 0, %8 ]
%14 = phi i8* [ %16, %12 ], [ %9, %8 ]
%15 = add nuw nsw i32 %13, 1
%16 = getelementptr inbounds i8, i8* %14, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %12
19: ; preds = %12, %1, %8
%20 = phi i32 [ 0, %8 ], [ 0, %1 ], [ %15, %12 ]
ret i32 %20
}