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


x86 assembly (clang, -O0):
<buffer_load>:
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_load+0x99>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x40,-0x2c(%rbp)
jge    11a4 <buffer_load+0x94>
mov    -0x18(%rbp),%rdi
movslq -0x2c(%rbp),%rax
shl    $0x9,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x2c(%rbp),%eax
shl    $0x9,%eax
cltq
add    %rax,%rsi
mov    $0x200,%edx
call   1030 <memcpy@plt>
mov    -0x28(%rbp),%rdi
movslq -0x2c(%rbp),%rax
shl    $0x9,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rsi
mov    -0x2c(%rbp),%eax
shl    $0x9,%eax
cltq
add    %rax,%rsi
mov    $0x200,%edx
call   1030 <memcpy@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    113c <buffer_load+0x2c>
jmp    11a9 <buffer_load+0x99>
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @buffer_load(i32 %0, i8* %1, [512 x i8]* %2, i8* %3, [512 x i8]* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca [512 x i8]*
%9 = alloca i8*
%10 = alloca [512 x i8]*
%11 = alloca i32
store i32 %0, i32* %6
store i8* %1, i8** %7
store [512 x i8]* %2, [512 x i8]** %8
store i8* %3, i8** %9
store [512 x i8]* %4, [512 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 [512 x i8]*, [512 x i8]** %8
%20 = load i32, i32* %11
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [512 x i8], [512 x i8]* %19, i64 %21
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%24 = load i8*, i8** %7
%25 = load i32, i32* %11
%26 = mul nsw i32 %25, 512
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %24, i64 %27
%29 = call i32 @memcpy(i8* %23, i8* %28, i32 512)
%30 = load [512 x i8]*, [512 x i8]** %10
%31 = load i32, i32* %11
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [512 x i8], [512 x i8]* %30, i64 %32
%34 = getelementptr inbounds [512 x i8], [512 x i8]* %33, i64 0, i64 0
%35 = load i8*, i8** %9
%36 = load i32, i32* %11
%37 = mul nsw i32 %36, 512
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %35, i64 %38
%40 = call i32 @memcpy(i8* %34, i8* %39, i32 512)
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_load(i32 %0, i8* %1, [512 x i8]* %2, i8* %3, [512 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 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 %8, i64 0
%10 = shl nuw nsw i64 %8, 9
%11 = getelementptr inbounds i8, i8* %1, i64 %10
%12 = tail call i32 @memcpy(i8* %9, i8* %11, i32 512)
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 %8, i64 0
%14 = getelementptr inbounds i8, i8* %3, i64 %10
%15 = tail call i32 @memcpy(i8* %13, i8* %14, i32 512)
%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
}