#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*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ mpz_add(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_set_ui(int /*<<< orphan*/, int);
int mpz_sizeinbase(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_sub(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  mpz_t f1, f2;
  mpz_init(f1);
  mpz_init(f2);
  mpz_set_ui(f1, 1);
  mpz_set_ui(f2, 1);
  int fibc = 3;
  while (mpz_sizeinbase(f2, 10) < 1000) {
    mpz_add(f2, f2, f1);
    mpz_sub(f1, f2, f1);
    ++fibc;
  }
  printf("%d\n", fibc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0xc(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   1080 <mpz_set_ui@plt>
mov    -0xc(%rbp),%edi
mov    $0x1,%esi
call   1080 <mpz_set_ui@plt>
movl   $0x3,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    $0xa,%esi
call   1070 <mpz_sizeinbase@plt>
cmp    $0x3e8,%eax
jge    11e2 <main+0x82>
mov    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1060 <mpz_add@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <mpz_sub@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a0 <main+0x40>
mov    -0x10(%rbp),%esi
lea    0xe14(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
call   1050 <mpz_init@plt>
call   1050 <mpz_init@plt>
mov    $0x1,%esi
call   1080 <mpz_set_ui@plt>
mov    $0x1,%esi
call   1080 <mpz_set_ui@plt>
mov    $0xa,%esi
call   1070 <mpz_sizeinbase@plt>
mov    $0x3,%ebx
cmp    $0x3e7,%eax
jg     11be <main+0x5e>
mov    $0x3,%ebx
nopw   0x0(%rax,%rax,1)
call   1060 <mpz_add@plt>
call   1030 <mpz_sub@plt>
add    $0x1,%ebx
mov    $0xa,%esi
call   1070 <mpz_sizeinbase@plt>
cmp    $0x3e8,%eax
jl     11a0 <main+0x40>
lea    0xe3b(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* %2
%6 = call i32 @mpz_init(i32 %5)
%7 = load i32, i32* %3
%8 = call i32 @mpz_init(i32 %7)
%9 = load i32, i32* %2
%10 = call i32 @mpz_set_ui(i32 %9, i32 1)
%11 = load i32, i32* %3
%12 = call i32 @mpz_set_ui(i32 %11, i32 1)
store i32 3, i32* %4
br label %13
13: ; preds = %17, %0
%14 = load i32, i32* %3
%15 = call i32 @mpz_sizeinbase(i32 %14, i32 10)
%16 = icmp slt i32 %15, 1000
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = load i32, i32* %3
%19 = load i32, i32* %3
%20 = load i32, i32* %2
%21 = call i32 @mpz_add(i32 %18, i32 %19, i32 %20)
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = load i32, i32* %2
%25 = call i32 @mpz_sub(i32 %22, i32 %23, i32 %24)
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %13
28: ; preds = %13
%29 = load i32, i32* %4
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @mpz_init(i32 undef)
%2 = tail call i32 @mpz_init(i32 undef)
%3 = tail call i32 @mpz_set_ui(i32 undef, i32 1)
%4 = tail call i32 @mpz_set_ui(i32 undef, i32 1)
%5 = tail call i32 @mpz_sizeinbase(i32 undef, i32 10)
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %14
7: ; preds = %0, %7
%8 = phi i32 [ %11, %7 ], [ 3, %0 ]
%9 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%10 = tail call i32 @mpz_sub(i32 undef, i32 undef, i32 undef)
%11 = add nuw nsw i32 %8, 1
%12 = tail call i32 @mpz_sizeinbase(i32 undef, i32 10)
%13 = icmp slt i32 %12, 1000
br i1 %13, label %7, label %14
14: ; preds = %7, %0
%15 = phi i32 [ 3, %0 ], [ %11, %7 ]
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}