#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 series(int n, int a, int b) {
  if (n == 0) {
    printf("\n");
    return;
  }
  printf("%d ", a);
  int temp = a + b;
  a = b;
  b = temp;
  series(n - 1, a, b);
  return;
}


x86 assembly (clang, -O0):
<series>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    114e <series+0x2e>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1185 <series+0x65>
mov    -0x8(%rbp),%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <series@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<series>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
je     115c <series+0x3c>
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xeca(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %edx,%r15d
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %r15d,%ebx
mov    %ebx,%edx
mov    %r15d,%ebx
add    $0xffffffff,%ebp
jne    1140 <series+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [4 x i8] c"%d \00"
define void @series(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %24
12: ; preds = %3
%13 = load i32, i32* %5
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = add nsw i32 %15, %16
store i32 %17, i32* %7
%18 = load i32, i32* %6
store i32 %18, i32* %5
%19 = load i32, i32* %7
store i32 %19, i32* %6
%20 = load i32, i32* %4
%21 = sub nsw i32 %20, 1
%22 = load i32, i32* %5
%23 = load i32, i32* %6
br label %24
24: ; preds = %12, %10
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d \00"
define void @series(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %7, %3
%6 = tail call i32 @putchar(i32 10)
ret void
7: ; preds = %3, %7
%8 = phi i32 [ %12, %7 ], [ %2, %3 ]
%9 = phi i32 [ %8, %7 ], [ %1, %3 ]
%10 = phi i32 [ %13, %7 ], [ %0, %3 ]
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%12 = add nsw i32 %8, %9
%13 = add nsw i32 %10, -1
%14 = icmp eq i32 %13, 0
br i1 %14, label %5, label %7
}