#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*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
void computer_dump(int acc, int ins_count, int ins_reg, int math_opperand_reg,
                   int op_code, int operand, int mem_arr[],
                   int size_of_memory) {
  printf("%s\n", "REGISTERS:");
  printf("accumulator             %+05d\n", acc);
  printf("instruction_counter     %02d\n", ins_count);
  printf("instruction_register    %+05d\n", ins_reg);
  printf("math_opperand_register  %+05d\n", math_opperand_reg);
  printf("op_code                 %02d\n", op_code);
  printf("operand                 %02d\n", operand);
  const int col_len = 5;
  int i, j;
  printf("MEMORY:\n");
  printf("          %d", 0);
  for (i = 1; i < col_len; ++i) {
    printf("        %d", i);
  }
  puts("");
  for (i = 0; i < size_of_memory; i += col_len) {
    printf("%02d", i);
    for (j = 0; j < col_len; ++j) {
      printf("    %+05d", mem_arr[i + j]);
    }
    printf("%c", '\n');
  }
}


x86 assembly (clang, -O0):
<computer_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
lea    0xeb6(%rip),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x5,-0x1c(%rbp)
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef5(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x20(%rbp)
cmpl   $0x5,-0x20(%rbp)
jge    1213 <computer_dump+0xf3>
mov    -0x20(%rbp),%esi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ea <computer_dump+0xca>
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    12a1 <computer_dump+0x181>
mov    -0x20(%rbp),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1280 <computer_dump+0x160>
mov    0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    124a <computer_dump+0x12a>
lea    0xe64(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x20(%rbp)
jmp    1226 <computer_dump+0x106>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computer_dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,0x4(%rsp)
mov    %r8d,%r15d
mov    %ecx,%r14d
mov    %edx,%r13d
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x48(%rsp),%r12d
lea    0xea7(%rip),%rdi
call   1040 <puts@plt>
lea    0xea6(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec3(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed1(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xedf(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeec(%rip),%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf14(%rip),%rdi
call   1040 <puts@plt>
lea    0xeec(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xede(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r12d,%r12d
jle    12b5 <computer_dump+0x185>
mov    0x40(%rsp),%rbp
lea    0xe8e(%rip),%r14
lea    0xe8c(%rip),%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%rbp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rbp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rbp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x5,%rbx
cmp    %r12d,%ebx
jl     1250 <computer_dump+0x120>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [11 x i8] c"REGISTERS:\00"
@.str.2 = [31 x i8] c"accumulator %+05d\0A\00"
@.str.3 = [30 x i8] c"instruction_counter %02d\0A\00"
@.str.4 = [31 x i8] c"instruction_register %+05d\0A\00"
@.str.5 = [31 x i8] c"math_opperand_register %+05d\0A\00"
@.str.6 = [30 x i8] c"op_code %02d\0A\00"
@.str.7 = [30 x i8] c"operand %02d\0A\00"
@.str.8 = [9 x i8] c"MEMORY:\0A\00"
@.str.9 = [13 x i8] c" %d\00"
@.str.10 = [11 x i8] c" %d\00"
@.str.11 = [1 x i8] zeroinitializer
@.str.12 = [5 x i8] c"%02d\00"
@.str.13 = [10 x i8] c" %+05d\00"
@.str.14 = [3 x i8] c"%c\00"
define void @computer_dump(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32* %6, i32 %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i32 %0, i32* %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32* %6, i32** %15
store i32 %7, i32* %16
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* %9
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %10
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %11
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %12
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %13
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %14
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i32 %31)
store i32 5, i32* %17
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 0)
store i32 1, i32* %18
br label %35
35: ; preds = %41, %8
%36 = load i32, i32* %18
%37 = icmp slt i32 %36, 5
br i1 %37, label %38, label %44
38: ; preds = %35
%39 = load i32, i32* %18
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %38
%42 = load i32, i32* %18
%43 = add nsw i32 %42, 1
store i32 %43, i32* %18
br label %35
44: ; preds = %35
%45 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %18
br label %46
46: ; preds = %70, %44
%47 = load i32, i32* %18
%48 = load i32, i32* %16
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %73
50: ; preds = %46
%51 = load i32, i32* %18
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 %51)
store i32 0, i32* %19
br label %53
53: ; preds = %65, %50
%54 = load i32, i32* %19
%55 = icmp slt i32 %54, 5
br i1 %55, label %56, label %68
56: ; preds = %53
%57 = load i32*, i32** %15
%58 = load i32, i32* %18
%59 = load i32, i32* %19
%60 = add nsw i32 %58, %59
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %57, i64 %61
%63 = load i32, i32* %62
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 %63)
br label %65
65: ; preds = %56
%66 = load i32, i32* %19
%67 = add nsw i32 %66, 1
store i32 %67, i32* %19
br label %53
68: ; preds = %53
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i32 10)
br label %70
70: ; preds = %68
%71 = load i32, i32* %18
%72 = add nsw i32 %71, 5
store i32 %72, i32* %18
br label %46
73: ; preds = %46
ret void
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"REGISTERS:\00"
@.str.2 = [31 x i8] c"accumulator %+05d\0A\00"
@.str.3 = [30 x i8] c"instruction_counter %02d\0A\00"
@.str.4 = [31 x i8] c"instruction_register %+05d\0A\00"
@.str.5 = [31 x i8] c"math_opperand_register %+05d\0A\00"
@.str.6 = [30 x i8] c"op_code %02d\0A\00"
@.str.7 = [30 x i8] c"operand %02d\0A\00"
@.str.9 = [13 x i8] c" %d\00"
@.str.10 = [11 x i8] c" %d\00"
@.str.12 = [5 x i8] c"%02d\00"
@.str.13 = [10 x i8] c" %+05d\00"
@str = [8 x i8] c"MEMORY:\00"
define void @computer_dump(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32* nocapture %6, i32 %7) {
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %0)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %1)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %2)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %3)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i32 %4)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i32 %5)
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 0)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 1)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 2)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 3)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 4)
%22 = tail call i32 @putchar(i32 10)
%23 = icmp sgt i32 %7, 0
br i1 %23, label %24, label %51
24: ; preds = %8, %24
%25 = phi i64 [ %48, %24 ], [ 0, %8 ]
%26 = trunc i64 %25 to i32
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds i32, i32* %6, i64 %25
%29 = load i32, i32* %28
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 %29)
%31 = add nuw nsw i64 %25, 1
%32 = getelementptr inbounds i32, i32* %6, i64 %31
%33 = load i32, i32* %32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 %33)
%35 = add nuw nsw i64 %25, 2
%36 = getelementptr inbounds i32, i32* %6, i64 %35
%37 = load i32, i32* %36
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 %37)
%39 = add nuw nsw i64 %25, 3
%40 = getelementptr inbounds i32, i32* %6, i64 %39
%41 = load i32, i32* %40
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 %41)
%43 = add nuw nsw i64 %25, 4
%44 = getelementptr inbounds i32, i32* %6, i64 %43
%45 = load i32, i32* %44
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 %45)
%47 = tail call i32 @putchar(i32 10)
%48 = add nuw i64 %25, 5
%49 = trunc i64 %48 to i32
%50 = icmp slt i32 %49, %7
br i1 %50, label %24, label %51
51: ; preds = %24, %8
ret void
}