#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_and_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_loadu_si128(int *);
int /*<<< orphan*/ _mm_or_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_set_epi32(int, int, int, int);
int /*<<< orphan*/ _mm_slli_epi32(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_srli_epi32(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_storeu_si128(int *, int /*<<< orphan*/);
int Base42_CopyFlipD(char *ibuf, char *obuf, int n) {
  int *cs, *ct, *cse;
  __m128i m0, m1, m2;
  __m128i x0, x1, x2, x3, x4;
  m0 = _mm_set_epi32(0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00);
  m1 = _mm_set_epi32(0x000000FF, 0x000000FF, 0x000000FF, 0x000000FF);
  m2 = _mm_set_epi32(0x00FF0000, 0x00FF0000, 0x00FF0000, 0x00FF0000);
  cs = (int *)ibuf;
  cse = cs + n;
  ct = (int *)obuf;
  while (cs < cse) {
    x0 = _mm_loadu_si128(cs);
    x1 = _mm_and_si128(x0, m0);
    x2 = _mm_and_si128(_mm_srli_epi32(x0, 16), m1);
    x3 = _mm_and_si128(_mm_slli_epi32(x0, 16), m2);
    x4 = _mm_or_si128(x1, _mm_or_si128(x2, x3));
    _mm_storeu_si128(ct, x4);
    cs += 4;
    ct += 4;
  }
}


x86 assembly (clang, -O0):
<Base42_CopyFlipD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    $0xff00ff00,%ecx
mov    %ecx,%edi
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <_mm_set_epi32@plt>
mov    %eax,-0x3c(%rbp)
mov    $0xff,%ecx
mov    %ecx,%edi
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <_mm_set_epi32@plt>
mov    %eax,-0x40(%rbp)
mov    $0xff0000,%ecx
mov    %ecx,%edi
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <_mm_set_epi32@plt>
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    1282 <Base42_CopyFlipD+0x112>
mov    -0x28(%rbp),%rdi
call   1080 <_mm_loadu_si128@plt>
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x3c(%rbp),%esi
call   1090 <_mm_and_si128@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%edi
mov    $0x10,%esi
call   1070 <_mm_srli_epi32@plt>
mov    %eax,%edi
mov    -0x40(%rbp),%esi
call   1090 <_mm_and_si128@plt>
mov    %eax,-0x50(%rbp)
mov    -0x48(%rbp),%edi
mov    $0x10,%esi
call   1050 <_mm_slli_epi32@plt>
mov    %eax,%edi
mov    -0x44(%rbp),%esi
call   1090 <_mm_and_si128@plt>
mov    %eax,-0x54(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x54(%rbp),%esi
call   1040 <_mm_or_si128@plt>
mov    -0x5c(%rbp),%edi
mov    %eax,%esi
call   1040 <_mm_or_si128@plt>
mov    %eax,-0x58(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x58(%rbp),%esi
call   1060 <_mm_storeu_si128@plt>
mov    -0x28(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x30(%rbp)
jmp    11df <Base42_CopyFlipD+0x6f>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Base42_CopyFlipD>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0xff00ff00,%edi
mov    $0xff00ff00,%esi
mov    $0xff00ff00,%edx
mov    $0xff00ff00,%ecx
call   1030 <_mm_set_epi32@plt>
mov    %eax,%ebp
mov    $0xff,%edi
mov    $0xff,%esi
mov    $0xff,%edx
mov    $0xff,%ecx
call   1030 <_mm_set_epi32@plt>
mov    %eax,%r13d
mov    $0xff0000,%edi
mov    $0xff0000,%esi
mov    $0xff0000,%edx
mov    $0xff0000,%ecx
call   1030 <_mm_set_epi32@plt>
mov    %eax,0x8(%rsp)
movslq %r15d,%rax
lea    (%rbx,%rax,4),%rax
cmp    %rbx,%rax
jbe    126b <Base42_CopyFlipD+0xfb>
mov    %rax,0x10(%rsp)
mov    %rbx,%rdi
call   1080 <_mm_loadu_si128@plt>
mov    %eax,%r15d
mov    %eax,%edi
mov    %ebp,%esi
call   1090 <_mm_and_si128@plt>
mov    %eax,0xc(%rsp)
mov    %r15d,%edi
mov    $0x10,%esi
call   1070 <_mm_srli_epi32@plt>
mov    %eax,%edi
mov    %r13d,%esi
call   1090 <_mm_and_si128@plt>
mov    %eax,%r12d
mov    %r15d,%edi
mov    $0x10,%esi
call   1050 <_mm_slli_epi32@plt>
mov    %eax,%edi
mov    0x8(%rsp),%esi
call   1090 <_mm_and_si128@plt>
mov    %r12d,%edi
mov    %eax,%esi
call   1040 <_mm_or_si128@plt>
mov    0xc(%rsp),%edi
mov    %eax,%esi
call   1040 <_mm_or_si128@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <_mm_storeu_si128@plt>
mov    0x10(%rsp),%rax
add    $0x10,%rbx
add    $0x10,%r14
cmp    %rax,%rbx
jb     11f0 <Base42_CopyFlipD+0x80>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @Base42_CopyFlipD(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%19 = call i32 @_mm_set_epi32(i32 -16711936, i32 -16711936, i32 -16711936, i32 -16711936)
store i32 %19, i32* %11
%20 = call i32 @_mm_set_epi32(i32 255, i32 255, i32 255, i32 255)
store i32 %20, i32* %12
%21 = call i32 @_mm_set_epi32(i32 16711680, i32 16711680, i32 16711680, i32 16711680)
store i32 %21, i32* %13
%22 = load i8*, i8** %5
%23 = bitcast i8* %22 to i32*
store i32* %23, i32** %8
%24 = load i32*, i32** %8
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
store i32* %27, i32** %10
%28 = load i8*, i8** %6
%29 = bitcast i8* %28 to i32*
store i32* %29, i32** %9
br label %30
30: ; preds = %34, %3
%31 = load i32*, i32** %8
%32 = load i32*, i32** %10
%33 = icmp ult i32* %31, %32
br i1 %33, label %34, label %60
34: ; preds = %30
%35 = load i32*, i32** %8
%36 = call i32 @_mm_loadu_si128(i32* %35)
store i32 %36, i32* %14
%37 = load i32, i32* %14
%38 = load i32, i32* %11
%39 = call i32 @_mm_and_si128(i32 %37, i32 %38)
store i32 %39, i32* %15
%40 = load i32, i32* %14
%41 = call i32 @_mm_srli_epi32(i32 %40, i32 16)
%42 = load i32, i32* %12
%43 = call i32 @_mm_and_si128(i32 %41, i32 %42)
store i32 %43, i32* %16
%44 = load i32, i32* %14
%45 = call i32 @_mm_slli_epi32(i32 %44, i32 16)
%46 = load i32, i32* %13
%47 = call i32 @_mm_and_si128(i32 %45, i32 %46)
store i32 %47, i32* %17
%48 = load i32, i32* %15
%49 = load i32, i32* %16
%50 = load i32, i32* %17
%51 = call i32 @_mm_or_si128(i32 %49, i32 %50)
%52 = call i32 @_mm_or_si128(i32 %48, i32 %51)
store i32 %52, i32* %18
%53 = load i32*, i32** %9
%54 = load i32, i32* %18
%55 = call i32 @_mm_storeu_si128(i32* %53, i32 %54)
%56 = load i32*, i32** %8
%57 = getelementptr inbounds i32, i32* %56, i64 4
store i32* %57, i32** %8
%58 = load i32*, i32** %9
%59 = getelementptr inbounds i32, i32* %58, i64 4
store i32* %59, i32** %9
br label %30
60: ; preds = %30
%61 = load i32, i32* %4
ret i32 %61
}

LLVM IR (-O2):
define i32 @Base42_CopyFlipD(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @_mm_set_epi32(i32 -16711936, i32 -16711936, i32 -16711936, i32 -16711936)
%5 = tail call i32 @_mm_set_epi32(i32 255, i32 255, i32 255, i32 255)
%6 = tail call i32 @_mm_set_epi32(i32 16711680, i32 16711680, i32 16711680, i32 16711680)
%7 = bitcast i8* %0 to i32*
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds i32, i32* %7, i64 %8
%10 = icmp ugt i32* %9, %7
br i1 %10, label %11, label %28
11: ; preds = %3
%12 = bitcast i8* %1 to i32*
br label %13
13: ; preds = %11, %13
%14 = phi i32* [ %25, %13 ], [ %7, %11 ]
%15 = phi i32* [ %26, %13 ], [ %12, %11 ]
%16 = tail call i32 @_mm_loadu_si128(i32* %14)
%17 = tail call i32 @_mm_and_si128(i32 %16, i32 %4)
%18 = tail call i32 @_mm_srli_epi32(i32 %16, i32 16)
%19 = tail call i32 @_mm_and_si128(i32 %18, i32 %5)
%20 = tail call i32 @_mm_slli_epi32(i32 %16, i32 16)
%21 = tail call i32 @_mm_and_si128(i32 %20, i32 %6)
%22 = tail call i32 @_mm_or_si128(i32 %19, i32 %21)
%23 = tail call i32 @_mm_or_si128(i32 %17, i32 %22)
%24 = tail call i32 @_mm_storeu_si128(i32* %15, i32 %23)
%25 = getelementptr inbounds i32, i32* %14, i64 4
%26 = getelementptr inbounds i32, i32* %15, i64 4
%27 = icmp ult i32* %25, %9
br i1 %27, label %13, label %28
28: ; preds = %13, %3
ret i32 undef
}