#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*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_load_si128(int /*<<< orphan*/ const *);
int /*<<< orphan*/ _mm_store_si128(int /*<<< orphan*/ *, int /*<<< orphan*/);
void chgemm_build_loc_sse4_u8s8(void *src, void *dst, int lds, int block_row,
                                int block_col) {
  int i, j;
  __m128i xmm1;
  for (i = 0; i < block_row; i++) {
    for (j = 0; j < block_col; j += 16) {
      xmm1 = _mm_load_si128((const __m128i *)(src + j));
      _mm_store_si128((__m128i *)(dst + j), xmm1);
    }
    src += lds;
    dst += 64;
  }
}


x86 assembly (clang, -O0):
<chgemm_build_loc_sse4_u8s8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11bf <chgemm_build_loc_sse4_u8s8+0x9f>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1194 <chgemm_build_loc_sse4_u8s8+0x74>
mov    -0x8(%rbp),%rdi
movslq -0x24(%rbp),%rax
add    %rax,%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x24(%rbp),%rax
add    %rax,%rdi
mov    -0x28(%rbp),%esi
call   1040 <_mm_store_si128@plt>
mov    -0x24(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x24(%rbp)
jmp    1154 <chgemm_build_loc_sse4_u8s8+0x34>
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x40,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1141 <chgemm_build_loc_sse4_u8s8+0x21>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chgemm_build_loc_sse4_u8s8>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,0x4(%rsp)
test   %ecx,%ecx
jle    118f <chgemm_build_loc_sse4_u8s8+0x6f>
mov    %r8d,%r15d
mov    %rsi,%rbp
mov    %rdi,%rbx
movslq %edx,%r12
xor    %r13d,%r13d
jmp    1162 <chgemm_build_loc_sse4_u8s8+0x42>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    %r12,%rbx
add    $0x40,%rbp
add    $0x1,%r13d
cmp    0x4(%rsp),%r13d
je     118f <chgemm_build_loc_sse4_u8s8+0x6f>
test   %r15d,%r15d
jle    1150 <chgemm_build_loc_sse4_u8s8+0x30>
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
lea    (%rbx,%r14,1),%rdi
call   1030 <_mm_load_si128@plt>
lea    (%r14,%rbp,1),%rdi
mov    %eax,%esi
call   1040 <_mm_store_si128@plt>
add    $0x10,%r14
cmp    %r15d,%r14d
jl     1170 <chgemm_build_loc_sse4_u8s8+0x50>
jmp    1150 <chgemm_build_loc_sse4_u8s8+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @chgemm_build_loc_sse4_u8s8(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %30
7: ; preds = %5
%8 = icmp sgt i32 %4, 0
%9 = sext i32 %2 to i64
br label %10
10: ; preds = %7, %25
%11 = phi i8* [ %0, %7 ], [ %26, %25 ]
%12 = phi i32 [ 0, %7 ], [ %28, %25 ]
%13 = phi i8* [ %1, %7 ], [ %27, %25 ]
br i1 %8, label %14, label %25
14: ; preds = %10, %14
%15 = phi i64 [ %22, %14 ], [ 0, %10 ]
%16 = getelementptr i8, i8* %11, i64 %15
%17 = bitcast i8* %16 to i32*
%18 = tail call i32 @_mm_load_si128(i32* %17)
%19 = getelementptr i8, i8* %13, i64 %15
%20 = bitcast i8* %19 to i32*
%21 = tail call i32 @_mm_store_si128(i32* %20, i32 %18)
%22 = add nuw i64 %15, 16
%23 = trunc i64 %22 to i32
%24 = icmp slt i32 %23, %4
br i1 %24, label %14, label %25
25: ; preds = %14, %10
%26 = getelementptr i8, i8* %11, i64 %9
%27 = getelementptr i8, i8* %13, i64 64
%28 = add nuw nsw i32 %12, 1
%29 = icmp eq i32 %28, %3
br i1 %29, label %30, label %10
30: ; preds = %25, %5
ret void
}