#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 i;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void dump_stuff_mmx64(void *buf, unsigned int size, unsigned int index) {
  unsigned int i;
  for (i = 0; i < size; i++) {
    printf("%.2x",
           ((unsigned char *)
                buf)[((index & (2 - 1)) * 8 + ((i) & (0xffffffff - 7)) * 2 +
                      ((i)&7) + (unsigned int)index / 2 * 16 * 8 * 2)]);
    if ((i % 4) == 3)
      printf(" ");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dump_stuff_mmx64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11aa <dump_stuff_mmx64+0x9a>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
and    $0x1,%ecx
shl    $0x3,%ecx
mov    -0x14(%rbp),%edx
and    $0xfffffff8,%edx
shl    $0x1,%edx
add    %edx,%ecx
mov    -0x14(%rbp),%edx
and    $0x7,%edx
add    %edx,%ecx
mov    -0x10(%rbp),%edx
shr    $0x1,%edx
shl    $0x4,%edx
shl    $0x3,%edx
shl    $0x1,%edx
add    %edx,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
and    $0x3,%eax
cmp    $0x3,%eax
jne    1197 <dump_stuff_mmx64+0x87>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119c <dump_stuff_mmx64+0x8c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <dump_stuff_mmx64+0x19>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_stuff_mmx64>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
je     1196 <dump_stuff_mmx64+0x76>
mov    %edx,%ebx
mov    %esi,%r12d
mov    %rdi,%r14
lea    0x0(,%rbx,8),%r13d
and    $0x8,%r13d
and    $0xfffffffe,%ebx
shl    $0x7,%ebx
xor    %ebp,%ebp
xor    %r15d,%r15d
jmp    115c <dump_stuff_mmx64+0x3c>
add    $0x1,%r15d
add    $0x2,%ebp
cmp    %r15d,%r12d
je     1196 <dump_stuff_mmx64+0x76>
mov    %ebp,%eax
and    $0xfffffff0,%eax
or     %r13d,%eax
mov    %r15d,%ecx
and    $0x7,%ecx
or     %ebx,%ecx
add    %eax,%ecx
movzbl (%r14,%rcx,1),%esi
lea    0xe86(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15d,%eax
not    %eax
test   $0x3,%al
jne    1150 <dump_stuff_mmx64+0x30>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1150 <dump_stuff_mmx64+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%.2x\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @dump_stuff_mmx64(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %41, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %5
%11 = icmp ult i32 %9, %10
br i1 %11, label %12, label %44
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = load i32, i32* %6
%15 = and i32 %14, 1
%16 = mul i32 %15, 8
%17 = load i32, i32* %7
%18 = and i32 %17, -8
%19 = mul i32 %18, 2
%20 = add i32 %16, %19
%21 = load i32, i32* %7
%22 = and i32 %21, 7
%23 = add i32 %20, %22
%24 = load i32, i32* %6
%25 = udiv i32 %24, 2
%26 = mul i32 %25, 16
%27 = mul i32 %26, 8
%28 = mul i32 %27, 2
%29 = add i32 %23, %28
%30 = zext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %13, i64 %30
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %7
%36 = urem i32 %35, 4
%37 = icmp eq i32 %36, 3
br i1 %37, label %38, label %40
38: ; preds = %12
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %38, %12
br label %41
41: ; preds = %40
%42 = load i32, i32* %7
%43 = add i32 %42, 1
store i32 %43, i32* %7
br label %8
44: ; preds = %8
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.2x\00"
define void @dump_stuff_mmx64(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %30, label %5
5: ; preds = %3
%6 = shl i32 %2, 3
%7 = and i32 %6, 8
%8 = shl i32 %2, 7
%9 = and i32 %8, -256
br label %10
10: ; preds = %5, %27
%11 = phi i32 [ 0, %5 ], [ %28, %27 ]
%12 = shl i32 %11, 1
%13 = and i32 %12, -16
%14 = or i32 %7, %13
%15 = and i32 %11, 7
%16 = or i32 %15, %9
%17 = add i32 %16, %14
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %0, i64 %18
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = and i32 %11, 3
%24 = icmp eq i32 %23, 3
br i1 %24, label %25, label %27
25: ; preds = %10
%26 = tail call i32 @putchar(i32 32)
br label %27
27: ; preds = %10, %25
%28 = add nuw i32 %11, 1
%29 = icmp eq i32 %28, %1
br i1 %29, label %30, label %10
30: ; preds = %27, %3
%31 = tail call i32 @putchar(i32 10)
ret void
}