#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 y;
typedef int x;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
void dumporder(const int *order) {
  int x, y;
  for (y = 0; y < 32; y++) {
    if (y)
      printf(",\n");
    for (x = 0; x < 32; x++) {
      putchar(x ? ',' : ' ');
      if (order[(((x) + 32) % 32 + (((y) + 32) % 32) * 32)] >= 0)
        printf("%4d", order[(((x) + 32) % 32 + (((y) + 32) % 32) * 32)]);
      else
        printf("    ");
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dumporder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x20,-0x10(%rbp)
jge    1245 <dumporder+0x125>
cmpl   $0x0,-0x10(%rbp)
je     1155 <dumporder+0x35>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    1232 <dumporder+0x112>
mov    -0xc(%rbp),%edx
mov    $0x20,%eax
mov    $0x2c,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%rax
mov    %edx,%ecx
mov    -0x14(%rbp),%edx
shl    $0x5,%ecx
add    %ecx,%edx
movslq %edx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
jl     1211 <dumporder+0xf1>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    -0x30(%rbp),%rax
mov    %edx,%ecx
mov    -0x24(%rbp),%edx
shl    $0x5,%ecx
add    %ecx,%edx
movslq %edx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    121f <dumporder+0xff>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1224 <dumporder+0x104>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115c <dumporder+0x3c>
jmp    1237 <dumporder+0x117>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1133 <dumporder+0x13>
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumporder>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x20,%ebp
lea    0xeb6(%rip),%r14
xor    %r12d,%r12d
jmp    115a <dumporder+0x2a>
nop
add    $0x1,%r12d
cmp    $0x20,%r12d
je     11c1 <dumporder+0x91>
test   %r12d,%r12d
je     116b <dumporder+0x3b>
lea    0xea3(%rip),%rdi
call   1040 <puts@plt>
mov    %r12d,%r13d
shl    $0x5,%r13d
xor    %r15d,%r15d
jmp    1198 <dumporder+0x68>
nopw   0x0(%rax,%rax,1)
lea    0xe7d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15d
cmp    $0x20,%r15d
je     1150 <dumporder+0x20>
test   %r15d,%r15d
mov    $0x2c,%edi
cmove  %ebp,%edi
call   1030 <putchar@plt>
mov    %r15d,%eax
or     %r13d,%eax
mov    (%rbx,%rax,4),%esi
test   %esi,%esi
js     1180 <dumporder+0x50>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    118e <dumporder+0x5e>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c",\0A\00"
@.str.1 = [4 x i8] c"%4d\00"
@.str.2 = [5 x i8] c" \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @dumporder(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %4
br label %5
5: ; preds = %58, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 32
br i1 %7, label %8, label %61
8: ; preds = %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
store i32 0, i32* %3
br label %14
14: ; preds = %54, %13
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 32
br i1 %16, label %17, label %57
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 44, i32 32
%22 = trunc i32 %21 to i8
%23 = call i32 @putchar(i8 signext %22)
%24 = load i32*, i32** %2
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 32
%27 = srem i32 %26, 32
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 32
%30 = srem i32 %29, 32
%31 = mul nsw i32 %30, 32
%32 = add nsw i32 %27, %31
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %24, i64 %33
%35 = load i32, i32* %34
%36 = icmp sge i32 %35, 0
br i1 %36, label %37, label %51
37: ; preds = %17
%38 = load i32*, i32** %2
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 32
%41 = srem i32 %40, 32
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 32
%44 = srem i32 %43, 32
%45 = mul nsw i32 %44, 32
%46 = add nsw i32 %41, %45
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %38, i64 %47
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %49)
br label %53
51: ; preds = %17
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %53
53: ; preds = %51, %37
br label %54
54: ; preds = %53
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %14
57: ; preds = %14
br label %58
58: ; preds = %57
%59 = load i32, i32* %4
%60 = add nsw i32 %59, 1
store i32 %60, i32* %4
br label %5
61: ; preds = %5
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%4d\00"
@.str.2 = [5 x i8] c" \00"
@str = [2 x i8] c",\00"
define void @dumporder(i32* nocapture %0) {
br label %2
2: ; preds = %1, %26
%3 = phi i32 [ 0, %1 ], [ %27, %26 ]
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
%8 = shl i32 %3, 5
br label %9
9: ; preds = %7, %23
%10 = phi i32 [ 0, %7 ], [ %24, %23 ]
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i8 32, i8 44
%13 = tail call i32 @putchar(i8 signext %12)
%14 = or i32 %10, %8
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %0, i64 %15
%17 = load i32, i32* %16
%18 = icmp sgt i32 %17, -1
br i1 %18, label %19, label %21
19: ; preds = %9
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %23
21: ; preds = %9
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %19, %21
%24 = add nuw nsw i32 %10, 1
%25 = icmp eq i32 %24, 32
br i1 %25, label %26, label %9
26: ; preds = %23
%27 = add nuw nsw i32 %3, 1
%28 = icmp eq i32 %27, 32
br i1 %28, label %29, label %2
29: ; preds = %26
%30 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
ret void
}