#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 collatzConjectureRecursive(int x) {
  if (x < 1) {
    printf("Invalid input for the Collatz Conjecture.\n");
    return;
  }
  printf("%d\n", x);
  if (x == 1) {
    return;
  } else if ((x % 2) == 0) {
    collatzConjectureRecursive(x / 2);
  } else {
    collatzConjectureRecursive((3 * x) + 1);
  }
  return;
}


x86 assembly (clang, -O0):
<collatzConjectureRecursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jge    1148 <collatzConjectureRecursive+0x28>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a9 <collatzConjectureRecursive+0x89>
mov    -0x4(%rbp),%esi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    1168 <collatzConjectureRecursive+0x48>
jmp    11a9 <collatzConjectureRecursive+0x89>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1193 <collatzConjectureRecursive+0x73>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <collatzConjectureRecursive@plt>
jmp    119f <collatzConjectureRecursive+0x7f>
imul   $0x3,-0x4(%rbp),%edi
add    $0x1,%edi
call   1040 <collatzConjectureRecursive@plt>
jmp    11a4 <collatzConjectureRecursive+0x84>
jmp    11a9 <collatzConjectureRecursive+0x89>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<collatzConjectureRecursive>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1163 <collatzConjectureRecursive+0x43>
mov    %edi,%ebx
lea    0xecf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x1,%ebx
je     1176 <collatzConjectureRecursive+0x56>
mov    %ebx,%eax
shr    %eax
test   $0x1,%bl
lea    0x1(%rbx,%rbx,2),%ebx
cmove  %eax,%ebx
test   %ebx,%ebx
jg     1140 <collatzConjectureRecursive+0x20>
lea    0xe9a(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [42 x i8] c"Invalid input for the Collatz Conjecture.\00"
define void @collatzConjectureRecursive(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %9, %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
br label %17
5: ; preds = %1, %9
%6 = phi i32 [ %15, %9 ], [ %0, %1 ]
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = icmp eq i32 %6, 1
br i1 %8, label %17, label %9
9: ; preds = %5
%10 = and i32 %6, 1
%11 = icmp eq i32 %10, 0
%12 = lshr i32 %6, 1
%13 = mul nsw i32 %6, 3
%14 = add nsw i32 %13, 1
%15 = select i1 %11, i32 %12, i32 %14
%16 = icmp slt i32 %15, 1
br i1 %16, label %3, label %5
17: ; preds = %5, %3
ret void
}