#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 *, ...);
void printmatrixtree(unsigned int **mat, int dim1, int dim2, int magicnumber,
                     int codesize) {
  int i, j;
  for (i = 0; i < dim1; i++) {
    printf("\n Complementary size %d\n", i);
    for (j = 0; j < dim2; j++) {
      if (mat[i][j])
        printf("%d", j);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printmatrixtree>:
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    %r8d,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ba <printmatrixtree+0xaa>
mov    -0x1c(%rbp),%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    119e <printmatrixtree+0x8e>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     118b <printmatrixtree+0x7b>
mov    -0x20(%rbp),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1190 <printmatrixtree+0x80>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1154 <printmatrixtree+0x44>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1130 <printmatrixtree+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printmatrixtree>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,0x4(%rsp)
test   %esi,%esi
jle    11a2 <printmatrixtree+0x82>
mov    %rdi,%r13
mov    %esi,%r14d
mov    0x4(%rsp),%r15d
lea    0xed4(%rip),%r12
xor    %ebp,%ebp
jmp    1163 <printmatrixtree+0x43>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %r14,%rbp
je     11a2 <printmatrixtree+0x82>
lea    0xe96(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1150 <printmatrixtree+0x30>
xor    %ebx,%ebx
jmp    1189 <printmatrixtree+0x69>
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%r15
je     1150 <printmatrixtree+0x30>
mov    0x0(%r13,%rbp,8),%rax
cmpl   $0x0,(%rax,%rbx,4)
je     1180 <printmatrixtree+0x60>
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1180 <printmatrixtree+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0A Complementary size %d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @printmatrixtree(i32** %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32** %0, i32*** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store i32 0, i32* %11
br label %13
13: ; preds = %44, %5
%14 = load i32, i32* %11
%15 = load i32, i32* %7
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %47
17: ; preds = %13
%18 = load i32, i32* %11
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %18)
store i32 0, i32* %12
br label %20
20: ; preds = %39, %17
%21 = load i32, i32* %12
%22 = load i32, i32* %8
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %42
24: ; preds = %20
%25 = load i32**, i32*** %6
%26 = load i32, i32* %11
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32*, i32** %25, i64 %27
%29 = load i32*, i32** %28
%30 = load i32, i32* %12
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
%33 = load i32, i32* %32
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %24
%36 = load i32, i32* %12
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %35, %24
br label %39
39: ; preds = %38
%40 = load i32, i32* %12
%41 = add nsw i32 %40, 1
store i32 %41, i32* %12
br label %20
42: ; preds = %20
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %42
%45 = load i32, i32* %11
%46 = add nsw i32 %45, 1
store i32 %46, i32* %11
br label %13
47: ; preds = %13
ret void
}

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