#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*/ dot(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ vtoc_ebcdic_dec(char *, char *, int);
int dasdview_print_format1(unsigned int size, unsigned char *dumpstr) {
  unsigned int i;
  char asc[17], ebc[17];
  for (i = 0; i < size; i++) {
    if ((i / 16) * 16 == i) {
      printf("\n|  ");
      strncpy(asc, (char *)dumpstr + i, 16);
      strncpy(ebc, (char *)dumpstr + i, 16);
      asc[16] = '\0';
      ebc[16] = '\0';
    }
    printf("%02X", dumpstr[i]);
    if (((i + 1) / 4) * 4 == i + 1)
      printf(" ");
    if (((i + 1) / 8) * 8 == i + 1)
      printf(" ");
    if (((i + 1) / 16) * 16 == i + 1) {
      vtoc_ebcdic_dec(asc, asc, 16);
      dot(asc);
      dot(ebc);
      printf("| %16.16s | %16.16s |", asc, ebc);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<dasdview_print_format1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    128a <dasdview_print_format1+0x14a>
mov    -0x14(%rbp),%eax
shr    $0x4,%eax
shl    $0x4,%eax
cmp    -0x14(%rbp),%eax
jne    11ba <dasdview_print_format1+0x7a>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%eax
add    %rax,%rsi
mov    $0x10,%edx
call   1040 <strncpy@plt>
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%eax
add    %rax,%rsi
mov    $0x10,%edx
call   1040 <strncpy@plt>
movb   $0x0,-0x20(%rbp)
movb   $0x0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movzbl (%rax,%rcx,1),%esi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
shr    $0x2,%eax
shl    $0x2,%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    11fb <dasdview_print_format1+0xbb>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
shr    $0x3,%eax
shl    $0x3,%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    1223 <dasdview_print_format1+0xe3>
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
shr    $0x4,%eax
shl    $0x4,%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    1277 <dasdview_print_format1+0x137>
lea    -0x30(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x10,%edx
call   1060 <vtoc_ebcdic_dec@plt>
lea    -0x30(%rbp),%rdi
call   1030 <dot@plt>
lea    -0x50(%rbp),%rdi
call   1030 <dot@plt>
lea    -0x30(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    127c <dasdview_print_format1+0x13c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1156 <dasdview_print_format1+0x16>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dasdview_print_format1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
test   %edi,%edi
je     126f <dasdview_print_format1+0x11f>
mov    %rsi,%r13
mov    %edi,%ebx
movabs $0xffffffff0000000f,%r14
ff ff ff
lea    0x20(%rsp),%r15
xor    %r12d,%r12d
jmp    1189 <dasdview_print_format1+0x39>
nop
cmp    %r12,%rbx
je     126f <dasdview_print_format1+0x11f>
test   %r14,%r12
jne    11d0 <dasdview_print_format1+0x80>
lea    0xe6b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rbp
lea    (%r12,%r13,1),%r14
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
call   1050 <strncpy@plt>
mov    %rsp,%rdi
mov    %r14,%rsi
mov    %rbp,%r14
mov    $0x10,%edx
call   1050 <strncpy@plt>
movb   $0x0,0x30(%rsp)
movb   $0x0,0x10(%rsp)
movzbl 0x0(%r13,%r12,1),%esi
lea    0xe28(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%r12
movabs $0xffffffff00000003,%rax
ff ff ff
test   %rax,%r12
jne    1201 <dasdview_print_format1+0xb1>
mov    $0x20,%edi
call   1040 <putchar@plt>
movabs $0xffffffff00000007,%rax
ff ff ff
test   %rax,%r12
je     1220 <dasdview_print_format1+0xd0>
test   %r14,%r12
jne    1180 <dasdview_print_format1+0x30>
jmp    1233 <dasdview_print_format1+0xe3>
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1040 <putchar@plt>
test   %r14,%r12
jne    1180 <dasdview_print_format1+0x30>
mov    %r15,%rdi
mov    %r15,%rsi
mov    $0x10,%edx
call   1070 <vtoc_ebcdic_dec@plt>
mov    %r15,%rdi
call   1030 <dot@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
call   1030 <dot@plt>
lea    0xdad(%rip),%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1180 <dasdview_print_format1+0x30>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\0A| \00"
@.str.1 = [5 x i8] c"%02X\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [22 x i8] c"| %16.16s | %16.16s |\00"
define i32 @dasdview_print_format1(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [17 x i8]
%7 = alloca [17 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %8
8: ; preds = %81, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %3
%11 = icmp ult i32 %9, %10
br i1 %11, label %12, label %84
12: ; preds = %8
%13 = load i32, i32* %5
%14 = udiv i32 %13, 16
%15 = mul i32 %14, 16
%16 = load i32, i32* %5
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %34
18: ; preds = %12
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%20 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%21 = load i8*, i8** %4
%22 = load i32, i32* %5
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = call i32 @strncpy(i8* %20, i8* %24, i32 16)
%26 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%27 = load i8*, i8** %4
%28 = load i32, i32* %5
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = call i32 @strncpy(i8* %26, i8* %30, i32 16)
%32 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 16
store i8 0, i8* %32
%33 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 16
store i8 0, i8* %33
br label %34
34: ; preds = %18, %12
%35 = load i8*, i8** %4
%36 = load i32, i32* %5
%37 = zext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %5
%43 = add i32 %42, 1
%44 = udiv i32 %43, 4
%45 = mul i32 %44, 4
%46 = load i32, i32* %5
%47 = add i32 %46, 1
%48 = icmp eq i32 %45, %47
br i1 %48, label %49, label %51
49: ; preds = %34
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %51
51: ; preds = %49, %34
%52 = load i32, i32* %5
%53 = add i32 %52, 1
%54 = udiv i32 %53, 8
%55 = mul i32 %54, 8
%56 = load i32, i32* %5
%57 = add i32 %56, 1
%58 = icmp eq i32 %55, %57
br i1 %58, label %59, label %61
59: ; preds = %51
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %61
61: ; preds = %59, %51
%62 = load i32, i32* %5
%63 = add i32 %62, 1
%64 = udiv i32 %63, 16
%65 = mul i32 %64, 16
%66 = load i32, i32* %5
%67 = add i32 %66, 1
%68 = icmp eq i32 %65, %67
br i1 %68, label %69, label %80
69: ; preds = %61
%70 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%71 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%72 = call i32 @vtoc_ebcdic_dec(i8* %70, i8* %71, i32 16)
%73 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%74 = call i32 @dot(i8* %73)
%75 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%76 = call i32 @dot(i8* %75)
%77 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%78 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %77, i8* %78)
br label %80
80: ; preds = %69, %61
br label %81
81: ; preds = %80
%82 = load i32, i32* %5
%83 = add i32 %82, 1
store i32 %83, i32* %5
br label %8
84: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"\0A| \00"
@.str.1 = [5 x i8] c"%02X\00"
@.str.3 = [22 x i8] c"| %16.16s | %16.16s |\00"
define i32 @dasdview_print_format1(i32 %0, i8* %1) {
%3 = alloca [17 x i8]
%4 = alloca [17 x i8]
%5 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [17 x i8], [17 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 0
br i1 %7, label %46, label %8
8: ; preds = %2
%9 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 16
%10 = getelementptr inbounds [17 x i8], [17 x i8]* %4, i64 0, i64 16
%11 = zext i32 %0 to i64
br label %12
12: ; preds = %8, %44
%13 = phi i64 [ 0, %8 ], [ %26, %44 ]
%14 = and i64 %13, 4294967280
%15 = icmp eq i64 %14, %13
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds i8, i8* %1, i64 %13
%19 = call i32 @strncpy(i8* %5, i8* %18, i32 16)
%20 = call i32 @strncpy(i8* %6, i8* %18, i32 16)
store i8 0, i8* %9
store i8 0, i8* %10
br label %21
21: ; preds = %16, %12
%22 = getelementptr inbounds i8, i8* %1, i64 %13
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = add nuw nsw i64 %13, 1
%27 = and i64 %26, 4294967292
%28 = icmp eq i64 %27, %26
br i1 %28, label %29, label %31
29: ; preds = %21
%30 = call i32 @putchar(i32 32)
br label %31
31: ; preds = %29, %21
%32 = and i64 %26, 4294967288
%33 = icmp eq i64 %32, %26
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @putchar(i32 32)
br label %36
36: ; preds = %34, %31
%37 = and i64 %26, 4294967280
%38 = icmp eq i64 %37, %26
br i1 %38, label %39, label %44
39: ; preds = %36
%40 = call i32 @vtoc_ebcdic_dec(i8* %5, i8* %5, i32 16)
%41 = call i32 @dot(i8* %5)
%42 = call i32 @dot(i8* %6)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %5, i8* %6)
br label %44
44: ; preds = %36, %39
%45 = icmp eq i64 %26, %11
br i1 %45, label %46, label %12
46: ; preds = %44, %2
ret i32 0
}