#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 position {
  int dummy;
};

/* Variables and functions */
int data_to_human(struct position *, int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void print_position(struct position *pos) {
  if (pos == NULL) {
    fprintf(stdout, "pos is NULL\n");
    return;
  }
  fprintf(stdout, "---------------------------------\n");
  for (int i = 7; i >= 0; i--) {
    for (int j = 0; j < 8; j++) {
      fprintf(stdout, "| %c ", data_to_human(pos, i, j));
    }
    fprintf(stdout, "|\n");
    fprintf(stdout, "---------------------------------\n");
  }
}


x86 assembly (clang, -O0):
<print_position>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1153 <print_position+0x33>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1204 <print_position+0xe4>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x7,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1204 <print_position+0xe4>
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    11c8 <print_position+0xa8>
mov    0x2e4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <data_to_human@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%edx
lea    0xe7d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1182 <print_position+0x62>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
lea    0xe1e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1171 <print_position+0x51>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_position>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
mov    0x2eab(%rip),%r14
mov    (%r14),%edi
test   %r13,%r13
je     12a3 <print_position+0x183>
lea    0xec5(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x7,%ebp
lea    0xed5(%rip),%r15
lea    0xed4(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14),%ebx
mov    %r13,%rdi
mov    %ebp,%esi
xor    %edx,%edx
call   1030 <data_to_human@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%ebx
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
call   1030 <data_to_human@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%ebx
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x2,%edx
call   1030 <data_to_human@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%ebx
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x3,%edx
call   1030 <data_to_human@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%ebx
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x4,%edx
call   1030 <data_to_human@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%ebx
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x5,%edx
call   1030 <data_to_human@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%ebx
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x6,%edx
call   1030 <data_to_human@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%ebx
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x7,%edx
call   1030 <data_to_human@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xd89(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0xffffffff,%ebp
jb     1170 <print_position+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd56(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
%struct.position = type { i32 }
@stdout = global i32 0
@.str = [13 x i8] c"pos is NULL\0A\00"
@.str.1 = [35 x i8] c"---------------------------------\0A\00"
@.str.2 = [6 x i8] c"| %c \00"
@.str.3 = [3 x i8] c"|\0A\00"
define void @print_position(%struct.position* %0) {
%2 = alloca %struct.position*
%3 = alloca i32
%4 = alloca i32
store %struct.position* %0, %struct.position** %2
%5 = load %struct.position*, %struct.position** %2
%6 = icmp eq %struct.position* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* @stdout
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %38
10: ; preds = %1
%11 = load i32, i32* @stdout
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
store i32 7, i32* %3
br label %13
13: ; preds = %35, %10
%14 = load i32, i32* %3
%15 = icmp sge i32 %14, 0
br i1 %15, label %16, label %38
16: ; preds = %13
store i32 0, i32* %4
br label %17
17: ; preds = %27, %16
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 8
br i1 %19, label %20, label %30
20: ; preds = %17
%21 = load i32, i32* @stdout
%22 = load %struct.position*, %struct.position** %2
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = call i32 @data_to_human(%struct.position* %22, i32 %23, i32 %24)
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %20
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %17
30: ; preds = %17
%31 = load i32, i32* @stdout
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%33 = load i32, i32* @stdout
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %35
35: ; preds = %30
%36 = load i32, i32* %3
%37 = add nsw i32 %36, -1
store i32 %37, i32* %3
br label %13
38: ; preds = %7, %13
ret void
}

LLVM IR (-O2):
%struct.position = type { i32 }
@stdout = global i32 0
@.str = [13 x i8] c"pos is NULL\0A\00"
@.str.1 = [35 x i8] c"---------------------------------\0A\00"
@.str.2 = [6 x i8] c"| %c \00"
@.str.3 = [3 x i8] c"|\0A\00"
define void @print_position(%struct.position* %0) {
%2 = icmp eq %struct.position* %0, null
%3 = load i32, i32* @stdout
br i1 %2, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %40
6: ; preds = %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %8
%9 = phi i32 [ 7, %6 ], [ %38, %8 ]
%10 = load i32, i32* @stdout
%11 = tail call i32 @data_to_human(%struct.position* %0, i32 %9, i32 0)
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = load i32, i32* @stdout
%14 = tail call i32 @data_to_human(%struct.position* %0, i32 %9, i32 1)
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @stdout
%17 = tail call i32 @data_to_human(%struct.position* %0, i32 %9, i32 2)
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = load i32, i32* @stdout
%20 = tail call i32 @data_to_human(%struct.position* %0, i32 %9, i32 3)
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = load i32, i32* @stdout
%23 = tail call i32 @data_to_human(%struct.position* %0, i32 %9, i32 4)
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = load i32, i32* @stdout
%26 = tail call i32 @data_to_human(%struct.position* %0, i32 %9, i32 5)
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = load i32, i32* @stdout
%29 = tail call i32 @data_to_human(%struct.position* %0, i32 %9, i32 6)
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = load i32, i32* @stdout
%32 = tail call i32 @data_to_human(%struct.position* %0, i32 %9, i32 7)
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = load i32, i32* @stdout
%35 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%36 = load i32, i32* @stdout
%37 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%38 = add nsw i32 %9, -1
%39 = icmp eq i32 %9, 0
br i1 %39, label %40, label %8
40: ; preds = %8, %4
ret void
}