#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_format2(unsigned int size, unsigned char *dumpstr,
                           unsigned long long begin) {
  unsigned int i;
  char asc[17], ebc[17];
  for (i = 0; i < size; i++) {
    if ((i / 8) * 8 == i) {
      printf("\n | %13llu | %13llX |  ", begin + (unsigned long long)i,
             begin + (unsigned long long)i);
      strncpy(asc, (char *)dumpstr + i, 8);
      strncpy(ebc, (char *)dumpstr + i, 8);
    }
    printf("%02X", dumpstr[i]);
    if (((i + 1) / 4) * 4 == i + 1)
      printf("  ");
    if (((i + 1) / 8) * 8 == i + 1) {
      vtoc_ebcdic_dec(asc, asc, 8);
      dot(asc);
      dot(ebc);
      printf("| %8.8s | %8.8s |", asc, ebc);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<dasdview_print_format2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1272 <dasdview_print_format2+0x132>
mov    -0x1c(%rbp),%eax
shr    $0x3,%eax
shl    $0x3,%eax
cmp    -0x1c(%rbp),%eax
jne    11ca <dasdview_print_format2+0x8a>
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%eax
add    %rax,%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%eax
add    %rax,%rdx
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%eax
add    %rax,%rsi
mov    $0x8,%edx
call   1040 <strncpy@plt>
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%eax
add    %rax,%rsi
mov    $0x8,%edx
call   1040 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movzbl (%rax,%rcx,1),%esi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
shr    $0x2,%eax
shl    $0x2,%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    120b <dasdview_print_format2+0xcb>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
shr    $0x3,%eax
shl    $0x3,%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    125f <dasdview_print_format2+0x11f>
lea    -0x30(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x8,%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    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1264 <dasdview_print_format2+0x124>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115a <dasdview_print_format2+0x1a>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dasdview_print_format2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,0x8(%rsp)
test   %edi,%edi
je     1265 <dasdview_print_format2+0x125>
mov    %rsi,%r14
mov    %edi,%ebx
movabs $0xffffffff00000007,%r15
ff ff ff
lea    0x30(%rsp),%r12
xor    %r13d,%r13d
jmp    1189 <dasdview_print_format2+0x49>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %r13,%rbx
je     1265 <dasdview_print_format2+0x125>
test   %r15,%r13
jne    11d4 <dasdview_print_format2+0x94>
mov    0x8(%rsp),%rax
lea    (%rax,%r13,1),%rdx
lea    0xe62(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rbp
lea    (%r14,%r13,1),%r15
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x8,%edx
call   1040 <strncpy@plt>
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
mov    %rbp,%r15
mov    $0x8,%edx
call   1040 <strncpy@plt>
movzbl (%r14,%r13,1),%esi
lea    0xe38(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r13
movabs $0xffffffff00000003,%rax
ff ff ff
test   %rax,%r13
je     1210 <dasdview_print_format2+0xd0>
test   %r15,%r13
jne    1180 <dasdview_print_format2+0x40>
jmp    1227 <dasdview_print_format2+0xe7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xdfe(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r15,%r13
jne    1180 <dasdview_print_format2+0x40>
mov    %r12,%rdi
mov    %r12,%rsi
mov    $0x8,%edx
call   1060 <vtoc_ebcdic_dec@plt>
mov    %r12,%rdi
call   1030 <dot@plt>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1030 <dot@plt>
lea    0xdca(%rip),%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1180 <dasdview_print_format2+0x40>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [24 x i8] c"\0A | %13llu | %13llX | \00"
@.str.1 = [5 x i8] c"%02X\00"
@.str.2 = [3 x i8] c" \00"
@.str.3 = [18 x i8] c"| %8.8s | %8.8s |\00"
define i32 @dasdview_print_format2(i32 %0, i8* %1, i64 %2) {
%4 = alloca [17 x i8]
%5 = alloca [17 x i8]
%6 = getelementptr inbounds [17 x i8], [17 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [17 x i8], [17 x i8]* %5, i64 0, i64 0
%8 = icmp eq i32 %0, 0
br i1 %8, label %41, label %9
9: ; preds = %3
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %9, %39
%12 = phi i64 [ 0, %9 ], [ %26, %39 ]
%13 = and i64 %12, 4294967288
%14 = icmp eq i64 %13, %12
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = add i64 %12, %2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i64 %16, i64 %16)
%18 = getelementptr inbounds i8, i8* %1, i64 %12
%19 = call i32 @strncpy(i8* %6, i8* %18, i32 8)
%20 = call i32 @strncpy(i8* %7, i8* %18, i32 8)
br label %21
21: ; preds = %15, %11
%22 = getelementptr inbounds i8, i8* %1, i64 %12
%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 %12, 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %29, %21
%32 = and i64 %26, 4294967288
%33 = icmp eq i64 %32, %26
br i1 %33, label %34, label %39
34: ; preds = %31
%35 = call i32 @vtoc_ebcdic_dec(i8* %6, i8* %6, i32 8)
%36 = call i32 @dot(i8* %6)
%37 = call i32 @dot(i8* %7)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %6, i8* %7)
br label %39
39: ; preds = %31, %34
%40 = icmp eq i64 %26, %10
br i1 %40, label %41, label %11
41: ; preds = %39, %3
ret i32 0
}