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

/* Variables and functions */
int /*<<< orphan*/ cput_nibble(char);
int /*<<< orphan*/ tty_putc(char);
void cput_nibble_block(char *block, int n) {
  int i = 0;
  while (n) {
    cput_nibble(*block);
    if (--n == 0)
      break;
    i++;
    if ((i & 7) == 0)
      tty_putc(' ');
  }
}


x86 assembly (clang, -O0):
<cput_nibble_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     118a <cput_nibble_block+0x6a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <cput_nibble@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jne    1163 <cput_nibble_block+0x43>
jmp    118a <cput_nibble_block+0x6a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
jne    1185 <cput_nibble_block+0x65>
mov    $0x20,%edi
call   1040 <tty_putc@plt>
jmp    1136 <cput_nibble_block+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cput_nibble_block>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
je     1172 <cput_nibble_block+0x52>
mov    %esi,%ebx
mov    %rdi,%r14
movsbl (%rdi),%edi
call   1030 <cput_nibble@plt>
cmp    $0x1,%ebx
je     1172 <cput_nibble_block+0x52>
mov    $0x1,%ebp
jmp    1160 <cput_nibble_block+0x40>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r14),%edi
call   1030 <cput_nibble@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
je     1172 <cput_nibble_block+0x52>
test   $0x7,%bpl
jne    1150 <cput_nibble_block+0x30>
mov    $0x20,%edi
call   1040 <tty_putc@plt>
jmp    1150 <cput_nibble_block+0x30>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @cput_nibble_block(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %25, %2
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %26
9: ; preds = %6
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = call i32 @cput_nibble(i8 signext %11)
%13 = load i32, i32* %4
%14 = add nsw i32 %13, -1
store i32 %14, i32* %4
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %9
br label %26
17: ; preds = %9
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = and i32 %20, 7
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = call i32 @tty_putc(i8 signext 32)
br label %25
25: ; preds = %23, %17
br label %6
26: ; preds = %16, %6
ret void
}

LLVM IR (-O2):
define void @cput_nibble_block(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %22, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = tail call i32 @cput_nibble(i8 signext %5)
%7 = add nsw i32 %1, -1
%8 = icmp eq i32 %7, 0
br i1 %8, label %22, label %9
9: ; preds = %4, %17
%10 = phi i32 [ %20, %17 ], [ %7, %4 ]
%11 = phi i32 [ %12, %17 ], [ 0, %4 ]
%12 = add nuw nsw i32 %11, 1
%13 = and i32 %12, 7
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = tail call i32 @tty_putc(i8 signext 32)
br label %17
17: ; preds = %15, %9
%18 = load i8, i8* %0
%19 = tail call i32 @cput_nibble(i8 signext %18)
%20 = add nsw i32 %10, -1
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %9
22: ; preds = %17, %4, %2
ret void
}