#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void gf256v_fdump(FILE *fp, const uint8_t *v, unsigned _num_byte) {
  fprintf(fp, "[%2d][", _num_byte);
  for (unsigned i = 0; i < _num_byte; i++) {
    fprintf(fp, "0x%02x,", v[i]);
    if (7 == (i % 8))
      fprintf(fp, " ");
  }
  fprintf(fp, "]");
}


x86 assembly (clang, -O0):
<gf256v_fdump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xecf(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    119f <gf256v_fdump+0x8f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    (%rax,%rcx,4),%edx
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%ecx
and    $0x7,%ecx
mov    $0x7,%eax
cmp    %ecx,%eax
jne    118c <gf256v_fdump+0x7c>
mov    -0x8(%rbp),%rdi
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1191 <gf256v_fdump+0x81>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113f <gf256v_fdump+0x2f>
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gf256v_fdump>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xec9(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %ebp,%ebp
je     1181 <gf256v_fdump+0x61>
mov    %ebp,%r12d
lea    0xebb(%rip),%r15
xor    %ebp,%ebp
jmp    1159 <gf256v_fdump+0x39>
add    $0x1,%rbp
cmp    %rbp,%r12
je     1181 <gf256v_fdump+0x61>
mov    (%r14,%rbp,4),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebp,%eax
not    %eax
test   $0x7,%al
jne    1150 <gf256v_fdump+0x30>
mov    $0x20,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
jmp    1150 <gf256v_fdump+0x30>
mov    $0x5d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"[%2d][\00"
@.str.1 = [8 x i8] c"0x%02x,\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"]\00"
define void @gf256v_fdump(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %6
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %9)
store i32 0, i32* %7
br label %11
11: ; preds = %30, %3
%12 = load i32, i32* %7
%13 = load i32, i32* %6
%14 = icmp ult i32 %12, %13
br i1 %14, label %15, label %33
15: ; preds = %11
%16 = load i32*, i32** %4
%17 = load i32*, i32** %5
%18 = load i32, i32* %7
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %7
%24 = urem i32 %23, 8
%25 = icmp eq i32 7, %24
br i1 %25, label %26, label %29
26: ; preds = %15
%27 = load i32*, i32** %4
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %26, %15
br label %30
30: ; preds = %29
%31 = load i32, i32* %7
%32 = add i32 %31, 1
store i32 %32, i32* %7
br label %11
33: ; preds = %11
%34 = load i32*, i32** %4
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"[%2d][\00"
@.str.1 = [8 x i8] c"0x%02x,\00"
define void @gf256v_fdump(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %2)
%5 = icmp eq i32 %2, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = zext i32 %2 to i64
br label %10
8: ; preds = %19, %3
%9 = tail call i32 @fputc(i32 93, i32* %0)
ret void
10: ; preds = %6, %19
%11 = phi i64 [ 0, %6 ], [ %20, %19 ]
%12 = getelementptr inbounds i32, i32* %1, i64 %11
%13 = load i32, i32* %12
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = and i64 %11, 7
%16 = icmp eq i64 %15, 7
br i1 %16, label %17, label %19
17: ; preds = %10
%18 = tail call i32 @fputc(i32 32, i32* %0)
br label %19
19: ; preds = %10, %17
%20 = add nuw nsw i64 %11, 1
%21 = icmp eq i64 %20, %7
br i1 %21, label %8, label %10
}