#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*/ printf(char *, ...);
void output(int n, char str[]) {
  int i, j;
  for (i = 1300 - 1; i >= 0; i--) {
    if (str[i] != 0) {
      j = i;
      break;
    }
  }
  printf("The Fibonacci number for %d is ", n);
  for (; j >= 0; j--)
    printf("%d", str[j]);
  printf("\n");
}


x86 assembly (clang, -O0):
<output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x513,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1163 <output+0x53>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1150 <output+0x40>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1163 <output+0x53>
jmp    1155 <output+0x45>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <output+0x16>
mov    -0x4(%rbp),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
jl     11a6 <output+0x96>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1174 <output+0x64>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %edi,%esi
mov    $0x50f,%eax
nop
lea    0x4(%rax),%ebx
cmpb   $0x0,(%r15,%rbx,1)
jne    117b <output+0x5b>
lea    0x3(%rax),%ebx
cmpb   $0x0,(%r15,%rbx,1)
jne    117b <output+0x5b>
lea    0x2(%rax),%ebx
cmpb   $0x0,(%r15,%rbx,1)
jne    117b <output+0x5b>
lea    0x1(%rax),%ebx
cmpb   $0x0,(%r15,%rbx,1)
jne    117b <output+0x5b>
mov    %eax,%ecx
cmpb   $0x0,(%r15,%rcx,1)
jne    1179 <output+0x59>
add    $0xfffffffb,%eax
cmp    $0xfffffffb,%eax
jne    1130 <output+0x10>
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11b5 <output+0x95>
mov    %eax,%ebx
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
js     11b5 <output+0x95>
mov    %ebx,%ebx
lea    0xe8a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
jb     11a0 <output+0x80>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"The Fibonacci number for %d is \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @output(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 1299, i32* %5
br label %7
7: ; preds = %21, %2
%8 = load i32, i32* %5
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %10
%19 = load i32, i32* %5
store i32 %19, i32* %6
br label %24
20: ; preds = %10
br label %21
21: ; preds = %20
%22 = load i32, i32* %5
%23 = add nsw i32 %22, -1
store i32 %23, i32* %5
br label %7
24: ; preds = %18, %7
%25 = load i32, i32* %3
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %38, %24
%28 = load i32, i32* %6
%29 = icmp sge i32 %28, 0
br i1 %29, label %30, label %41
30: ; preds = %27
%31 = load i8*, i8** %4
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %30
%39 = load i32, i32* %6
%40 = add nsw i32 %39, -1
store i32 %40, i32* %6
br label %27
41: ; preds = %27
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"The Fibonacci number for %d is \00"
@.str.1 = [3 x i8] c"%d\00"
define void @output(i32 %0, i8* nocapture %1) {
br label %3
3: ; preds = %33, %2
%4 = phi i32 [ 1299, %2 ], [ %34, %33 ]
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %1, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %38
9: ; preds = %3
%10 = add nsw i32 %4, -1
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %1, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %38
15: ; preds = %9
%16 = add nsw i32 %4, -2
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %1, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %38
21: ; preds = %15
%22 = add nsw i32 %4, -3
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %1, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %27, label %38
27: ; preds = %21
%28 = add nsw i32 %4, -4
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %1, i64 %29
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %27
%34 = add nsw i32 %4, -5
%35 = icmp eq i32 %28, 0
br i1 %35, label %36, label %3
36: ; preds = %33
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %52
38: ; preds = %27, %21, %15, %9, %3
%39 = phi i32 [ %4, %3 ], [ %10, %9 ], [ %16, %15 ], [ %22, %21 ], [ %28, %27 ]
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0)
%41 = icmp sgt i32 %39, -1
br i1 %41, label %42, label %52
42: ; preds = %38
%43 = zext i32 %39 to i64
br label %44
44: ; preds = %42, %44
%45 = phi i64 [ %43, %42 ], [ %50, %44 ]
%46 = getelementptr inbounds i8, i8* %1, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = add nsw i64 %45, -1
%51 = icmp eq i64 %45, 0
br i1 %51, label %52, label %44
52: ; preds = %44, %36, %38
%53 = tail call i32 @putchar(i32 10)
ret void
}