#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*/ uint64_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ boulderhash_transform(int /*<<< orphan*/);
size_t lookback_index(int /*<<< orphan*/, int);
void pc_boulderhash_fill_state(uint64_t *cur_state) {
  cur_state[1] = boulderhash_transform(cur_state[0]);
  for (uint32_t j = 2; j < 26738688; j++) {
    cur_state[j] = boulderhash_transform(cur_state[j - 1]);
    cur_state[j] ^= cur_state[lookback_index(cur_state[j], j)];
  }
}


x86 assembly (clang, -O0):
<pc_boulderhash_fill_state>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <boulderhash_transform@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
movl   $0x2,-0xc(%rbp)
cmpl   $0x1980000,-0xc(%rbp)
jge    11b7 <pc_boulderhash_fill_state+0x97>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <boulderhash_transform@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0xc(%rbp),%esi
call   1040 <lookback_index@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
xor    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1147 <pc_boulderhash_fill_state+0x27>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pc_boulderhash_fill_state>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%edi
call   1030 <boulderhash_transform@plt>
mov    %eax,%edi
mov    %eax,0x4(%r14)
mov    $0x2,%ebx
nopl   0x0(%rax)
call   1030 <boulderhash_transform@plt>
mov    %eax,(%r14,%rbx,4)
mov    %eax,%edi
mov    %ebx,%esi
call   1040 <lookback_index@plt>
mov    (%r14,%rbx,4),%edi
xor    (%r14,%rax,4),%edi
mov    %edi,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    $0x1980000,%rbx
jne    1140 <pc_boulderhash_fill_state+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @pc_boulderhash_fill_state(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @boulderhash_transform(i32 %2)
%4 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %3, i32* %4
br label %6
5: ; preds = %6
ret void
6: ; preds = %1, %6
%7 = phi i32 [ %3, %1 ], [ %16, %6 ]
%8 = phi i64 [ 2, %1 ], [ %17, %6 ]
%9 = tail call i32 @boulderhash_transform(i32 %7)
%10 = getelementptr inbounds i32, i32* %0, i64 %8
store i32 %9, i32* %10
%11 = trunc i64 %8 to i32
%12 = tail call i64 @lookback_index(i32 %9, i32 %11)
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = load i32, i32* %10
%16 = xor i32 %15, %14
store i32 %16, i32* %10
%17 = add nuw nsw i64 %8, 1
%18 = icmp eq i64 %17, 26738688
br i1 %18, label %5, label %6
}