#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*/ putHex(char *, int, int, int, char, int /*<<< orphan*/);
int /*<<< orphan*/ putfont8(char *, int, int, int, char, char *);
void putHexs(char *vram, int xsize, int x, int y, char c, unsigned char *s,
             int len) {
  extern char ascii[4096];
  for (; len > 0x00; len--) {
    putHex(vram, xsize, x, y, c, s++);
    x += 16;
    putfont8(vram, xsize, x, y, c, ascii + ' ' * 16);
    x += 8;
    if (len % 27 == 0) {
      y += 24;
      x = 0;
    }
  }
}


x86 assembly (clang, -O0):
<putHexs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r8b,%al
mov    0x10(%rbp),%r8d
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %al,-0x15(%rbp)
mov    %r9,-0x20(%rbp)
cmpl   $0x0,0x10(%rbp)
jle    11e6 <putHexs+0xc6>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x15(%rbp),%al
mov    -0x20(%rbp),%r8
mov    %r8,%r9
add    $0x1,%r9
mov    %r9,-0x20(%rbp)
mov    %r8d,%r9d
movsbl %al,%r8d
call   1030 <putHex@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    0x2e4b(%rip),%r9
add    $0x200,%r9
movsbl -0x15(%rbp),%r8d
call   1040 <putfont8@plt>
mov    -0x10(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    0x10(%rbp),%eax
mov    $0x1b,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d3 <putHexs+0xb3>
mov    -0x14(%rbp),%eax
add    $0x18,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    11d8 <putHexs+0xb8>
mov    0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,0x10(%rbp)
jmp    1143 <putHexs+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putHexs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,%r12d
mov    0x60(%rsp),%ecx
test   %ecx,%ecx
jle    120a <putHexs+0xea>
mov    %r9,%r13
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%r15
lea    0x1(%rcx),%edx
movsbl %r8b,%eax
mov    %eax,0xc(%rsp)
mov    $0x200,%eax
add    0x2e81(%rip),%rax
mov    %rax,0x20(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edx,0x14(%rsp)
mov    %rcx,0x18(%rsp)
mov    %ecx,%eax
imul   $0x2f684bdb,%rax,%rax
shr    $0x20,%rax
mov    0x18(%rsp),%rcx
sub    %eax,%ecx
shr    %ecx
add    %eax,%ecx
shr    $0x4,%ecx
imul   $0xffffffe5,%ecx,%eax
mov    %eax,0x10(%rsp)
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
mov    0xc(%rsp),%ebp
mov    %ebp,%r8d
mov    %r13d,%r9d
call   1030 <putHex@plt>
lea    0x10(%rbx),%edx
mov    %r15,%rdi
mov    %r14d,%esi
mov    %r12d,%ecx
mov    %ebp,%r8d
mov    0x20(%rsp),%r9
call   1040 <putfont8@plt>
mov    0x14(%rsp),%edx
mov    0x18(%rsp),%rcx
add    $0x18,%ebx
mov    0x10(%rsp),%ebp
add    %edx,%ebp
lea    0x18(%r12),%eax
cmp    $0x1,%ebp
cmovne %r12d,%eax
mov    $0x0,%ebp
cmove  %ebp,%ebx
add    $0xffffffff,%ecx
add    $0xffffffff,%edx
add    $0x1,%r13d
mov    %eax,%r12d
cmp    $0x1,%edx
ja     1170 <putHexs+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@ascii = external global [4096 x i8]
define void @putHexs(i8* %0, i32 %1, i32 %2, i32 %3, i8 signext %4, i8* %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8
%13 = alloca i8*
%14 = alloca i32
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i8 %4, i8* %12
store i8* %5, i8** %13
store i32 %6, i32* %14
br label %15
15: ; preds = %45, %7
%16 = load i32, i32* %14
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %48
18: ; preds = %15
%19 = load i8*, i8** %8
%20 = load i32, i32* %9
%21 = load i32, i32* %10
%22 = load i32, i32* %11
%23 = load i8, i8* %12
%24 = load i8*, i8** %13
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %13
%26 = ptrtoint i8* %24 to i32
%27 = call i32 @putHex(i8* %19, i32 %20, i32 %21, i32 %22, i8 signext %23, i32 %26)
%28 = load i32, i32* %10
%29 = add nsw i32 %28, 16
store i32 %29, i32* %10
%30 = load i8*, i8** %8
%31 = load i32, i32* %9
%32 = load i32, i32* %10
%33 = load i32, i32* %11
%34 = load i8, i8* %12
%35 = call i32 @putfont8(i8* %30, i32 %31, i32 %32, i32 %33, i8 signext %34, i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @ascii, i64 0, i64 512))
%36 = load i32, i32* %10
%37 = add nsw i32 %36, 8
store i32 %37, i32* %10
%38 = load i32, i32* %14
%39 = srem i32 %38, 27
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %18
%42 = load i32, i32* %11
%43 = add nsw i32 %42, 24
store i32 %43, i32* %11
store i32 0, i32* %10
br label %44
44: ; preds = %41, %18
br label %45
45: ; preds = %44
%46 = load i32, i32* %14
%47 = add nsw i32 %46, -1
store i32 %47, i32* %14
br label %15
48: ; preds = %15
ret void
}

LLVM IR (-O2):
@ascii = external global [4096 x i8]
define void @putHexs(i8* %0, i32 %1, i32 %2, i32 %3, i8 signext %4, i8* %5, i32 %6) {
%8 = icmp sgt i32 %6, 0
br i1 %8, label %9, label %28
9: ; preds = %7, %9
%10 = phi i32 [ %26, %9 ], [ %6, %7 ]
%11 = phi i8* [ %14, %9 ], [ %5, %7 ]
%12 = phi i32 [ %25, %9 ], [ %2, %7 ]
%13 = phi i32 [ %24, %9 ], [ %3, %7 ]
%14 = getelementptr inbounds i8, i8* %11, i64 1
%15 = ptrtoint i8* %11 to i64
%16 = trunc i64 %15 to i32
%17 = tail call i32 @putHex(i8* %0, i32 %1, i32 %12, i32 %13, i8 signext %4, i32 %16)
%18 = add nsw i32 %12, 16
%19 = tail call i32 @putfont8(i8* %0, i32 %1, i32 %18, i32 %13, i8 signext %4, i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @ascii, i64 0, i64 512))
%20 = add nsw i32 %12, 24
%21 = urem i32 %10, 27
%22 = icmp eq i32 %21, 0
%23 = add nsw i32 %13, 24
%24 = select i1 %22, i32 %23, i32 %13
%25 = select i1 %22, i32 0, i32 %20
%26 = add nsw i32 %10, -1
%27 = icmp ugt i32 %10, 1
br i1 %27, label %9, label %28
28: ; preds = %9, %7
ret void
}