#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 EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ errno;
char *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int, unsigned int);
int sscanf(char *, char *, unsigned int *, unsigned int *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  char *buf[1024];
  unsigned int no_errors = 1, max_cycle, cycle_start, cycle_end, current, n,
               tmp, cand_len;
  for (cycle_start = 0, cycle_end = 0;
       (char *)&buf == fgets((char *)&buf, sizeof buf, stdin) &&
       (2 == sscanf((char *)&buf, "%u %u", &cycle_start, &cycle_end) ||
        (no_errors = 0));
       printf("%d %d %d\n", cycle_end == tmp ? cycle_end : cycle_start,
              cycle_end == tmp ? cycle_start : cycle_end, max_cycle))
    for (tmp = cycle_start,
        cycle_start = (cycle_end < cycle_start) ? cycle_end : cycle_start,
        cycle_end = (cycle_end < tmp) ? tmp : cycle_end,
        current = cycle_start - 1, max_cycle = 1;
         current++<cycle_end; max_cycle = cand_len> max_cycle ? cand_len
                                                              : max_cycle)
      for (n = current, cand_len = 1; 1 != n; cand_len++)
        if (n % 2)
          n = 3 * n + 1;
        else
          n /= 2;
  if (errno || !no_errors) {
    perror(argv[0]);
    return EXIT_FAILURE;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2060,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x2014(%rbp)
movl   $0x0,-0x201c(%rbp)
movl   $0x0,-0x2020(%rbp)
lea    -0x2010(%rbp),%rax
mov    %rax,-0x2040(%rbp)
lea    -0x2010(%rbp),%rdi
mov    0x2e55(%rip),%rax
mov    (%rax),%edx
mov    $0x2000,%esi
call   1040 <fgets@plt>
mov    -0x2040(%rbp),%rcx
mov    %rax,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x2031(%rbp)
jne    1210 <main+0xd0>
lea    -0x2010(%rbp),%rdi
lea    0xe38(%rip),%rsi
lea    -0x201c(%rbp),%rdx
lea    -0x2020(%rbp),%rcx
call   1050 <sscanf@plt>
mov    %eax,%edx
mov    $0x1,%al
mov    $0x2,%ecx
cmp    %edx,%ecx
mov    %al,-0x2041(%rbp)
je     1204 <main+0xc4>
movl   $0x0,-0x2014(%rbp)
xor    %eax,%eax
mov    %al,-0x2041(%rbp)
mov    -0x2041(%rbp),%al
mov    %al,-0x2031(%rbp)
mov    -0x2031(%rbp),%al
test   $0x1,%al
jne    1223 <main+0xe3>
jmp    1428 <main+0x2e8>
mov    -0x201c(%rbp),%eax
mov    %eax,-0x202c(%rbp)
mov    -0x2020(%rbp),%eax
cmp    -0x201c(%rbp),%eax
jae    1252 <main+0x112>
mov    -0x2020(%rbp),%eax
mov    %eax,-0x2048(%rbp)
jmp    125e <main+0x11e>
mov    -0x201c(%rbp),%eax
mov    %eax,-0x2048(%rbp)
mov    -0x2048(%rbp),%eax
mov    %eax,-0x201c(%rbp)
mov    -0x2020(%rbp),%eax
cmp    -0x202c(%rbp),%eax
jae    128d <main+0x14d>
mov    -0x202c(%rbp),%eax
mov    %eax,-0x204c(%rbp)
jmp    1299 <main+0x159>
mov    -0x2020(%rbp),%eax
mov    %eax,-0x204c(%rbp)
mov    -0x204c(%rbp),%eax
mov    %eax,-0x2020(%rbp)
mov    -0x201c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2024(%rbp)
movl   $0x1,-0x2018(%rbp)
mov    -0x2024(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x2024(%rbp)
cmp    -0x2020(%rbp),%eax
jae    1396 <main+0x256>
mov    -0x2024(%rbp),%eax
mov    %eax,-0x2028(%rbp)
movl   $0x1,-0x2030(%rbp)
mov    $0x1,%eax
cmp    -0x2028(%rbp),%eax
je     1351 <main+0x211>
mov    -0x2028(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1329 <main+0x1e9>
imul   $0x3,-0x2028(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2028(%rbp)
jmp    1338 <main+0x1f8>
mov    -0x2028(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x2028(%rbp)
jmp    133d <main+0x1fd>
mov    -0x2030(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2030(%rbp)
jmp    12f1 <main+0x1b1>
jmp    1356 <main+0x216>
mov    -0x2030(%rbp),%eax
cmp    -0x2018(%rbp),%eax
jbe    1379 <main+0x239>
mov    -0x2030(%rbp),%eax
mov    %eax,-0x2050(%rbp)
jmp    1385 <main+0x245>
mov    -0x2018(%rbp),%eax
mov    %eax,-0x2050(%rbp)
mov    -0x2050(%rbp),%eax
mov    %eax,-0x2018(%rbp)
jmp    12be <main+0x17e>
jmp    139b <main+0x25b>
mov    -0x2020(%rbp),%eax
cmp    -0x202c(%rbp),%eax
jne    13be <main+0x27e>
mov    -0x2020(%rbp),%eax
mov    %eax,-0x2054(%rbp)
jmp    13ca <main+0x28a>
mov    -0x201c(%rbp),%eax
mov    %eax,-0x2054(%rbp)
mov    -0x2054(%rbp),%eax
mov    %eax,-0x2058(%rbp)
mov    -0x2020(%rbp),%eax
cmp    -0x202c(%rbp),%eax
jne    13f9 <main+0x2b9>
mov    -0x201c(%rbp),%eax
mov    %eax,-0x205c(%rbp)
jmp    1405 <main+0x2c5>
mov    -0x2020(%rbp),%eax
mov    %eax,-0x205c(%rbp)
mov    -0x2058(%rbp),%esi
mov    -0x205c(%rbp),%edx
mov    -0x2018(%rbp),%ecx
lea    0xbe8(%rip),%rdi
call   1030 <printf@plt>
jmp    1177 <main+0x37>
mov    0x2ba9(%rip),%rax
cmpq   $0x0,(%rax)
jne    1446 <main+0x306>
cmpl   $0x0,-0x2014(%rbp)
jne    1463 <main+0x323>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <perror@plt>
mov    0x2b77(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    146f <main+0x32f>
mov    0x2b5e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2060,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2018,%rsp
mov    %rsi,0x8(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
mov    0x2e7c(%rip),%r14
mov    (%r14),%edx
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    $0x2000,%esi
call   1040 <fgets@plt>
cmp    %r12,%rax
je     11b2 <main+0x72>
mov    0x2e4b(%rip),%rax
cmpq   $0x0,(%rax)
jne    1289 <main+0x149>
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
add    $0x2018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsp,%r13
lea    0xe4a(%rip),%r15
jmp    11e8 <main+0xa8>
xchg   %ax,%ax
cmp    %r9d,%r8d
mov    %edi,%esi
cmovb  %edx,%esi
cmovb  %edi,%edx
mov    %r15,%rdi
call   1030 <printf@plt>
mov    (%r14),%edx
mov    %r12,%rdi
mov    $0x2000,%esi
call   1040 <fgets@plt>
cmp    %r12,%rax
jne    1186 <main+0x46>
mov    %r12,%rdi
lea    0xe0e(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %r13,%rcx
call   1050 <sscanf@plt>
cmp    $0x2,%eax
jne    1289 <main+0x149>
mov    0x4(%rsp),%r8d
mov    (%rsp),%r9d
cmp    %r8d,%r9d
mov    %r8d,%edx
cmovb  %r9d,%edx
mov    %edx,0x4(%rsp)
mov    %r9d,%edi
cmovb  %r8d,%edi
mov    %edi,(%rsp)
lea    -0x1(%rdx),%eax
mov    $0x1,%ecx
cmp    %edi,%eax
jae    11c0 <main+0x80>
mov    $0x1,%ecx
mov    %edx,%eax
jmp    1252 <main+0x112>
xchg   %ax,%ax
cmp    %ecx,%ebx
cmova  %ebx,%ecx
lea    0x1(%rax),%esi
cmp    %edi,%eax
mov    %esi,%eax
je     11c0 <main+0x80>
mov    $0x1,%ebx
cmp    $0x1,%eax
je     1240 <main+0x100>
mov    $0x1,%ebx
mov    %eax,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%esi
shr    %esi
test   $0x1,%bpl
lea    0x1(%rbp,%rbp,2),%ebp
cmove  %esi,%ebp
add    $0x1,%ebx
cmp    $0x1,%ebp
jne    1270 <main+0x130>
jmp    1240 <main+0x100>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
call   1060 <perror@plt>
mov    0x2d33(%rip),%rax
jmp    119e <main+0x5e>

LLVM IR (-O0):
@stdin = global i32 0
@.str = [6 x i8] c"%u %u\00"
@.str.1 = [10 x i8] c"%d %d %d\0A\00"
@errno = global i64 0
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8*]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
store i32 0, i32* %9
store i32 0, i32* %10
br label %15
15: ; preds = %106, %2
%16 = bitcast [1024 x i8*]* %6 to i8*
%17 = bitcast [1024 x i8*]* %6 to i8*
%18 = load i32, i32* @stdin
%19 = call i8* @fgets(i8* %17, i32 8192, i32 %18)
%20 = icmp eq i8* %16, %19
br i1 %20, label %21, label %28
21: ; preds = %15
%22 = bitcast [1024 x i8*]* %6 to i8*
%23 = call i32 @sscanf(i8* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %9, i32* %10)
%24 = icmp eq i32 2, %23
br i1 %24, label %26, label %25
25: ; preds = %21
store i32 0, i32* %7
br label %26
26: ; preds = %25, %21
%27 = phi i1 [ true, %21 ], [ false, %25 ]
br label %28
28: ; preds = %26, %15
%29 = phi i1 [ false, %15 ], [ %27, %26 ]
br i1 %29, label %30, label %110
30: ; preds = %28
%31 = load i32, i32* %9
store i32 %31, i32* %13
%32 = load i32, i32* %10
%33 = load i32, i32* %9
%34 = icmp ult i32 %32, %33
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = load i32, i32* %10
br label %39
37: ; preds = %30
%38 = load i32, i32* %9
br label %39
39: ; preds = %37, %35
%40 = phi i32 [ %36, %35 ], [ %38, %37 ]
store i32 %40, i32* %9
%41 = load i32, i32* %10
%42 = load i32, i32* %13
%43 = icmp ult i32 %41, %42
br i1 %43, label %44, label %46
44: ; preds = %39
%45 = load i32, i32* %13
br label %48
46: ; preds = %39
%47 = load i32, i32* %10
br label %48
48: ; preds = %46, %44
%49 = phi i32 [ %45, %44 ], [ %47, %46 ]
store i32 %49, i32* %10
%50 = load i32, i32* %9
%51 = sub i32 %50, 1
store i32 %51, i32* %11
store i32 1, i32* %8
br label %52
52: ; preds = %86, %48
%53 = load i32, i32* %11
%54 = add i32 %53, 1
store i32 %54, i32* %11
%55 = load i32, i32* %10
%56 = icmp ult i32 %53, %55
br i1 %56, label %57, label %88
57: ; preds = %52
%58 = load i32, i32* %11
store i32 %58, i32* %12
store i32 1, i32* %14
br label %59
59: ; preds = %74, %57
%60 = load i32, i32* %12
%61 = icmp ne i32 1, %60
br i1 %61, label %62, label %77
62: ; preds = %59
%63 = load i32, i32* %12
%64 = urem i32 %63, 2
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %70
66: ; preds = %62
%67 = load i32, i32* %12
%68 = mul i32 3, %67
%69 = add i32 %68, 1
store i32 %69, i32* %12
br label %73
70: ; preds = %62
%71 = load i32, i32* %12
%72 = udiv i32 %71, 2
store i32 %72, i32* %12
br label %73
73: ; preds = %70, %66
br label %74
74: ; preds = %73
%75 = load i32, i32* %14
%76 = add i32 %75, 1
store i32 %76, i32* %14
br label %59
77: ; preds = %59
br label %78
78: ; preds = %77
%79 = load i32, i32* %14
%80 = load i32, i32* %8
%81 = icmp ugt i32 %79, %80
br i1 %81, label %82, label %84
82: ; preds = %78
%83 = load i32, i32* %14
br label %86
84: ; preds = %78
%85 = load i32, i32* %8
br label %86
86: ; preds = %84, %82
%87 = phi i32 [ %83, %82 ], [ %85, %84 ]
store i32 %87, i32* %8
br label %52
88: ; preds = %52
br label %89
89: ; preds = %88
%90 = load i32, i32* %10
%91 = load i32, i32* %13
%92 = icmp eq i32 %90, %91
br i1 %92, label %93, label %95
93: ; preds = %89
%94 = load i32, i32* %10
br label %97
95: ; preds = %89
%96 = load i32, i32* %9
br label %97
97: ; preds = %95, %93
%98 = phi i32 [ %94, %93 ], [ %96, %95 ]
%99 = load i32, i32* %10
%100 = load i32, i32* %13
%101 = icmp eq i32 %99, %100
br i1 %101, label %102, label %104
102: ; preds = %97
%103 = load i32, i32* %9
br label %106
104: ; preds = %97
%105 = load i32, i32* %10
br label %106
106: ; preds = %104, %102
%107 = phi i32 [ %103, %102 ], [ %105, %104 ]
%108 = load i32, i32* %8
%109 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %98, i32 %107, i32 %108)
br label %15
110: ; preds = %28
%111 = load i64, i64* @errno
%112 = icmp ne i64 %111, 0
br i1 %112, label %116, label %113
113: ; preds = %110
%114 = load i32, i32* %7
%115 = icmp ne i32 %114, 0
br i1 %115, label %122, label %116
116: ; preds = %113, %110
%117 = load i8**, i8*** %5
%118 = getelementptr inbounds i8*, i8** %117, i64 0
%119 = load i8*, i8** %118
%120 = call i32 @perror(i8* %119)
%121 = load i32, i32* @EXIT_FAILURE
store i32 %121, i32* %3
br label %124
122: ; preds = %113
%123 = load i32, i32* @EXIT_SUCCESS
store i32 %123, i32* %3
br label %124
124: ; preds = %122, %116
%125 = load i32, i32* %3
ret i32 %125
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [6 x i8] c"%u %u\00"
@.str.1 = [10 x i8] c"%d %d %d\0A\00"
@errno = global i64 0
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8*]
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [1024 x i8*]* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %4
store i32 0, i32* %5
%9 = load i32, i32* @stdin
%10 = call i8* @fgets(i8* %6, i32 8192, i32 %9)
%11 = icmp eq i8* %10, %6
br i1 %11, label %12, label %53
12: ; preds = %2, %44
%13 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5)
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %56
15: ; preds = %12
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = icmp ult i32 %17, %16
%19 = select i1 %18, i32 %17, i32 %16
store i32 %19, i32* %4
%20 = select i1 %18, i32 %16, i32 %17
store i32 %20, i32* %5
%21 = add i32 %19, -1
%22 = icmp ult i32 %21, %20
br i1 %22, label %23, label %44
23: ; preds = %15, %38
%24 = phi i32 [ %42, %38 ], [ %19, %15 ]
%25 = phi i32 [ %41, %38 ], [ 1, %15 ]
%26 = icmp eq i32 %24, 1
br i1 %26, label %38, label %27
27: ; preds = %23, %27
%28 = phi i32 [ %36, %27 ], [ 1, %23 ]
%29 = phi i32 [ %35, %27 ], [ %24, %23 ]
%30 = and i32 %29, 1
%31 = icmp eq i32 %30, 0
%32 = mul i32 %29, 3
%33 = add i32 %32, 1
%34 = lshr i32 %29, 1
%35 = select i1 %31, i32 %34, i32 %33
%36 = add i32 %28, 1
%37 = icmp eq i32 %35, 1
br i1 %37, label %38, label %27
38: ; preds = %27, %23
%39 = phi i32 [ 1, %23 ], [ %36, %27 ]
%40 = icmp ugt i32 %39, %25
%41 = select i1 %40, i32 %39, i32 %25
%42 = add i32 %24, 1
%43 = icmp eq i32 %24, %20
br i1 %43, label %44, label %23
44: ; preds = %38, %15
%45 = phi i32 [ 1, %15 ], [ %41, %38 ]
%46 = icmp ult i32 %16, %17
%47 = select i1 %46, i32 %19, i32 %20
%48 = select i1 %46, i32 %20, i32 %19
%49 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %47, i32 %48, i32 %45)
%50 = load i32, i32* @stdin
%51 = call i8* @fgets(i8* %6, i32 8192, i32 %50)
%52 = icmp eq i8* %51, %6
br i1 %52, label %12, label %53
53: ; preds = %44, %2
%54 = load i64, i64* @errno
%55 = icmp eq i64 %54, 0
br i1 %55, label %59, label %56
56: ; preds = %12, %53
%57 = load i8*, i8** %1
%58 = call i32 @perror(i8* %57)
br label %59
59: ; preds = %53, %56
%60 = phi i32* [ @EXIT_FAILURE, %56 ], [ @EXIT_SUCCESS, %53 ]
%61 = load i32, i32* %60
ret i32 %61
}