#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 */
unsigned long long ULLONG_MAX;
int /*<<< orphan*/ printf(char *, unsigned long long, int, int);
int main(int argc, char **argv) {
  unsigned long long n;
  int num, max = 0;
  for (n = 2; n < ULLONG_MAX; n++) {
    int count = 0, a = n, b = n;
    while (a > 1) {
      if (a % 2 == 0)
        a /= 2;
      else
        a = 3 * a + 1;
      count++;
    }
    if (count > max) {
      max = count;
      num = b;
    }
    printf("数字[%llu]经过%5d次变换到达黑洞中心【变换次数最高纪录：%d】\n", n,
           count, max);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movq   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%rax
jae    11e6 <main+0xd6>
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,-0x2c(%rbp)
cmpl   $0x1,-0x28(%rbp)
jle    11a7 <main+0x97>
mov    -0x28(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    118f <main+0x7f>
mov    -0x28(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x28(%rbp)
jmp    1199 <main+0x89>
imul   $0x3,-0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115e <main+0x4e>
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    11bf <main+0xaf>
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1135 <main+0x25>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2eca(%rip),%r15
cmpq   $0x3,(%r15)
jb     1187 <main+0x77>
xor    %ebp,%ebp
mov    $0x2,%ebx
lea    0xece(%rip),%r14
jmp    115b <main+0x4b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %ebp,%edx
cmovg  %edx,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%ecx
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    (%r15),%rbx
jae    1187 <main+0x77>
mov    $0x0,%edx
cmp    $0x2,%ebx
jl     1140 <main+0x30>
xor    %edx,%edx
mov    %ebx,%eax
nopl   0x0(%rax)
mov    %eax,%ecx
shr    %ecx
test   $0x1,%al
lea    0x1(%rax,%rax,2),%eax
cmove  %ecx,%eax
add    $0x1,%edx
cmp    $0x1,%eax
jg     1170 <main+0x60>
jmp    1140 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@ULLONG_MAX = global i64 0
@.str = [85 x i8] c"\E6\95\B0\E5\AD\97[%llu]\E7\BB\8F\E8\BF\87%5d\E6\AC\A1\E5\8F\98\E6\8D\A2\E5\88\B0\E8\BE\BE\E9\BB\91\E6\B4\9E\E4\B8\AD\E5\BF\83\E3\80\90\E5\8F\98\E6\8D\A2\E6\AC\A1\E6\95\B0\E6\9C\80\E9\AB\98\E7\BA\AA\E5\BD\95\EF\BC\9A%d\E3\80\91\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i64 2, i64* %6
br label %12
12: ; preds = %50, %2
%13 = load i64, i64* %6
%14 = load i64, i64* @ULLONG_MAX
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %53
16: ; preds = %12
store i32 0, i32* %9
%17 = load i64, i64* %6
%18 = trunc i64 %17 to i32
store i32 %18, i32* %10
%19 = load i64, i64* %6
%20 = trunc i64 %19 to i32
store i32 %20, i32* %11
br label %21
21: ; preds = %35, %16
%22 = load i32, i32* %10
%23 = icmp sgt i32 %22, 1
br i1 %23, label %24, label %38
24: ; preds = %21
%25 = load i32, i32* %10
%26 = srem i32 %25, 2
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i32, i32* %10
%30 = sdiv i32 %29, 2
store i32 %30, i32* %10
br label %35
31: ; preds = %24
%32 = load i32, i32* %10
%33 = mul nsw i32 3, %32
%34 = add nsw i32 %33, 1
store i32 %34, i32* %10
br label %35
35: ; preds = %31, %28
%36 = load i32, i32* %9
%37 = add nsw i32 %36, 1
store i32 %37, i32* %9
br label %21
38: ; preds = %21
%39 = load i32, i32* %9
%40 = load i32, i32* %8
%41 = icmp sgt i32 %39, %40
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load i32, i32* %9
store i32 %43, i32* %8
%44 = load i32, i32* %11
store i32 %44, i32* %7
br label %45
45: ; preds = %42, %38
%46 = load i64, i64* %6
%47 = load i32, i32* %9
%48 = load i32, i32* %8
%49 = call i32 @printf(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0), i64 %46, i32 %47, i32 %48)
br label %50
50: ; preds = %45
%51 = load i64, i64* %6
%52 = add i64 %51, 1
store i64 %52, i64* %6
br label %12
53: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@ULLONG_MAX = global i64 0
@.str = [85 x i8] c"\E6\95\B0\E5\AD\97[%llu]\E7\BB\8F\E8\BF\87%5d\E6\AC\A1\E5\8F\98\E6\8D\A2\E5\88\B0\E8\BE\BE\E9\BB\91\E6\B4\9E\E4\B8\AD\E5\BF\83\E3\80\90\E5\8F\98\E6\8D\A2\E6\AC\A1\E6\95\B0\E6\9C\80\E9\AB\98\E7\BA\AA\E5\BD\95\EF\BC\9A%d\E3\80\91\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i64, i64* @ULLONG_MAX
%4 = icmp ugt i64 %3, 2
br i1 %4, label %5, label %29
5: ; preds = %2, %21
%6 = phi i64 [ %26, %21 ], [ 2, %2 ]
%7 = phi i32 [ %24, %21 ], [ 0, %2 ]
%8 = trunc i64 %6 to i32
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %21
10: ; preds = %5, %10
%11 = phi i32 [ %18, %10 ], [ %8, %5 ]
%12 = phi i32 [ %19, %10 ], [ 0, %5 ]
%13 = and i32 %11, 1
%14 = icmp eq i32 %13, 0
%15 = lshr i32 %11, 1
%16 = mul nsw i32 %11, 3
%17 = add nsw i32 %16, 1
%18 = select i1 %14, i32 %15, i32 %17
%19 = add nuw nsw i32 %12, 1
%20 = icmp sgt i32 %18, 1
br i1 %20, label %10, label %21
21: ; preds = %10, %5
%22 = phi i32 [ 0, %5 ], [ %19, %10 ]
%23 = icmp sgt i32 %22, %7
%24 = select i1 %23, i32 %22, i32 %7
%25 = tail call i32 @printf(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0), i64 %6, i32 %22, i32 %24)
%26 = add nuw i64 %6, 1
%27 = load i64, i64* @ULLONG_MAX
%28 = icmp ult i64 %26, %27
br i1 %28, label %5, label %29
29: ; preds = %21, %2
ret i32 0
}