#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, unsigned long long *);
int main() {
  FILE *f = fopen("INP.TXT", "r");
  unsigned long long x, y;
  char z = 1;
  fscanf(f, "%lld", &x);
  fclose(f);
  f = fopen("OUT.TXT", "w");
  y = x;
  while (y ^ 1) {
    if (y % 2)
      y = y / 2 + 1;
    else
      y /= 2;
    z++;
  }
  fprintf(f, "%hhd ", z);
  z = 1;
  while (x ^ 1) {
    x /= 2;
    z++;
  }
  fprintf(f, "%hhd\n", z);
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
movb   $0x1,-0x21(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe95(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <fscanf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe81(%rip),%rdi
lea    0xe82(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
xor    $0x1,%rax
cmp    $0x0,%rax
je     11f8 <main+0xb8>
mov    -0x20(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     11df <main+0x9f>
mov    -0x20(%rbp),%rax
shr    $0x1,%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11eb <main+0xab>
mov    -0x20(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x21(%rbp),%al
add    $0x1,%al
mov    %al,-0x21(%rbp)
jmp    11a6 <main+0x66>
mov    -0x10(%rbp),%rdi
lea    0xe16(%rip),%rsi
movsbl -0x21(%rbp),%edx
call   1050 <fprintf@plt>
movb   $0x1,-0x21(%rbp)
mov    -0x18(%rbp),%rax
xor    $0x1,%rax
cmp    $0x0,%rax
je     123b <main+0xfb>
mov    -0x18(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x21(%rbp),%al
add    $0x1,%al
mov    %al,-0x21(%rbp)
jmp    1210 <main+0xd0>
mov    -0x10(%rbp),%rdi
lea    0xdd9(%rip),%rsi
movsbl -0x21(%rbp),%edx
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rdi
lea    0xeb6(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xea9(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1040 <fscanf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
lea    0xe94(%rip),%rdi
lea    0xe95(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
mov    (%rsp),%rax
mov    $0x1,%bl
mov    $0x1,%cl
cmp    $0x1,%rax
je     11b4 <main+0x74>
mov    $0x1,%cl
nopw   0x0(%rax,%rax,1)
mov    %eax,%edx
and    $0x1,%edx
shr    %rax
add    %rdx,%rax
add    $0x1,%cl
cmp    $0x1,%rax
jne    11a0 <main+0x60>
movsbl %cl,%edx
lea    0xe5b(%rip),%rsi
mov    %r14,%rdi
call   1050 <fprintf@plt>
mov    (%rsp),%rax
cmp    $0x1,%rax
je     11f4 <main+0xb4>
mov    $0x1,%bl
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
shr    %rax
add    $0x1,%bl
cmp    $0x1,%rax
jne    11e0 <main+0xa0>
movq   $0x1,(%rsp)
movsbl %bl,%edx
lea    0xe21(%rip),%rsi
mov    %r14,%rdi
call   1050 <fprintf@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"INP.TXT\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [5 x i8] c"%lld\00"
@.str.3 = [8 x i8] c"OUT.TXT\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [6 x i8] c"%hhd \00"
@.str.6 = [6 x i8] c"%hhd\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8
store i32 0, i32* %1
%6 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %2
store i8 1, i8* %5
%7 = load i32*, i32** %2
%8 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64* %3)
%9 = load i32*, i32** %2
%10 = call i32 @fclose(i32* %9)
%11 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %11, i32** %2
%12 = load i64, i64* %3
store i64 %12, i64* %4
br label %13
13: ; preds = %28, %0
%14 = load i64, i64* %4
%15 = xor i64 %14, 1
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %31
17: ; preds = %13
%18 = load i64, i64* %4
%19 = urem i64 %18, 2
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i64, i64* %4
%23 = udiv i64 %22, 2
%24 = add i64 %23, 1
store i64 %24, i64* %4
br label %28
25: ; preds = %17
%26 = load i64, i64* %4
%27 = udiv i64 %26, 2
store i64 %27, i64* %4
br label %28
28: ; preds = %25, %21
%29 = load i8, i8* %5
%30 = add i8 %29, 1
store i8 %30, i8* %5
br label %13
31: ; preds = %13
%32 = load i32*, i32** %2
%33 = load i8, i8* %5
%34 = call i32 @fprintf(i32* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8 signext %33)
store i8 1, i8* %5
br label %35
35: ; preds = %39, %31
%36 = load i64, i64* %3
%37 = xor i64 %36, 1
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %44
39: ; preds = %35
%40 = load i64, i64* %3
%41 = udiv i64 %40, 2
store i64 %41, i64* %3
%42 = load i8, i8* %5
%43 = add i8 %42, 1
store i8 %43, i8* %5
br label %35
44: ; preds = %35
%45 = load i32*, i32** %2
%46 = load i8, i8* %5
%47 = call i32 @fprintf(i32* %45, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8 signext %46)
%48 = load i32*, i32** %2
%49 = call i32 @fclose(i32* %48)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"INP.TXT\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [5 x i8] c"%lld\00"
@.str.3 = [8 x i8] c"OUT.TXT\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [6 x i8] c"%hhd \00"
@.str.6 = [6 x i8] c"%hhd\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = bitcast i64* %1 to i8*
%4 = call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64* %1)
%5 = call i32 @fclose(i32* %2)
%6 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%7 = load i64, i64* %1
%8 = icmp eq i64 %7, 1
br i1 %8, label %17, label %9
9: ; preds = %0, %9
%10 = phi i8 [ %15, %9 ], [ 1, %0 ]
%11 = phi i64 [ %14, %9 ], [ %7, %0 ]
%12 = and i64 %11, 1
%13 = lshr i64 %11, 1
%14 = add nuw i64 %13, %12
%15 = add i8 %10, 1
%16 = icmp eq i64 %14, 1
br i1 %16, label %17, label %9
17: ; preds = %9, %0
%18 = phi i8 [ 1, %0 ], [ %15, %9 ]
%19 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8 signext %18)
%20 = load i64, i64* %1
%21 = icmp eq i64 %20, 1
br i1 %21, label %29, label %22
22: ; preds = %17, %22
%23 = phi i8 [ %26, %22 ], [ 1, %17 ]
%24 = phi i64 [ %25, %22 ], [ %20, %17 ]
%25 = lshr i64 %24, 1
%26 = add i8 %23, 1
%27 = icmp eq i64 %25, 1
br i1 %27, label %28, label %22
28: ; preds = %22
store i64 1, i64* %1
br label %29
29: ; preds = %28, %17
%30 = phi i8 [ %26, %28 ], [ 1, %17 ]
%31 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8 signext %30)
%32 = call i32 @fclose(i32* %6)
ret i32 0
}