#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 *, int);
void revprint(int);
void print(int n) {
  if (n < 0) {
    printf("%d ", n);
    return revprint(n + 5);
  }
  if (n == 0) {
    printf("%d", n);
  } else {
    printf("%d ", n);
    print(n - 5);
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1164 <print+0x34>
mov    -0x4(%rbp),%esi
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
add    $0x5,%edi
call   1030 <revprint@plt>
jmp    119c <print+0x6c>
cmpl   $0x0,-0x4(%rbp)
jne    1182 <print+0x52>
mov    -0x4(%rbp),%esi
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
jmp    119c <print+0x6c>
mov    -0x4(%rbp),%esi
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
sub    $0x5,%edi
call   1050 <print@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
test   %edi,%edi
js     1158 <print+0x38>
lea    0xecf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %ebx,%ebx
je     1177 <print+0x57>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
add    $0xfffffffb,%ebx
mov    %ebx,%eax
add    $0x5,%eax
jae    1140 <print+0x20>
lea    0xea1(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
add    $0x5,%ebx
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <revprint@plt>
lea    0xe86(%rip),%rdi
xor    %esi,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

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

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