#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 remain(long long);
int /*<<< orphan*/ scanf(char *, long long *);
void experiment() {
  long long d;
  scanf("%lld", &d);
  d = (d - 1) << 1;
  if (d >= 1000000006L)
    d -= (d / 1000000006L) * 1000000006L;
  printf("%lld\n", (8 * remain(d)) % 1000000007L);
}


x86 assembly (clang, -O0):
<experiment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
shl    $0x1,%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x3b9aca06,-0x8(%rbp)
3b
jl     1186 <experiment+0x56>
mov    -0x8(%rbp),%rax
mov    $0x3b9aca06,%ecx
cqto
idiv   %rcx
imul   $0x3b9aca06,%rax,%rcx
mov    -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <remain@plt>
shl    $0x3,%eax
cltq
mov    $0x3b9aca07,%ecx
cqto
idiv   %rcx
mov    %edx,%esi
lea    0xe5e(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<experiment>:
push   %rax
lea    0xec8(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%rax
lea    (%rax,%rax,1),%rdi
add    $0xfffffffffffffffe,%rdi
cmp    $0x3b9aca06,%rdi
jl     1180 <experiment+0x50>
movabs $0x89705f3360ee499f,%rcx
5f 70 89
mov    %rdi,%rax
imul   %rcx
add    %rdi,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x1d,%rdx
add    %rax,%rdx
imul   $0x3b9aca06,%rdx,%rax
sub    %rax,%rdi
mov    %rdi,(%rsp)
call   1030 <remain@plt>
shl    $0x3,%eax
movslq %eax,%rsi
imul   $0x44b82f99,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x3c,%rax
add    %ecx,%eax
imul   $0x3b9aca07,%eax,%eax
sub    %eax,%esi
lea    0xe53(%rip),%rdi
call   1040 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [6 x i8] c"%lld\0A\00"
define void @experiment() {
%1 = alloca i64
%2 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%3 = load i64, i64* %1
%4 = sub nsw i64 %3, 1
%5 = shl i64 %4, 1
store i64 %5, i64* %1
%6 = load i64, i64* %1
%7 = icmp sge i64 %6, 1000000006
br i1 %7, label %8, label %14
8: ; preds = %0
%9 = load i64, i64* %1
%10 = sdiv i64 %9, 1000000006
%11 = mul nsw i64 %10, 1000000006
%12 = load i64, i64* %1
%13 = sub nsw i64 %12, %11
store i64 %13, i64* %1
br label %14
14: ; preds = %8, %0
%15 = load i64, i64* %1
%16 = call i32 @remain(i64 %15)
%17 = mul nsw i32 8, %16
%18 = sext i32 %17 to i64
%19 = srem i64 %18, 1000000007
%20 = trunc i64 %19 to i32
%21 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %20)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [6 x i8] c"%lld\0A\00"
define void @experiment() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = shl i64 %4, 1
%6 = add i64 %5, -2
%7 = icmp sgt i64 %6, 1000000005
%8 = srem i64 %6, 1000000006
%9 = select i1 %7, i64 %8, i64 %6
store i64 %9, i64* %1
%10 = call i32 @remain(i64 %9)
%11 = shl nsw i32 %10, 3
%12 = srem i32 %11, 1000000007
%13 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %12)
ret void
}