#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*/ isdigit(char);
char *scan_sign(char *restrict str, int *restrict is_neg) {
  while (!isdigit(*str) && *str != '.' && *str)
    if (*str++ == '-')
      *is_neg = !*is_neg;
  return str;
}


x86 assembly (clang, -O0):
<scan_sign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
jne    1161 <scan_sign+0x51>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2e,%ecx
mov    %al,-0x11(%rbp)
je     1161 <scan_sign+0x51>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1171 <scan_sign+0x61>
jmp    11a8 <scan_sign+0x98>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11a3 <scan_sign+0x93>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1120 <scan_sign+0x10>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_sign>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    (%rdi),%bl
movsbl %bl,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
jne    1163 <scan_sign+0x53>
jmp    1152 <scan_sign+0x42>
nopl   0x0(%rax,%rax,1)
cmp    $0x2d,%bl
jne    1141 <scan_sign+0x31>
xor    %eax,%eax
cmpl   $0x0,(%r14)
sete   %al
mov    %eax,(%r14)
movsbl (%r15),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
jne    1163 <scan_sign+0x53>
movzbl (%r15),%ebx
add    $0x1,%r15
test   %bl,%bl
je     115f <scan_sign+0x4f>
cmp    $0x2e,%bl
jne    1130 <scan_sign+0x20>
add    $0xffffffffffffffff,%r15
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @scan_sign(i8* noalias %0, i32* noalias %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
br label %5
5: ; preds = %35, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = call i32 @isdigit(i8 signext %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %20, label %10
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 46
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br label %20
20: ; preds = %15, %10, %5
%21 = phi i1 [ false, %10 ], [ false, %5 ], [ %19, %15 ]
br i1 %21, label %22, label %36
22: ; preds = %20
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %3
%25 = load i8, i8* %23
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 45
br i1 %27, label %28, label %35
28: ; preds = %22
%29 = load i32*, i32** %4
%30 = load i32, i32* %29
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
%33 = zext i1 %32 to i32
%34 = load i32*, i32** %4
store i32 %33, i32* %34
br label %35
35: ; preds = %28, %22
br label %5
36: ; preds = %20
%37 = load i8*, i8** %3
ret i8* %37
}

LLVM IR (-O2):
define i8* @scan_sign(i8* noalias %0, i32* noalias nocapture %1) {
%3 = load i8, i8* %0
%4 = tail call i32 @isdigit(i8 signext %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %22
6: ; preds = %2, %20
%7 = phi i8 [ %21, %20 ], [ %3, %2 ]
%8 = phi i8* [ %10, %20 ], [ %0, %2 ]
switch i8 %7, label %9 [
i8 46, label %22
i8 0, label %22
]
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = icmp eq i8 %7, 45
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
store i32 %15, i32* %1
br label %16
16: ; preds = %12, %9
%17 = load i8, i8* %10
%18 = tail call i32 @isdigit(i8 signext %17)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = load i8, i8* %10
br label %6
22: ; preds = %16, %6, %6, %2
%23 = phi i8* [ %0, %2 ], [ %8, %6 ], [ %8, %6 ], [ %10, %16 ]
ret i8* %23
}