// File: /workspace/github_c_makefile_star2_O0/google[P]multichase/multiload.c
// Function: load_stream_triad_nontemporal_injection_delay
static void load_stream_triad_nontemporal_injection_delay(per_thread_t *t) {
#define LOOP_OPS 3
#define LOOP_ALIGN 16
  uint64_t load_loop, load_bites;
  register uint64_t N, i;
  register uint64_t *a;
  register uint64_t *b;
  register uint64_t *c;
  register uint64_t *tmp;
  const uint64_t num_elem_twocachelines = DEF_CACHELINE / sizeof(uint64_t) * 2;

  load_loop =
      t->x.load_total_memory -
      (LOOP_OPS * LOOP_ALIGN);  // subtract 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(uint64_t);
  load_bites = N * sizeof(uint64_t) * LOOP_OPS;
  size_t aa = (((size_t)t->x.load_arena + LOOP_ALIGN) &
               ~(LOOP_ALIGN));  // align on 16 byte address
  a = (uint64_t *)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 += 2) {
      if (i % num_elem_twocachelines == 0) delay_until_iteration(t->x.delay);
#if defined(__aarch64__)
      asm volatile ("stnp %0, %1, [%2]" :: "r"(b[i]+c[i]), "r"(b[i+1]+c[i+1]), "r" (a+i));
#elif defined(__x86_64__)
      _mm_stream_si64(&((long long*)a)[i], b[i]+c[i]);
      _mm_stream_si64(&((long long*)a)[i+1], b[i+1]+c[i+1]);
#else
      a[i] = b[i] + c[i];
      a[i+1] = b[i+1] + c[i+1];
#endif
    }
    LOAD_MEMORY_SAMPLE_MIBPS
  } while (1);
#undef LOOP_OPS
#undef LOOP_ALIGN
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x28(%rbp)
movq $0x10, -0x70(%rbp)
movq -0x28(%rbp), %rax
movq 0xb0(%rax), %rax
subq $0x30, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl $0x3, %ecx
xorl %edx, %edx
divq %rcx
andq $-0x10, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
shrq $0x3, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
shlq $0x3, %rax
imulq $0x3, %rax, %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0xa8(%rax), %rax
addq $0x10, %rax
andq $-0x11, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x40(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
cmpl $0x1, 0x106a58(%rip)    # 0x517360
jle 0x41094b
movq -0x28(%rbp), %rax
movq 0xa8(%rax), %rsi
movq -0x28(%rbp), %rax
movq 0xb0(%rax), %rdx
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %r8
movq -0x50(%rbp), %r9
movq -0x58(%rbp), %r10
movq -0x60(%rbp), %rax
leaq 0xcce1d(%rip), %rdi     # 0x4dd758
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x41e150
movq $0x0, -0x80(%rbp)
movq $-0x1, -0x88(%rbp)
movq $0x0, -0x90(%rbp)
movq $0x0, -0xb0(%rbp)
movq $0x0, -0xb8(%rbp)
callq 0x404250
movq %rax, %xmm0
movaps 0xcb6c0(%rip), %xmm1    # 0x4dc050
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xcb6c4(%rip), %xmm1    # 0x4dc060
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x410a94
movq -0x48(%rbp), %rax
andq $0xf, %rax
cmpq $0x0, %rax
jne 0x410a07
movq -0x28(%rbp), %rax
movq 0xd0(%rax), %rdi
callq 0x410c40
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
movq -0x58(%rbp), %rax
movq -0x48(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq -0x60(%rbp), %rdx
movq -0x48(%rbp), %rsi
addq (%rdx,%rsi,8), %rax
movq %rcx, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
movntiq %rcx, (%rax)
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
addq $0x1, %rax
shlq $0x3, %rax
addq %rax, %rcx
movq -0x58(%rbp), %rax
movq -0x48(%rbp), %rdx
movq 0x8(%rax,%rdx,8), %rax
movq -0x60(%rbp), %rdx
movq -0x48(%rbp), %rsi
addq 0x8(%rdx,%rsi,8), %rax
movq %rcx, -0x18(%rbp)
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movntiq %rcx, (%rax)
movq -0x48(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x48(%rbp)
jmp 0x4109db
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
movq -0x28(%rbp), %rax
movq 0xc8(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x90(%rbp), %rax
je 0x410c1a
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, %rax
jne 0x410c1a
callq 0x404250
movq %rax, %xmm0
movaps 0xcb567(%rip), %xmm2    # 0x4dc050
movaps %xmm2, -0xe0(%rbp)
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0xcb564(%rip), %xmm1    # 0x4dc060
movaps %xmm1, -0xd0(%rbp)
subpd %xmm1, %xmm0
movaps %xmm0, %xmm3
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm3, %xmm0
movsd %xmm0, -0xa0(%rbp)
movq -0x80(%rbp), %rax
movq -0x38(%rbp), %rcx
imulq %rcx, %rax
movq %rax, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0xa0(%rbp), %xmm0
movsd -0x98(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd 0xcb4b6(%rip), %xmm1    # 0x4dc028
mulsd %xmm1, %xmm0
movsd -0xa8(%rbp), %xmm1
movsd 0xcb4ba(%rip), %xmm2    # 0x4dc040
mulsd %xmm2, %xmm1
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0xb8(%rbp)
movq -0x28(%rbp), %rax
movsd -0xb8(%rbp), %xmm0
movsd 0xcb49a(%rip), %xmm2    # 0x4dc048
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rdx
cvttsd2si %xmm0, %rcx
movq %rcx, %rsi
sarq $0x3f, %rsi
andq %rsi, %rdx
orq %rdx, %rcx
lock
addq %rcx, 0x8(%rax)
movq -0x90(%rbp), %rax
movq %rax, -0x88(%rbp)
movq $0x0, -0x80(%rbp)
callq 0x404250
movaps -0xe0(%rbp), %xmm2
movaps -0xd0(%rbp), %xmm1
movq %rax, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
jmp 0x410c1c
movb $0x1, %al
testb $0x1, %al
jne 0x4109b3
jmp 0x410c28
addq $0xf0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)