#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 */
scalar_t__ log(long);
long sin(long);
long sqrt(long);
void computeSequenceTerm(long int sequence[]) {
  long int index;
  sequence[0] = 1;
  for (index = 1; index <= 1000000L; index++)
    sequence[index] =
        (sequence[(long int)(index - sqrt(index))] % 1000000L +
         sequence[(long int)(log(index))] % 1000000L +
         sequence[(long int)(index * sin(index) * sin(index))] % 1000000L) %
        1000000L;
}


x86 assembly (clang, -O0):
<computeSequenceTerm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x1,(%rax)
movq   $0x1,-0x10(%rbp)
cmpq   $0xf4240,-0x10(%rbp)
jg     1246 <computeSequenceTerm+0x116>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <sqrt@plt>
mov    -0x50(%rbp),%rcx
mov    %rax,%rdx
mov    -0x48(%rbp),%rax
sub    %rdx,%rcx
mov    (%rax,%rcx,8),%rax
mov    $0xf4240,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <log@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
mov    (%rax,%rcx,8),%rax
mov    $0xf4240,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
mov    -0x38(%rbp),%rdx
add    %rax,%rdx
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sin@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
imul   %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sin@plt>
mov    -0x28(%rbp),%rcx
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
imul   %rdx,%rcx
mov    (%rax,%rcx,8),%rax
mov    $0xf4240,%ecx
cqto
idiv   %rcx
mov    -0x18(%rbp),%rax
add    %rdx,%rax
mov    $0xf4240,%ecx
cqto
idiv   %rcx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    114f <computeSequenceTerm+0x1f>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeSequenceTerm>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
movq   $0x1,(%rdi)
mov    $0x1,%r13d
movabs $0x431bde82d7b634db,%rbp
de 1b 43
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
call   1050 <sqrt@plt>
shl    $0x3,%rax
mov    %r14,%rcx
sub    %rax,%rcx
mov    (%rcx,%r13,8),%r12
mov    %r12,%rax
imul   %rbp
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x12,%rdx
add    %rax,%rdx
imul   $0xf4240,%rdx,%rax
sub    %rax,%r12
mov    %r13,%rdi
call   1040 <log@plt>
mov    (%r14,%rax,8),%r15
mov    %r15,%rax
imul   %rbp
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x12,%rdx
add    %rax,%rdx
imul   $0xf4240,%rdx,%rax
sub    %rax,%r15
add    %r12,%r15
mov    %r13,%rdi
call   1030 <sin@plt>
mov    %rax,%rbx
imul   %r13,%rbx
mov    %r13,%rdi
call   1030 <sin@plt>
imul   %rbx,%rax
mov    (%r14,%rax,8),%rcx
mov    %rcx,%rax
imul   %rbp
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x12,%rdx
add    %rax,%rdx
imul   $0xf4240,%rdx,%rax
sub    %rax,%rcx
add    %r15,%rcx
movslq %ecx,%rax
imul   $0x431bde83,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rcx
add    %edx,%ecx
imul   $0xf4240,%ecx,%ecx
sub    %ecx,%eax
cltq
mov    %rax,(%r14,%r13,8)
add    $0x1,%r13
cmp    $0xf4241,%r13
jne    1160 <computeSequenceTerm+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @computeSequenceTerm(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
store i64* %0, i64** %2
%4 = load i64*, i64** %2
%5 = getelementptr inbounds i64, i64* %4, i64 0
store i64 1, i64* %5
store i64 1, i64* %3
br label %6
6: ; preds = %41, %1
%7 = load i64, i64* %3
%8 = icmp sle i64 %7, 1000000
br i1 %8, label %9, label %44
9: ; preds = %6
%10 = load i64*, i64** %2
%11 = load i64, i64* %3
%12 = load i64, i64* %3
%13 = call i64 @sqrt(i64 %12)
%14 = sub nsw i64 %11, %13
%15 = getelementptr inbounds i64, i64* %10, i64 %14
%16 = load i64, i64* %15
%17 = srem i64 %16, 1000000
%18 = load i64*, i64** %2
%19 = load i64, i64* %3
%20 = call i64 @log(i64 %19)
%21 = getelementptr inbounds i64, i64* %18, i64 %20
%22 = load i64, i64* %21
%23 = srem i64 %22, 1000000
%24 = add nsw i64 %17, %23
%25 = load i64*, i64** %2
%26 = load i64, i64* %3
%27 = load i64, i64* %3
%28 = call i64 @sin(i64 %27)
%29 = mul nsw i64 %26, %28
%30 = load i64, i64* %3
%31 = call i64 @sin(i64 %30)
%32 = mul nsw i64 %29, %31
%33 = getelementptr inbounds i64, i64* %25, i64 %32
%34 = load i64, i64* %33
%35 = srem i64 %34, 1000000
%36 = add nsw i64 %24, %35
%37 = srem i64 %36, 1000000
%38 = load i64*, i64** %2
%39 = load i64, i64* %3
%40 = getelementptr inbounds i64, i64* %38, i64 %39
store i64 %37, i64* %40
br label %41
41: ; preds = %9
%42 = load i64, i64* %3
%43 = add nsw i64 %42, 1
store i64 %43, i64* %3
br label %6
44: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @computeSequenceTerm(i64* nocapture %0) {
store i64 1, i64* %0
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 1, %1 ], [ %26, %2 ]
%4 = tail call i64 @sqrt(i64 %3)
%5 = sub nsw i64 %3, %4
%6 = getelementptr inbounds i64, i64* %0, i64 %5
%7 = load i64, i64* %6
%8 = srem i64 %7, 1000000
%9 = tail call i64 @log(i64 %3)
%10 = getelementptr inbounds i64, i64* %0, i64 %9
%11 = load i64, i64* %10
%12 = srem i64 %11, 1000000
%13 = add nsw i64 %12, %8
%14 = tail call i64 @sin(i64 %3)
%15 = mul nsw i64 %14, %3
%16 = tail call i64 @sin(i64 %3)
%17 = mul nsw i64 %15, %16
%18 = getelementptr inbounds i64, i64* %0, i64 %17
%19 = load i64, i64* %18
%20 = srem i64 %19, 1000000
%21 = add nsw i64 %13, %20
%22 = trunc i64 %21 to i32
%23 = srem i32 %22, 1000000
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i64, i64* %0, i64 %3
store i64 %24, i64* %25
%26 = add nuw nsw i64 %3, 1
%27 = icmp eq i64 %26, 1000001
br i1 %27, label %28, label %2
28: ; preds = %2
ret void
}