#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 */
scalar_t__ pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int table_of_powers() {
  int n = -2048;
  scanf("%i", &n);
  for (int k = 0; k < n; k++) {
    for (int a = 1; a < n; a++) {
      printf("%li ", ((long)pow(a, k)) % n);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<table_of_powers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xfffff800,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c4 <table_of_powers+0x94>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a8 <table_of_powers+0x78>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <pow@plt>
movslq -0x4(%rbp),%rcx
cqto
idiv   %rcx
mov    %rdx,%rsi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1169 <table_of_powers+0x39>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <table_of_powers+0x26>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<table_of_powers>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0xfffff800,0xc(%rsp)
ff
lea    0xea9(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11ed <table_of_powers+0xad>
lea    0xe8f(%rip),%r14
xor    %ebp,%ebp
jmp    1195 <table_of_powers+0x55>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    0xc(%rsp),%eax
cmp    %eax,%ebp
jge    11ed <table_of_powers+0xad>
mov    $0x1,%ebx
cmp    $0x1,%eax
jg     11cb <table_of_powers+0x8b>
jmp    1180 <table_of_powers+0x40>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cqto
idiv   %rcx
mov    %rdx,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jge    1180 <table_of_powers+0x40>
mov    %ebx,%edi
mov    %ebp,%esi
call   1060 <pow@plt>
movslq 0xc(%rsp),%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    11b0 <table_of_powers+0x70>
xor    %edx,%edx
div    %ecx
mov    %edx,%esi
jmp    11b8 <table_of_powers+0x78>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
@.str.1 = [5 x i8] c"%li \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @table_of_powers() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 -2048, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
store i32 0, i32* %2
br label %5
5: ; preds = %27, %0
%6 = load i32, i32* %2
%7 = load i32, i32* %1
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %30
9: ; preds = %5
store i32 1, i32* %3
br label %10
10: ; preds = %22, %9
%11 = load i32, i32* %3
%12 = load i32, i32* %1
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %25
14: ; preds = %10
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = call i64 @pow(i32 %15, i32 %16)
%18 = load i32, i32* %1
%19 = sext i32 %18 to i64
%20 = srem i64 %17, %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %20)
br label %22
22: ; preds = %14
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %10
25: ; preds = %10
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %5
30: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@.str.1 = [5 x i8] c"%li \00"
define i32 @table_of_powers() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 -2048, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %0, %11
%7 = phi i32 [ %14, %11 ], [ %4, %0 ]
%8 = phi i32 [ %13, %11 ], [ 0, %0 ]
%9 = icmp sgt i32 %7, 1
br i1 %9, label %16, label %11
10: ; preds = %11, %0
ret i32 0
11: ; preds = %16, %6
%12 = call i32 @putchar(i32 10)
%13 = add nuw nsw i32 %8, 1
%14 = load i32, i32* %1
%15 = icmp slt i32 %13, %14
br i1 %15, label %6, label %10
16: ; preds = %6, %16
%17 = phi i32 [ %23, %16 ], [ 1, %6 ]
%18 = call i64 @pow(i32 %17, i32 %8)
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = srem i64 %18, %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %21)
%23 = add nuw nsw i32 %17, 1
%24 = load i32, i32* %1
%25 = icmp slt i32 %23, %24
br i1 %25, label %16, label %11
}