#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*/ memcpy(char *, char *, int);
void buffer_store(int flag, char *global_buf_A,
                  char part_buf_A[64][(128 + 128) * ((256) / (64))],
                  char *global_buf_B,
                  char part_buf_B[64][(128 + 128) * ((256) / (64))]) {
#pragma HLS INLINE off
  if (flag) {
    for (int i = 0; i < 64; i++) {
      memcpy(global_buf_A + i * ((128 + 128) * ((256) / (64))), part_buf_A[i],
             (128 + 128) * ((256) / (64)));
      memcpy(global_buf_B + i * ((128 + 128) * ((256) / (64))), part_buf_B[i],
             (128 + 128) * ((256) / (64)));
    }
  }
  return;
}


x86 assembly (clang, -O0):
<buffer_store>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     11a9 <buffer_store+0x99>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x40,-0x2c(%rbp)
jge    11a4 <buffer_store+0x94>
mov    -0x10(%rbp),%rdi
mov    -0x2c(%rbp),%eax
shl    $0xa,%eax
cltq
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
movslq -0x2c(%rbp),%rax
shl    $0xa,%rax
add    %rax,%rsi
mov    $0x400,%edx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%eax
shl    $0xa,%eax
cltq
add    %rax,%rdi
mov    -0x28(%rbp),%rsi
movslq -0x2c(%rbp),%rax
shl    $0xa,%rax
add    %rax,%rsi
mov    $0x400,%edx
call   1030 <memcpy@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    113c <buffer_store+0x2c>
jmp    11a9 <buffer_store+0x99>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_store>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edi,%edi
je     1164 <buffer_store+0x54>
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%r13,1),%rdi
lea    (%r12,%rbx,1),%rsi
mov    $0x400,%edx
call   1030 <memcpy@plt>
lea    (%r15,%rbx,1),%rdi
lea    (%r14,%rbx,1),%rsi
mov    $0x400,%edx
call   1030 <memcpy@plt>
add    $0x400,%rbx
cmp    $0x10000,%rbx
jne    1130 <buffer_store+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @buffer_store(i32 %0, i8* %1, [1024 x i8]* %2, i8* %3, [1024 x i8]* %4) {
%6 = icmp eq i32 %0, 0
br i1 %6, label %18, label %7
7: ; preds = %5, %7
%8 = phi i64 [ %16, %7 ], [ 0, %5 ]
%9 = shl nuw nsw i64 %8, 10
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 %8, i64 0
%12 = tail call i32 @memcpy(i8* %10, i8* %11, i32 1024)
%13 = getelementptr inbounds i8, i8* %3, i64 %9
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 %8, i64 0
%15 = tail call i32 @memcpy(i8* %13, i8* %14, i32 1024)
%16 = add nuw nsw i64 %8, 1
%17 = icmp eq i64 %16, 64
br i1 %17, label %18, label %7
18: ; preds = %7, %5
ret void
}