#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);
int hotpo(int n) {
  printf("%d ", n);
  if (n == 1)
    return 1;
  if (n % 2 == 0)
    n /= 2;
  else
    n = (n * 3 + 1);
  return 1 + hotpo(n);
}


x86 assembly (clang, -O0):
<hotpo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    1150 <hotpo+0x30>
movl   $0x1,-0x4(%rbp)
jmp    118f <hotpo+0x6f>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1177 <hotpo+0x57>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1181 <hotpo+0x61>
imul   $0x3,-0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <hotpo@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hotpo>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
lea    0xee3(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    $0x1,%ebp
cmp    $0x1,%ebx
jne    1135 <hotpo+0x25>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0x1,%ebp
lea    0xebf(%rip),%r14
jmp    1168 <hotpo+0x58>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%rbx,%rbx,2),%ebx
add    $0x1,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0x1,%ebx
je     112e <hotpo+0x1e>
test   $0x1,%bl
jne    1150 <hotpo+0x40>
mov    %ebx,%eax
shr    $0x1f,%eax
add    %ebx,%eax
sar    %eax
mov    %eax,%ebx
jmp    1156 <hotpo+0x46>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @hotpo(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = icmp eq i32 %0, 1
br i1 %3, label %21, label %4
4: ; preds = %1, %14
%5 = phi i32 [ %15, %14 ], [ %0, %1 ]
%6 = phi i32 [ %16, %14 ], [ 0, %1 ]
%7 = and i32 %5, 1
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = sdiv i32 %5, 2
br label %14
11: ; preds = %4
%12 = mul nsw i32 %5, 3
%13 = add nsw i32 %12, 1
br label %14
14: ; preds = %11, %9
%15 = phi i32 [ %10, %9 ], [ %13, %11 ]
%16 = add nuw nsw i32 %6, 1
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%18 = icmp eq i32 %15, 1
br i1 %18, label %19, label %4
19: ; preds = %14
%20 = add nuw i32 %6, 2
br label %21
21: ; preds = %19, %1
%22 = phi i32 [ 1, %1 ], [ %20, %19 ]
ret i32 %22
}