#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 uint8_t;
typedef int uint16_t;
typedef int int16_t;

/* Variables and functions */
int /*<<< orphan*/ cli_putc(char);
int /*<<< orphan*/ cli_putstr(char const *);
int /*<<< orphan*/ nessie_print_block(int *, int);
int strlen(char const *);
void nessie_print_item(const char *name, uint8_t *buffer, uint16_t size_B) {
  uint8_t name_len;
  uint8_t i;
  name_len = strlen(name);
  if (name_len > 31 - 1) {
    cli_putstr("\r\n!!! formatting error !!!\r\n");
    return;
  }
  cli_putstr("\r\n");
  for (i = 0; i < 31 - name_len - 1; ++i) {
    cli_putc(' ');
  }
  cli_putstr(name);
  cli_putc('=');
  if (size_B <= 16) {
    nessie_print_block(buffer, size_B * 8);
  } else {
    nessie_print_block(buffer, 16 * 8);
    int16_t toprint = size_B - 16;
    buffer += 16;
    while (toprint > 0) {
      cli_putstr("\r\n");
      for (i = 0; i < 31; ++i) {
        cli_putc(' ');
      }
      nessie_print_block(buffer, ((toprint > 16) ? 16 : toprint) * 8);
      buffer += 16;
      toprint -= 16;
    }
  }
}


x86 assembly (clang, -O0):
<nessie_print_item>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1e,-0x18(%rbp)
jle    117a <nessie_print_item+0x3a>
lea    0xe90(%rip),%rdi
call   1040 <cli_putstr@plt>
jmp    12a1 <nessie_print_item+0x161>
lea    0xe99(%rip),%rdi
call   1040 <cli_putstr@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x1f,%ecx
sub    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11bb <nessie_print_item+0x7b>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118d <nessie_print_item+0x4d>
mov    -0x8(%rbp),%rdi
call   1040 <cli_putstr@plt>
mov    $0x3d,%edi
call   1030 <cli_putc@plt>
cmpl   $0x10,-0x14(%rbp)
jg     11ec <nessie_print_item+0xac>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
shl    $0x3,%esi
call   1060 <nessie_print_block@plt>
jmp    12a1 <nessie_print_item+0x161>
mov    -0x10(%rbp),%rdi
mov    $0x80,%esi
call   1060 <nessie_print_block@plt>
mov    -0x14(%rbp),%eax
sub    $0x10,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0x40,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x20(%rbp)
jle    129c <nessie_print_item+0x15c>
lea    0xdfa(%rip),%rdi
call   1040 <cli_putstr@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1f,-0x1c(%rbp)
jge    124e <nessie_print_item+0x10e>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    122c <nessie_print_item+0xec>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x10,-0x20(%rbp)
jle    126d <nessie_print_item+0x12d>
mov    $0x10,%eax
mov    %eax,-0x2c(%rbp)
jmp    1273 <nessie_print_item+0x133>
mov    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
shl    $0x3,%esi
call   1060 <nessie_print_block@plt>
mov    -0x10(%rbp),%rax
add    $0x40,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%eax
sub    $0x10,%eax
mov    %eax,-0x20(%rbp)
jmp    120f <nessie_print_item+0xcf>
jmp    12a1 <nessie_print_item+0x161>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nessie_print_item>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
call   1050 <strlen@plt>
cmp    $0x1f,%eax
jl     116e <nessie_print_item+0x2e>
lea    0xe9f(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <cli_putstr@plt>
mov    %eax,%ebp
lea    0xea3(%rip),%rdi
call   1040 <cli_putstr@plt>
mov    $0x1e,%eax
sub    %ebp,%eax
test   %eax,%eax
jle    119e <nessie_print_item+0x5e>
add    $0xffffffe2,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <cli_putc@plt>
inc    %ebp
jne    1190 <nessie_print_item+0x50>
mov    %r15,%rdi
call   1040 <cli_putstr@plt>
mov    $0x3d,%edi
call   1030 <cli_putc@plt>
cmp    $0x10,%ebx
jg     11ca <nessie_print_item+0x8a>
shl    $0x3,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <nessie_print_block@plt>
mov    %r14,%rdi
mov    $0x80,%esi
call   1060 <nessie_print_block@plt>
add    $0x40,%r14
add    $0x10,%ebx
lea    0xe35(%rip),%r15
mov    $0x10,%r12d
nopl   0x0(%rax,%rax,1)
lea    -0x20(%rbx),%ebp
mov    %r15,%rdi
call   1040 <cli_putstr@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
cmp    $0x10,%ebp
cmovae %r12d,%ebp
shl    $0x3,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1060 <nessie_print_block@plt>
add    $0x40,%r14
add    $0xfffffff0,%ebx
cmp    $0x20,%ebx
ja     11f0 <nessie_print_item+0xb0>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"\0D\0A!!! formatting error !!!\0D\0A\00"
@.str.1 = [3 x i8] c"\0D\0A\00"
define void @nessie_print_item(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp sgt i32 %12, 30
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = call i32 @cli_putstr(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %76
16: ; preds = %3
%17 = call i32 @cli_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %8
br label %18
18: ; preds = %26, %16
%19 = load i32, i32* %8
%20 = load i32, i32* %7
%21 = sub nsw i32 31, %20
%22 = sub nsw i32 %21, 1
%23 = icmp slt i32 %19, %22
br i1 %23, label %24, label %29
24: ; preds = %18
%25 = call i32 @cli_putc(i8 signext 32)
br label %26
26: ; preds = %24
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %18
29: ; preds = %18
%30 = load i8*, i8** %4
%31 = call i32 @cli_putstr(i8* %30)
%32 = call i32 @cli_putc(i8 signext 61)
%33 = load i32, i32* %6
%34 = icmp sle i32 %33, 16
br i1 %34, label %35, label %40
35: ; preds = %29
%36 = load i32*, i32** %5
%37 = load i32, i32* %6
%38 = mul nsw i32 %37, 8
%39 = call i32 @nessie_print_block(i32* %36, i32 %38)
br label %76
40: ; preds = %29
%41 = load i32*, i32** %5
%42 = call i32 @nessie_print_block(i32* %41, i32 128)
%43 = load i32, i32* %6
%44 = sub nsw i32 %43, 16
store i32 %44, i32* %9
%45 = load i32*, i32** %5
%46 = getelementptr inbounds i32, i32* %45, i64 16
store i32* %46, i32** %5
br label %47
47: ; preds = %67, %40
%48 = load i32, i32* %9
%49 = icmp sgt i32 %48, 0
br i1 %49, label %50, label %75
50: ; preds = %47
%51 = call i32 @cli_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %8
br label %52
52: ; preds = %57, %50
%53 = load i32, i32* %8
%54 = icmp slt i32 %53, 31
br i1 %54, label %55, label %60
55: ; preds = %52
%56 = call i32 @cli_putc(i8 signext 32)
br label %57
57: ; preds = %55
%58 = load i32, i32* %8
%59 = add nsw i32 %58, 1
store i32 %59, i32* %8
br label %52
60: ; preds = %52
%61 = load i32*, i32** %5
%62 = load i32, i32* %9
%63 = icmp sgt i32 %62, 16
br i1 %63, label %64, label %65
64: ; preds = %60
br label %67
65: ; preds = %60
%66 = load i32, i32* %9
br label %67
67: ; preds = %65, %64
%68 = phi i32 [ 16, %64 ], [ %66, %65 ]
%69 = mul nsw i32 %68, 8
%70 = call i32 @nessie_print_block(i32* %61, i32 %69)
%71 = load i32*, i32** %5
%72 = getelementptr inbounds i32, i32* %71, i64 16
store i32* %72, i32** %5
%73 = load i32, i32* %9
%74 = sub nsw i32 %73, 16
store i32 %74, i32* %9
br label %47
75: ; preds = %47
br label %76
76: ; preds = %14, %75, %35
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"\0D\0A!!! formatting error !!!\0D\0A\00"
@.str.1 = [3 x i8] c"\0D\0A\00"
define void @nessie_print_item(i8* %0, i32* %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp sgt i32 %4, 30
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @cli_putstr(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %68
8: ; preds = %3
%9 = tail call i32 @cli_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = sub i32 30, %4
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %8, %12
%13 = phi i32 [ %15, %12 ], [ 0, %8 ]
%14 = tail call i32 @cli_putc(i8 signext 32)
%15 = add nuw nsw i32 %13, 1
%16 = icmp eq i32 %15, %10
br i1 %16, label %17, label %12
17: ; preds = %12, %8
%18 = tail call i32 @cli_putstr(i8* %0)
%19 = tail call i32 @cli_putc(i8 signext 61)
%20 = icmp slt i32 %2, 17
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = shl nsw i32 %2, 3
%23 = tail call i32 @nessie_print_block(i32* %1, i32 %22)
br label %68
24: ; preds = %17
%25 = tail call i32 @nessie_print_block(i32* %1, i32 128)
br label %26
26: ; preds = %24, %26
%27 = phi i32* [ %1, %24 ], [ %62, %26 ]
%28 = phi i32 [ %2, %24 ], [ %29, %26 ]
%29 = add nsw i32 %28, -16
%30 = tail call i32 @cli_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%31 = tail call i32 @cli_putc(i8 signext 32)
%32 = tail call i32 @cli_putc(i8 signext 32)
%33 = tail call i32 @cli_putc(i8 signext 32)
%34 = tail call i32 @cli_putc(i8 signext 32)
%35 = tail call i32 @cli_putc(i8 signext 32)
%36 = tail call i32 @cli_putc(i8 signext 32)
%37 = tail call i32 @cli_putc(i8 signext 32)
%38 = tail call i32 @cli_putc(i8 signext 32)
%39 = tail call i32 @cli_putc(i8 signext 32)
%40 = tail call i32 @cli_putc(i8 signext 32)
%41 = tail call i32 @cli_putc(i8 signext 32)
%42 = tail call i32 @cli_putc(i8 signext 32)
%43 = tail call i32 @cli_putc(i8 signext 32)
%44 = tail call i32 @cli_putc(i8 signext 32)
%45 = tail call i32 @cli_putc(i8 signext 32)
%46 = tail call i32 @cli_putc(i8 signext 32)
%47 = tail call i32 @cli_putc(i8 signext 32)
%48 = tail call i32 @cli_putc(i8 signext 32)
%49 = tail call i32 @cli_putc(i8 signext 32)
%50 = tail call i32 @cli_putc(i8 signext 32)
%51 = tail call i32 @cli_putc(i8 signext 32)
%52 = tail call i32 @cli_putc(i8 signext 32)
%53 = tail call i32 @cli_putc(i8 signext 32)
%54 = tail call i32 @cli_putc(i8 signext 32)
%55 = tail call i32 @cli_putc(i8 signext 32)
%56 = tail call i32 @cli_putc(i8 signext 32)
%57 = tail call i32 @cli_putc(i8 signext 32)
%58 = tail call i32 @cli_putc(i8 signext 32)
%59 = tail call i32 @cli_putc(i8 signext 32)
%60 = tail call i32 @cli_putc(i8 signext 32)
%61 = tail call i32 @cli_putc(i8 signext 32)
%62 = getelementptr inbounds i32, i32* %27, i64 16
%63 = icmp ult i32 %29, 16
%64 = select i1 %63, i32 %29, i32 16
%65 = shl nuw nsw i32 %64, 3
%66 = tail call i32 @nessie_print_block(i32* %62, i32 %65)
%67 = icmp ugt i32 %28, 32
br i1 %67, label %26, label %68
68: ; preds = %26, %21, %6
ret void
}