#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*/ fabsl(long double);
scalar_t__ isgreater(int /*<<< orphan*/, long double);
int lddec(long double a) {
  int count = 1;
  while (isgreater(fabsl(a), 10.0L)) {
    a /= 10.0L;
    count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<lddec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
movl   $0x1,-0x14(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <fabsl@plt>
mov    %eax,%edi
mov    %rsp,%rax
flds   0xeb3(%rip)
fstpt  (%rax)
call   1040 <isgreater@plt>
cmp    $0x0,%rax
je     117a <lddec+0x5a>
fldt   -0x10(%rbp)
flds   0xe99(%rip)
fdivrp %st,%st(1)
fstpt  -0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1135 <lddec+0x15>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lddec>:
push   %rbx
sub    $0x30,%rsp
fldt   0x40(%rsp)
fld    %st(0)
fstpt  0x24(%rsp)
fstpt  (%rsp)
call   1030 <fabsl@plt>
flds   0xec3(%rip)
fld    %st(0)
fstpt  0x18(%rsp)
fstpt  (%rsp)
mov    %eax,%edi
call   1040 <isgreater@plt>
mov    $0x1,%ebx
test   %rax,%rax
je     11a0 <lddec+0x80>
fldt   0x24(%rsp)
fldt   0x18(%rsp)
fstp   %st(0)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
fldt   0x18(%rsp)
fdivrp %st,%st(1)
fld    %st(0)
fstpt  0x24(%rsp)
add    $0x1,%ebx
fstpt  (%rsp)
call   1030 <fabsl@plt>
fldt   0x18(%rsp)
fstpt  (%rsp)
mov    %eax,%edi
call   1040 <isgreater@plt>
fldt   0x24(%rsp)
test   %rax,%rax
jne    1170 <lddec+0x50>
jmp    11a2 <lddec+0x82>
fldz
fstp   %st(0)
mov    %ebx,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @lddec(x86_fp80 %0) {
%2 = alloca x86_fp80
%3 = alloca i32
store x86_fp80 %0, x86_fp80* %2
store i32 1, i32* %3
br label %4
4: ; preds = %9, %1
%5 = load x86_fp80, x86_fp80* %2
%6 = call i32 @fabsl(x86_fp80 %5)
%7 = call i64 @isgreater(i32 %6, x86_fp80 0xK4002A000000000000000)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load x86_fp80, x86_fp80* %2
%11 = fdiv x86_fp80 %10, 0xK4002A000000000000000
store x86_fp80 %11, x86_fp80* %2
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @lddec(x86_fp80 %0) {
%2 = tail call i32 @fabsl(x86_fp80 %0)
%3 = tail call i64 @isgreater(i32 %2, x86_fp80 0xK4002A000000000000000)
%4 = icmp eq i64 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %9, %5 ], [ 1, %1 ]
%7 = phi x86_fp80 [ %8, %5 ], [ %0, %1 ]
%8 = fdiv x86_fp80 %7, 0xK4002A000000000000000
%9 = add nuw nsw i32 %6, 1
%10 = tail call i32 @fabsl(x86_fp80 %8)
%11 = tail call i64 @isgreater(i32 %10, x86_fp80 0xK4002A000000000000000)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %1
%14 = phi i32 [ 1, %1 ], [ %9, %5 ]
ret i32 %14
}