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

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *****, int /*<<< orphan*/ ******,
                          int);
int /*<<< orphan*/ memmove(int /*<<< orphan*/ *****, int /*<<< orphan*/ *****,
                           int);
void swap_mem_uint8_t(uint8_t *a, uint8_t *b, int size_line_sub) {
  uint8_t temp[size_line_sub];
  memcpy(&temp, a, size_line_sub);
  memmove(a, b, size_line_sub);
  memcpy(b, &temp, size_line_sub);
  return;
}


x86 assembly (clang, -O0):
<swap_mem_uint8_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memmove@plt>
mov    -0x30(%rbp),%rsi
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_mem_uint8_t>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r12d
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%eax
mov    %rsp,%rbx
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <memcpy@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12d,%edx
call   1040 <memmove@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1030 <memcpy@plt>
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @swap_mem_uint8_t(i32***** %0, i32***** %1, i32 %2) {
%4 = alloca i32*****
%5 = alloca i32*****
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i32***** %0, i32****** %4
store i32***** %1, i32****** %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %7
%12 = alloca i32****, i64 %10
store i64 %10, i64* %8
%13 = load i32*****, i32****** %4
%14 = bitcast i32***** %13 to i32******
%15 = load i32, i32* %6
%16 = call i32 @memcpy(i32***** %12, i32****** %14, i32 %15)
%17 = load i32*****, i32****** %4
%18 = load i32*****, i32****** %5
%19 = load i32, i32* %6
%20 = call i32 @memmove(i32***** %17, i32***** %18, i32 %19)
%21 = load i32*****, i32****** %5
%22 = bitcast i32***** %12 to i32******
%23 = load i32, i32* %6
%24 = call i32 @memcpy(i32***** %21, i32****** %22, i32 %23)
%25 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
define void @swap_mem_uint8_t(i32***** %0, i32***** %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = alloca i32****, i64 %4
%6 = bitcast i32***** %0 to i32******
%7 = call i32 @memcpy(i32***** %5, i32****** %6, i32 %2)
%8 = call i32 @memmove(i32***** %0, i32***** %1, i32 %2)
%9 = bitcast i32***** %5 to i32******
%10 = call i32 @memcpy(i32***** %1, i32****** %9, i32 %2)
ret void
}