// File: /workspace/github_c_makefile_star2_O3/google[P]multichase/multiload.c
// Function: load_stream_triad
static void load_stream_triad(per_thread_t *t) {
#define LOOP_OPS 3
#define LOOP_ALIGN 16
  uint64_t load_loop, load_bites;
  register uint64_t N, i;
  register double *a;
  register double *b;
  register double *c;
  register double *tmp;

  load_loop =
      t->x.load_total_memory -
      (LOOP_OPS * LOOP_ALIGN);  // subract to allow aligning count/addresses
  load_loop = (load_loop / LOOP_OPS) &
              ~(LOOP_ALIGN - 1);  // divide by 3 buffers and align byte count on
                                  // LOOP_ALIGN byte multiple
  N = load_loop / sizeof(double);
  load_bites = N * sizeof(double) * LOOP_OPS;
  size_t aa = (((size_t)t->x.load_arena + LOOP_ALIGN) &
               ~(LOOP_ALIGN));  // align on 16 byte address
  a = (double *)aa;
  b = a + N;
  c = b + N;
  if (verbosity > 1) {
    printf(
        "load_arena=%p, load_total_memory=0x%lX, load_loop=0x%lX, N=0x%lX, "
        "a=%p, b=%p, c=%p\n",
        (char *)t->x.load_arena, t->x.load_total_memory, load_loop, N, a, b, c);
  }

  LOAD_MEMORY_INIT_MIBPS
  do {
    tmp = a;
    a = b;
    b = c;
    c = tmp;

    for (i = 0; i < N; ++i) {
      a[i] = b[i] + c[i];
    }
    LOAD_MEMORY_SAMPLE_MIBPS
  } while (1);
#undef LOOP_OPS
#undef LOOP_ALIGN
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq 0xb0(%rdi), %rcx
leaq -0x30(%rcx), %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
movq %rdx, %rax
movq %rdi, 0x20(%rsp)
movq 0xa8(%rdi), %rsi
shrq %rax
andq $-0x10, %rax
movq %rax, %r15
shrq $0x3, %r15
leaq 0x10(%rsi), %r13
andq $-0x11, %r13
leaq (%rax,%r13), %rbp
leaq (%rax,%rbp), %r12
cmpl $0x2, 0x105e7b(%rip)    # 0x50f340
movq %rax, 0x18(%rsp)
jl 0x4094f2
leaq 0xcc10d(%rip), %rdi     # 0x4d55e0
movq %rcx, %rdx
movq %rax, %rcx
movq %r15, %r8
movq %r13, %r9
xorl %eax, %eax
pushq %r12
pushq %rbp
callq 0x416150
movq 0x28(%rsp), %rax
addq $0x10, %rsp
leaq (%rax,%rax,2), %rax
movq %rax, 0x28(%rsp)
leaq 0x8(%rsp), %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x4677a0
imulq $0x3b9aca00, (%rbx), %rcx # imm = 0x3B9ACA00
addq 0x8(%rbx), %rcx
cmpq $0x1, %r15
adcq $0x0, %r15
movq $-0x1, %rax
movq 0xcaae1(%rip), %xmm1    # 0x4d4010
movq %rcx, %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd 0xcaae0(%rip), %xmm0    # 0x4d4020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x30(%rsp)
movq %r12, %rcx
xorl %ebx, %ebx
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rsi
movq %r13, %r12
movq %rbp, %r13
movq %rcx, %rbp
testq %rsi, %rsi
je 0x40958c
xorl %ecx, %ecx
movsd (%rbp,%rcx,8), %xmm0
addsd (%r12,%rcx,8), %xmm0
movsd %xmm0, (%r13,%rcx,8)
incq %rcx
cmpq %rcx, %r15
jne 0x409571
incq %rbx
movq 0xc8(%rdx), %r14
movq %r12, %rcx
cmpq %r14, %rax
je 0x409561
cmpq $0x0, 0x8(%rdx)
movq %r12, %rcx
jne 0x409561
movl $0x1, %edi
leaq 0x8(%rsp), %rsi
callq 0x4677a0
imulq $0x3b9aca00, 0x8(%rsp), %rax # imm = 0x3B9ACA00
addq 0x10(%rsp), %rax
movq %rax, %xmm0
movq 0xcaa3e(%rip), %xmm1    # 0x4d4010
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movdqa %xmm1, %xmm3
movapd 0xcaa3e(%rip), %xmm2    # 0x4d4020
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
subsd 0x30(%rsp), %xmm1
imulq 0x28(%rsp), %rbx
movq %rbx, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd 0xcaa51(%rip), %xmm2    # 0x4d4070
movsd 0xcaa79(%rip), %xmm0    # 0x4d40a0
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
divsd %xmm1, %xmm2
cvttsd2si %xmm2, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xcaa61(%rip), %xmm2    # 0x4d40a8
cvttsd2si %xmm2, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq 0x20(%rsp), %rax
lock
addq %rdx, 0x8(%rax)
movl $0x1, %edi
leaq 0x8(%rsp), %rsi
callq 0x4677a0
movq 0xca99d(%rip), %xmm1    # 0x4d4010
imulq $0x3b9aca00, 0x8(%rsp), %rcx # imm = 0x3B9ACA00
addq 0x10(%rsp), %rcx
movq %r14, %rax
jmp 0x40952f