#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 */
struct genwqe_debug_data {
  char *driver_version;
  int /*<<< orphan*/ ddcb_finished;
  int /*<<< orphan*/ ddcb_prev;
  int /*<<< orphan*/ ddcb_before;
  scalar_t__ app_unitcfg;
  scalar_t__ slu_unitcfg;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ genwqe_hexdump(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                  int);
void genwqe_print_debug_data(FILE *fp, struct genwqe_debug_data *debug_data,
                             int flags) {
  if (debug_data == NULL)
    return;
  if (flags & 0x0001)
    fprintf(fp, "driver:%s SLU/APP: %016llx.%016llx\n\n",
            debug_data->driver_version, (long long)debug_data->slu_unitcfg,
            (long long)debug_data->app_unitcfg);
  if (flags & 0x0002) {
    fprintf(fp, "ddcb before processing:\n");
    genwqe_hexdump(fp, &debug_data->ddcb_before,
                   sizeof(debug_data->ddcb_before));
  }
  if (flags & 0x0004) {
    fprintf(fp, "ddcb previous:\n");
    genwqe_hexdump(fp, &debug_data->ddcb_prev, sizeof(debug_data->ddcb_prev));
  }
  if (flags & 0x0008) {
    fprintf(fp, "ddcb processed:\n");
    genwqe_hexdump(fp, &debug_data->ddcb_finished,
                   sizeof(debug_data->ddcb_finished));
  }
}


x86 assembly (clang, -O0):
<genwqe_print_debug_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <genwqe_print_debug_data+0x23>
jmp    1220 <genwqe_print_debug_data+0x100>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     117b <genwqe_print_debug_data+0x5b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rcx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%r8
lea    0xe8c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11b2 <genwqe_print_debug_data+0x92>
mov    -0x8(%rbp),%rdi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
mov    $0x4,%edx
call   1030 <genwqe_hexdump@plt>
mov    -0x14(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11e9 <genwqe_print_debug_data+0xc9>
mov    -0x8(%rbp),%rdi
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0xc,%rsi
mov    $0x4,%edx
call   1030 <genwqe_hexdump@plt>
mov    -0x14(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1220 <genwqe_print_debug_data+0x100>
mov    -0x8(%rbp),%rdi
lea    0xe4b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    $0x4,%edx
call   1030 <genwqe_hexdump@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genwqe_print_debug_data>:
push   %rbp
push   %r14
push   %rbx
test   %rsi,%rsi
je     115d <genwqe_print_debug_data+0x2d>
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%r14
test   $0x1,%bpl
jne    1162 <genwqe_print_debug_data+0x32>
test   $0x2,%bpl
jne    1184 <genwqe_print_debug_data+0x54>
test   $0x4,%bpl
jne    11b4 <genwqe_print_debug_data+0x84>
test   $0x8,%bpl
jne    11e8 <genwqe_print_debug_data+0xb8>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x20(%rbx),%rcx
mov    (%rbx),%rdx
mov    0x18(%rbx),%r8
lea    0xe8c(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <fprintf@plt>
test   $0x2,%bpl
je     114d <genwqe_print_debug_data+0x1d>
lea    0xe9a(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0x10(%rbx),%rsi
mov    %r14,%rdi
mov    $0x4,%edx
call   1030 <genwqe_hexdump@plt>
test   $0x4,%bpl
je     1153 <genwqe_print_debug_data+0x23>
lea    0xe83(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
lea    0xc(%rbx),%rsi
mov    %r14,%rdi
mov    $0x4,%edx
call   1030 <genwqe_hexdump@plt>
test   $0x8,%bpl
je     115d <genwqe_print_debug_data+0x2d>
lea    0xe5f(%rip),%rdi
mov    $0x10,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
add    $0x8,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <genwqe_hexdump@plt>

LLVM IR (-O0):
%struct.genwqe_debug_data = type { i8*, i32, i32, i32, i64, i64 }
@.str = [37 x i8] c"driver:%s SLU/APP: %016llx.%016llx\0A\0A\00"
@.str.1 = [25 x i8] c"ddcb before processing:\0A\00"
@.str.2 = [16 x i8] c"ddcb previous:\0A\00"
@.str.3 = [17 x i8] c"ddcb processed:\0A\00"
define void @genwqe_print_debug_data(i32* %0, %struct.genwqe_debug_data* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca %struct.genwqe_debug_data*
%6 = alloca i32
store i32* %0, i32** %4
store %struct.genwqe_debug_data* %1, %struct.genwqe_debug_data** %5
store i32 %2, i32* %6
%7 = load %struct.genwqe_debug_data*, %struct.genwqe_debug_data** %5
%8 = icmp eq %struct.genwqe_debug_data* %7, null
br i1 %8, label %9, label %10
9: ; preds = %3
br label %59
10: ; preds = %3
%11 = load i32, i32* %6
%12 = and i32 %11, 1
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %26
14: ; preds = %10
%15 = load i32*, i32** %4
%16 = load %struct.genwqe_debug_data*, %struct.genwqe_debug_data** %5
%17 = getelementptr inbounds %struct.genwqe_debug_data, %struct.genwqe_debug_data* %16, i32 0, i32 0
%18 = load i8*, i8** %17
%19 = load %struct.genwqe_debug_data*, %struct.genwqe_debug_data** %5
%20 = getelementptr inbounds %struct.genwqe_debug_data, %struct.genwqe_debug_data* %19, i32 0, i32 5
%21 = load i64, i64* %20
%22 = load %struct.genwqe_debug_data*, %struct.genwqe_debug_data** %5
%23 = getelementptr inbounds %struct.genwqe_debug_data, %struct.genwqe_debug_data* %22, i32 0, i32 4
%24 = load i64, i64* %23
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %18, i64 %21, i64 %24)
br label %26
26: ; preds = %14, %10
%27 = load i32, i32* %6
%28 = and i32 %27, 2
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %37
30: ; preds = %26
%31 = load i32*, i32** %4
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%33 = load i32*, i32** %4
%34 = load %struct.genwqe_debug_data*, %struct.genwqe_debug_data** %5
%35 = getelementptr inbounds %struct.genwqe_debug_data, %struct.genwqe_debug_data* %34, i32 0, i32 3
%36 = call i32 @genwqe_hexdump(i32* %33, i32* %35, i32 4)
br label %37
37: ; preds = %30, %26
%38 = load i32, i32* %6
%39 = and i32 %38, 4
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %48
41: ; preds = %37
%42 = load i32*, i32** %4
%43 = call i32 (i32*, i8*, ...) @fprintf(i32* %42, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%44 = load i32*, i32** %4
%45 = load %struct.genwqe_debug_data*, %struct.genwqe_debug_data** %5
%46 = getelementptr inbounds %struct.genwqe_debug_data, %struct.genwqe_debug_data* %45, i32 0, i32 2
%47 = call i32 @genwqe_hexdump(i32* %44, i32* %46, i32 4)
br label %48
48: ; preds = %41, %37
%49 = load i32, i32* %6
%50 = and i32 %49, 8
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %59
52: ; preds = %48
%53 = load i32*, i32** %4
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %53, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%55 = load i32*, i32** %4
%56 = load %struct.genwqe_debug_data*, %struct.genwqe_debug_data** %5
%57 = getelementptr inbounds %struct.genwqe_debug_data, %struct.genwqe_debug_data* %56, i32 0, i32 1
%58 = call i32 @genwqe_hexdump(i32* %55, i32* %57, i32 4)
br label %59
59: ; preds = %9, %52, %48
ret void
}

LLVM IR (-O2):
%struct.genwqe_debug_data = type { i8*, i32, i32, i32, i64, i64 }
@.str = [37 x i8] c"driver:%s SLU/APP: %016llx.%016llx\0A\0A\00"
@.str.1 = [25 x i8] c"ddcb before processing:\0A\00"
@.str.2 = [16 x i8] c"ddcb previous:\0A\00"
@.str.3 = [17 x i8] c"ddcb processed:\0A\00"
define void @genwqe_print_debug_data(i32* %0, %struct.genwqe_debug_data* %1, i32 %2) {
%4 = icmp eq %struct.genwqe_debug_data* %1, null
br i1 %4, label %37, label %5
5: ; preds = %3
%6 = and i32 %2, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %16, label %8
8: ; preds = %5
%9 = getelementptr inbounds %struct.genwqe_debug_data, %struct.genwqe_debug_data* %1, i64 0, i32 0
%10 = load i8*, i8** %9
%11 = getelementptr inbounds %struct.genwqe_debug_data, %struct.genwqe_debug_data* %1, i64 0, i32 5
%12 = load i64, i64* %11
%13 = getelementptr inbounds %struct.genwqe_debug_data, %struct.genwqe_debug_data* %1, i64 0, i32 4
%14 = load i64, i64* %13
%15 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %10, i64 %12, i64 %14)
br label %16
16: ; preds = %8, %5
%17 = and i32 %2, 2
%18 = icmp eq i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i64 24, i64 1, i32* %0)
%21 = getelementptr inbounds %struct.genwqe_debug_data, %struct.genwqe_debug_data* %1, i64 0, i32 3
%22 = tail call i32 @genwqe_hexdump(i32* %0, i32* %21, i32 4)
br label %23
23: ; preds = %19, %16
%24 = and i32 %2, 4
%25 = icmp eq i32 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i64 15, i64 1, i32* %0)
%28 = getelementptr inbounds %struct.genwqe_debug_data, %struct.genwqe_debug_data* %1, i64 0, i32 2
%29 = tail call i32 @genwqe_hexdump(i32* %0, i32* %28, i32 4)
br label %30
30: ; preds = %26, %23
%31 = and i32 %2, 8
%32 = icmp eq i32 %31, 0
br i1 %32, label %37, label %33
33: ; preds = %30
%34 = tail call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i64 16, i64 1, i32* %0)
%35 = getelementptr inbounds %struct.genwqe_debug_data, %struct.genwqe_debug_data* %1, i64 0, i32 1
%36 = tail call i32 @genwqe_hexdump(i32* %0, i32* %35, i32 4)
br label %37
37: ; preds = %3, %33, %30
ret void
}