#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 p_ac_basis(int basis[100][250], int num_basis, int m, int n) {
  int i, j;
  printf("\nBasis has %d solutions.\n", num_basis);
  for (i = 0; i < num_basis; i++) {
    for (j = 0; j < m + n; j++)
      printf("%3d", basis[i][j]);
    printf("\n");
  }
  printf("Basis has %d solutions.\n", num_basis);
}


x86 assembly (clang, -O0):
<p_ac_basis>:
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),%esi
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b2 <p_ac_basis+0xa2>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    1196 <p_ac_basis+0x86>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0x3e8,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1150 <p_ac_basis+0x40>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113d <p_ac_basis+0x2d>
mov    -0xc(%rbp),%esi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p_ac_basis>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%rbp
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14d,0x4(%rsp)
test   %r14d,%r14d
jle    11ba <p_ac_basis+0x9a>
add    %r15d,%ebx
mov    0x4(%rsp),%r12d
lea    0xebd(%rip),%r15
xor    %r13d,%r13d
jmp    118a <p_ac_basis+0x6a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    $0x3e8,%rbp
cmp    %r12,%r13
je     11ba <p_ac_basis+0x9a>
test   %ebx,%ebx
jle    1170 <p_ac_basis+0x50>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp,%r14,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbx
jne    11a0 <p_ac_basis+0x80>
jmp    1170 <p_ac_basis+0x50>
lea    0xe40(%rip),%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

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

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