#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__ iupStrToInt(char const *, int *);
int iupStrGetFormatPrecision(const char *format) {
  int precision;
  while (*format) {
    if (*format == '.')
      break;
    format++;
  }
  if (*format != '.')
    return -1;
  format++;
  if (iupStrToInt(format, &precision))
    return precision;
  return -1;
}


x86 assembly (clang, -O0):
<iupStrGetFormatPrecision>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114f <iupStrGetFormatPrecision+0x3f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    113e <iupStrGetFormatPrecision+0x2e>
jmp    114f <iupStrGetFormatPrecision+0x3f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <iupStrGetFormatPrecision+0xc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     116b <iupStrGetFormatPrecision+0x5b>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a0 <iupStrGetFormatPrecision+0x90>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <iupStrToInt@plt>
cmp    $0x0,%rax
je     1199 <iupStrGetFormatPrecision+0x89>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a0 <iupStrGetFormatPrecision+0x90>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iupStrGetFormatPrecision>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rdi
movzbl -0x1(%rdi),%eax
test   %al,%al
je     1146 <iupStrGetFormatPrecision+0x36>
cmp    $0x2e,%al
jne    1120 <iupStrGetFormatPrecision+0x10>
lea    0x4(%rsp),%rsi
call   1030 <iupStrToInt@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
or     0x4(%rsp),%eax
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @iupStrGetFormatPrecision(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
br label %4
4: ; preds = %7, %1
%5 = phi i8* [ %0, %1 ], [ %8, %7 ]
%6 = load i8, i8* %5
switch i8 %6, label %7 [
i8 46, label %9
i8 0, label %15
]
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %5, i64 1
%11 = call i64 @iupStrToInt(i8* %10, i32* %2)
%12 = icmp eq i64 %11, 0
%13 = load i32, i32* %2
%14 = select i1 %12, i32 -1, i32 %13
br label %15
15: ; preds = %4, %9
%16 = phi i32 [ %14, %9 ], [ -1, %4 ]
ret i32 %16
}