#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char getc(int /*<<< orphan*/ *);
scalar_t__ isdigit(char);
int /*<<< orphan*/ ungetc(char, int /*<<< orphan*/ *);
long double __scan_float_uint(FILE *stream, int flags) {
  long double value;
  char c;
  value = 0;
  while (isdigit((c = getc(stream)))) {
    value *= 10;
    value += (c - '0');
  }
  ungetc(c, stream);
  return value;
}


x86 assembly (clang, -O0):
<__scan_float_uint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
fldz
fstpt  -0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <getc@plt>
mov    %al,-0x21(%rbp)
movsbl %al,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     118a <__scan_float_uint+0x5a>
fldt   -0x20(%rbp)
flds   0xe95(%rip)
fmulp  %st,%st(1)
fstpt  -0x20(%rbp)
movsbl -0x21(%rbp),%eax
add    $0xffffffd0,%eax
mov    %eax,-0x28(%rbp)
fildl  -0x28(%rbp)
fldt   -0x20(%rbp)
faddp  %st,%st(1)
fstpt  -0x20(%rbp)
jmp    1144 <__scan_float_uint+0x14>
movsbl -0x21(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1040 <ungetc@plt>
fldt   -0x20(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__scan_float_uint>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
call   1050 <getc@plt>
mov    %eax,%ebx
movsbl %al,%edi
call   1030 <isdigit@plt>
fldz
test   %rax,%rax
je     1195 <__scan_float_uint+0x65>
fstp   %st(0)
fldz
fstpt  0x8(%rsp)
nopl   0x0(%rax,%rax,1)
fldt   0x8(%rsp)
fmuls  0xe96(%rip)
movsbl %bl,%eax
add    $0xffffffd0,%eax
mov    %eax,0x14(%rsp)
fiaddl 0x14(%rsp)
fstpt  0x8(%rsp)
mov    %r14,%rdi
call   1050 <getc@plt>
mov    %eax,%ebx
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1160 <__scan_float_uint+0x30>
jmp    1199 <__scan_float_uint+0x69>
fstpt  0x8(%rsp)
movsbl %bl,%edi
mov    %r14,%rsi
call   1040 <ungetc@plt>
fldt   0x8(%rsp)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define x86_fp80 @__scan_float_uint(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca x86_fp80
%6 = alloca i8
store i32* %0, i32** %3
store i32 %1, i32* %4
store x86_fp80 0xK00000000000000000000, x86_fp80* %5
br label %7
7: ; preds = %12, %2
%8 = load i32*, i32** %3
%9 = call signext i8 @getc(i32* %8)
store i8 %9, i8* %6
%10 = call i64 @isdigit(i8 signext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %7
%13 = load x86_fp80, x86_fp80* %5
%14 = fmul x86_fp80 %13, 0xK4002A000000000000000
store x86_fp80 %14, x86_fp80* %5
%15 = load i8, i8* %6
%16 = sext i8 %15 to i32
%17 = sub nsw i32 %16, 48
%18 = sitofp i32 %17 to x86_fp80
%19 = load x86_fp80, x86_fp80* %5
%20 = fadd x86_fp80 %19, %18
store x86_fp80 %20, x86_fp80* %5
br label %7
21: ; preds = %7
%22 = load i8, i8* %6
%23 = load i32*, i32** %3
%24 = call i32 @ungetc(i8 signext %22, i32* %23)
%25 = load x86_fp80, x86_fp80* %5
ret x86_fp80 %25
}

LLVM IR (-O2):
define x86_fp80 @__scan_float_uint(i32* nocapture %0, i32 %1) {
%3 = tail call signext i8 @getc(i32* %0)
%4 = tail call i64 @isdigit(i8 signext %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %2, %6
%7 = phi i8 [ %14, %6 ], [ %3, %2 ]
%8 = phi x86_fp80 [ %13, %6 ], [ 0xK00000000000000000000, %2 ]
%9 = fmul x86_fp80 %8, 0xK4002A000000000000000
%10 = sext i8 %7 to i32
%11 = add nsw i32 %10, -48
%12 = sitofp i32 %11 to x86_fp80
%13 = fadd x86_fp80 %9, %12
%14 = tail call signext i8 @getc(i32* %0)
%15 = tail call i64 @isdigit(i8 signext %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %6
17: ; preds = %6, %2
%18 = phi x86_fp80 [ 0xK00000000000000000000, %2 ], [ %13, %6 ]
%19 = phi i8 [ %3, %2 ], [ %14, %6 ]
%20 = tail call i32 @ungetc(i8 signext %19, i32* %0)
ret x86_fp80 %18
}