#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*/ printbinary(unsigned int, int);
int /*<<< orphan*/ printf(char *, ...);
void printmatrix(unsigned int ***mat, int dim1, int dim2, int dim3) {
  int i, j, k;
  for (i = dim1 - 1; i >= 0; i--) {
    printf("\n Size %d\n", dim1 - i);
    for (j = 0; j < dim2; j++) {
      printf("\n Complementary label %d\n", j);
      for (k = 0; k < dim3; k++) {
        if (mat[i][j][k]) {
          printf("%d", k);
          printf("Set ");
          printbinary(mat[i][j][k], dim2);
          printf("; ");
        }
      }
    }
    printf("\n");
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     1255 <printmatrix+0x135>
mov    -0xc(%rbp),%esi
sub    -0x18(%rbp),%esi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    122b <printmatrix+0x10b>
mov    -0x1c(%rbp),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1218 <printmatrix+0xf8>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1205 <printmatrix+0xe5>
mov    -0x20(%rbp),%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x10(%rbp),%esi
call   1040 <printbinary@plt>
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120a <printmatrix+0xea>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1187 <printmatrix+0x67>
jmp    121d <printmatrix+0xfd>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1163 <printmatrix+0x43>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    113e <printmatrix+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printmatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,0x4(%rsp)
mov    %esi,(%rsp)
test   %esi,%esi
jle    124a <printmatrix+0x11a>
mov    %edx,%ebp
mov    %rdi,%rbx
mov    (%rsp),%r13d
mov    %edx,%eax
mov    %rax,0x10(%rsp)
mov    0x4(%rsp),%r14d
jmp    1190 <printmatrix+0x60>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpq   $0x1,0x8(%rsp)
jle    124a <printmatrix+0x11a>
mov    %r13,0x8(%rsp)
add    $0xffffffffffffffff,%r13
mov    (%rsp),%esi
sub    %r13d,%esi
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    1170 <printmatrix+0x40>
xor    %r15d,%r15d
jmp    11cb <printmatrix+0x9b>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r15
cmp    0x10(%rsp),%r15
je     1170 <printmatrix+0x40>
lea    0xe39(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11c0 <printmatrix+0x90>
xor    %r12d,%r12d
jmp    11f9 <printmatrix+0xc9>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12
cmp    %r12,%r14
je     11c0 <printmatrix+0x90>
mov    (%rbx,%r13,8),%rax
mov    (%rax,%r15,8),%rax
cmpl   $0x0,(%rax,%r12,4)
je     11f0 <printmatrix+0xc0>
lea    0xe16(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe08(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx,%r13,8),%rax
mov    (%rax,%r15,8),%rax
mov    (%rax,%r12,4),%edi
mov    %ebp,%esi
call   1050 <printbinary@plt>
lea    0xdec(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f0 <printmatrix+0xc0>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"\0A Size %d\0A\00"
@.str.1 = [26 x i8] c"\0A Complementary label %d\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [5 x i8] c"Set \00"
@.str.4 = [3 x i8] c"; \00"
@.str.5 = [2 x i8] c"\0A\00"
define void @printmatrix(i32*** %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32***
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32*** %0, i32**** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load i32, i32* %6
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %9
br label %14
14: ; preds = %79, %4
%15 = load i32, i32* %9
%16 = icmp sge i32 %15, 0
br i1 %16, label %17, label %82
17: ; preds = %14
%18 = load i32, i32* %6
%19 = load i32, i32* %9
%20 = sub nsw i32 %18, %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %20)
store i32 0, i32* %10
br label %22
22: ; preds = %73, %17
%23 = load i32, i32* %10
%24 = load i32, i32* %7
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %76
26: ; preds = %22
%27 = load i32, i32* %10
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %27)
store i32 0, i32* %11
br label %29
29: ; preds = %69, %26
%30 = load i32, i32* %11
%31 = load i32, i32* %8
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %72
33: ; preds = %29
%34 = load i32***, i32**** %5
%35 = load i32, i32* %9
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32**, i32*** %34, i64 %36
%38 = load i32**, i32*** %37
%39 = load i32, i32* %10
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32*, i32** %38, i64 %40
%42 = load i32*, i32** %41
%43 = load i32, i32* %11
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %42, i64 %44
%46 = load i32, i32* %45
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %68
48: ; preds = %33
%49 = load i32, i32* %11
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %49)
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%52 = load i32***, i32**** %5
%53 = load i32, i32* %9
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i32**, i32*** %52, i64 %54
%56 = load i32**, i32*** %55
%57 = load i32, i32* %10
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32*, i32** %56, i64 %58
%60 = load i32*, i32** %59
%61 = load i32, i32* %11
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %60, i64 %62
%64 = load i32, i32* %63
%65 = load i32, i32* %7
%66 = call i32 @printbinary(i32 %64, i32 %65)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %68
68: ; preds = %48, %33
br label %69
69: ; preds = %68
%70 = load i32, i32* %11
%71 = add nsw i32 %70, 1
store i32 %71, i32* %11
br label %29
72: ; preds = %29
br label %73
73: ; preds = %72
%74 = load i32, i32* %10
%75 = add nsw i32 %74, 1
store i32 %75, i32* %10
br label %22
76: ; preds = %22
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %79
79: ; preds = %76
%80 = load i32, i32* %9
%81 = add nsw i32 %80, -1
store i32 %81, i32* %9
br label %14
82: ; preds = %14
ret void
}

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