#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_out_mmx_noeol(void *buf, unsigned int size, unsigned int index) {
  unsigned int i;
  for (i = 0; i < size; i++) {
    printf("%.2x",
           ((unsigned char *)
                buf)[((index & (4 - 1)) * 4 + ((i) & (0xffffffff - 3)) * 4 +
                      ((i)&3) + (unsigned int)index / 4 * 16 * 4)]);
    if ((i % 4) == 3)
      printf(" ");
  }
}


x86 assembly (clang, -O0):
<dump_out_mmx_noeol>:
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    11a7 <dump_out_mmx_noeol+0x97>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
and    $0x3,%ecx
shl    $0x2,%ecx
mov    -0x14(%rbp),%edx
and    $0xfffffffc,%edx
shl    $0x2,%edx
add    %edx,%ecx
mov    -0x14(%rbp),%edx
and    $0x3,%edx
add    %edx,%ecx
mov    -0x10(%rbp),%edx
shr    $0x2,%edx
shl    $0x4,%edx
shl    $0x2,%edx
add    %edx,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
and    $0x3,%eax
cmp    $0x3,%eax
jne    1194 <dump_out_mmx_noeol+0x84>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1199 <dump_out_mmx_noeol+0x89>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <dump_out_mmx_noeol+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_out_mmx_noeol>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,(%rsp)
test   %esi,%esi
je     11aa <dump_out_mmx_noeol+0x8a>
mov    %edx,%ebx
mov    %esi,%r12d
lea    0x0(,%rbx,4),%r13d
and    $0xc,%r13d
shl    $0x4,%ebx
and    $0xffffffc0,%ebx
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    116c <dump_out_mmx_noeol+0x4c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14d
add    $0x4,%ebp
cmp    %r14d,%r12d
je     11aa <dump_out_mmx_noeol+0x8a>
mov    %ebp,%eax
and    $0xfffffff0,%eax
or     %r13d,%eax
mov    %r14d,%r15d
and    $0x3,%r15d
mov    %r15d,%ecx
or     %ebx,%ecx
add    %eax,%ecx
mov    (%rsp),%rax
movzbl (%rax,%rcx,1),%esi
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x3,%r15d
jne    1160 <dump_out_mmx_noeol+0x40>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1160 <dump_out_mmx_noeol+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%.2x\00"
define void @dump_out_mmx_noeol(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %29, label %5
5: ; preds = %3
%6 = shl i32 %2, 2
%7 = and i32 %6, 12
%8 = shl i32 %2, 4
%9 = and i32 %8, -64
br label %10
10: ; preds = %5, %26
%11 = phi i32 [ 0, %5 ], [ %27, %26 ]
%12 = shl i32 %11, 2
%13 = and i32 %12, -16
%14 = or i32 %7, %13
%15 = and i32 %11, 3
%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 = icmp eq i32 %15, 3
br i1 %23, label %24, label %26
24: ; preds = %10
%25 = tail call i32 @putchar(i32 32)
br label %26
26: ; preds = %10, %24
%27 = add nuw i32 %11, 1
%28 = icmp eq i32 %27, %1
br i1 %28, label %29, label %10
29: ; preds = %26, %3
ret void
}