#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 atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int n = 0, i = 0, j = 0;
  if (argc < 2) {
    printf("usage: ./%s N\n", argv[0]);
    return 0;
  }
  n = atoi(argv[1]);
  printf("%d\n", n);
  for (i = 0; i < n; ++i) {
    for (j = 0; j < n; ++j) {
      if (j != i)
        printf("%d ", j + 1);
    }
    printf("-1\n");
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1176 <main+0x56>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1221 <main+0x101>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    120c <main+0xec>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f0 <main+0xd0>
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     11dd <main+0xbd>
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e2 <main+0xc2>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b1 <main+0x91>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119e <main+0x7e>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x1,%edi
jg     1166 <main+0x26>
mov    (%rsi),%rsi
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11f1 <main+0xb1>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%r15d
lea    0xe96(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r15d,%r15d
jle    11e7 <main+0xa7>
mov    %r15d,%r13d
neg    %r13d
lea    0xe7f(%rip),%r12
xor    %ebx,%ebx
xor    %r14d,%r14d
jmp    11b8 <main+0x78>
nopl   0x0(%rax,%rax,1)
lea    0xe70(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r14d
add    $0xffffffff,%ebx
cmp    %r15d,%r14d
je     11e7 <main+0xa7>
mov    $0x1,%ebp
jmp    11d1 <main+0x91>
nop
lea    0x1(%r13,%rbp,1),%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
je     11a0 <main+0x60>
lea    (%rbx,%rbp,1),%eax
cmp    $0x1,%eax
je     11c0 <main+0x80>
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11c0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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