#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 debug_display_fields(int, char const **, int const *, int const);
int debug_display_pcb_pid(int pid) {
  const char *fields[] = {"Tick",
                          "PID",
                          "PPID",
                          "UserID",
                          "State",
                          "Swap Flag",
                          "Inode Index",
                          "Input Buffer",
                          "Mode Flag",
                          "User Area Swap Status",
                          "User Area Page Number",
                          "Kernel Stack Pointer",
                          "User Stack Pointer",
                          "PTBR",
                          "PTLR",
                          "Unused"};
  const int fields_len[] = {1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
  const int n_fields = 15;
  int ptr;
  ptr = 28672 + pid * 16;
  return debug_display_fields(ptr, fields, fields_len, n_fields);
}


x86 assembly (clang, -O0):
<debug_display_pcb_pid>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
lea    0x2c64(%rip),%rsi
mov    $0x80,%edx
call   1030 <memcpy@plt>
lea    -0xd0(%rbp),%rdi
lea    0xf5c(%rip),%rsi
mov    $0x3c,%edx
call   1030 <memcpy@plt>
movl   $0xf,-0xd4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
add    $0x7000,%eax
mov    %eax,-0xd8(%rbp)
mov    -0xd8(%rbp),%edi
lea    -0x90(%rbp),%rsi
lea    -0xd0(%rbp),%rdx
mov    $0xf,%ecx
call   1040 <debug_display_fields@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_display_pcb_pid>:
sub    $0xc8,%rsp
movaps 0x2cf2(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0x2cd3(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0x2cb4(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0x2c95(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0x2c76(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0x2c5a(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0x2c3e(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0x2c22(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xf52(%rip),%xmm0
movups %xmm0,0x2c(%rsp)
movaps 0xf3a(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xf1e(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xf02(%rip),%xmm0
movaps %xmm0,(%rsp)
shl    $0x4,%edi
add    $0x7000,%edi
lea    0x40(%rsp),%rsi
mov    %rsp,%rdx
mov    $0xf,%ecx
call   1030 <debug_display_fields@plt>
add    $0xc8,%rsp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"Tick\00"
@.str.1 = [4 x i8] c"PID\00"
@.str.2 = [5 x i8] c"PPID\00"
@.str.3 = [7 x i8] c"UserID\00"
@.str.4 = [6 x i8] c"State\00"
@.str.5 = [10 x i8] c"Swap Flag\00"
@.str.6 = [12 x i8] c"Inode Index\00"
@.str.7 = [13 x i8] c"Input Buffer\00"
@.str.8 = [10 x i8] c"Mode Flag\00"
@.str.9 = [22 x i8] c"User Area Swap Status\00"
@.str.10 = [22 x i8] c"User Area Page Number\00"
@.str.11 = [21 x i8] c"Kernel Stack Pointer\00"
@.str.12 = [19 x i8] c"User Stack Pointer\00"
@.str.13 = [5 x i8] c"PTBR\00"
@.str.14 = [5 x i8] c"PTLR\00"
@.str.15 = [7 x i8] c"Unused\00"
@__const.debug_display_pcb_pid.fields = [16 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i32 0, i32 0)]
@__const.debug_display_pcb_pid.fields_len = [15 x i32] [i32 1, i32 1, i32 1, i32 1, i32 2, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1]
define i32 @debug_display_pcb_pid(i32 %0) {
%2 = alloca i32
%3 = alloca [16 x i8*]
%4 = alloca [15 x i32]
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = bitcast [16 x i8*]* %3 to i8*
%8 = bitcast [15 x i32]* %4 to i8*
store i32 15, i32* %5
%9 = load i32, i32* %2
%10 = mul nsw i32 %9, 16
%11 = add nsw i32 28672, %10
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = getelementptr inbounds [16 x i8*], [16 x i8*]* %3, i64 0, i64 0
%14 = getelementptr inbounds [15 x i32], [15 x i32]* %4, i64 0, i64 0
%15 = call i32 @debug_display_fields(i32 %12, i8** %13, i32* %14, i32 15)
ret i32 %15
}

LLVM IR (-O2):
@.str = [5 x i8] c"Tick\00"
@.str.1 = [4 x i8] c"PID\00"
@.str.2 = [5 x i8] c"PPID\00"
@.str.3 = [7 x i8] c"UserID\00"
@.str.4 = [6 x i8] c"State\00"
@.str.5 = [10 x i8] c"Swap Flag\00"
@.str.6 = [12 x i8] c"Inode Index\00"
@.str.7 = [13 x i8] c"Input Buffer\00"
@.str.8 = [10 x i8] c"Mode Flag\00"
@.str.9 = [22 x i8] c"User Area Swap Status\00"
@.str.10 = [22 x i8] c"User Area Page Number\00"
@.str.11 = [21 x i8] c"Kernel Stack Pointer\00"
@.str.12 = [19 x i8] c"User Stack Pointer\00"
@.str.13 = [5 x i8] c"PTBR\00"
@.str.14 = [5 x i8] c"PTLR\00"
@.str.15 = [7 x i8] c"Unused\00"
@__const.debug_display_pcb_pid.fields = [16 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i32 0, i32 0)]
@__const.debug_display_pcb_pid.fields_len = [15 x i32] [i32 1, i32 1, i32 1, i32 1, i32 2, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1]
define i32 @debug_display_pcb_pid(i32 %0) {
%2 = alloca [16 x i8*]
%3 = alloca [15 x i32]
%4 = bitcast [16 x i8*]* %2 to i8*
%5 = bitcast [15 x i32]* %3 to i8*
%6 = shl nsw i32 %0, 4
%7 = add nsw i32 %6, 28672
%8 = getelementptr inbounds [16 x i8*], [16 x i8*]* %2, i64 0, i64 0
%9 = getelementptr inbounds [15 x i32], [15 x i32]* %3, i64 0, i64 0
%10 = call i32 @debug_display_fields(i32 %7, i8** %8, i32* %9, i32 15)
ret i32 %10
}