#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 pwr(int, int);
void table(int p[4][10]) {
  register int i, j;
  for (j = 1; j < 11; j++)
    for (i = 1; i < 5; i++)
      p[i - 1][j - 1] = pwr(j, i);
}


x86 assembly (clang, -O0):
<table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0xb,-0x10(%rbp)
jge    118c <table+0x7c>
movl   $0x1,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1179 <table+0x69>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <pwr@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <table+0x24>
jmp    117e <table+0x6e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1123 <table+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<table>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0xfffffffffffffff6,%rbx
xchg   %ax,%ax
lea    0xb(%rbx),%ebp
mov    %ebp,%edi
mov    $0x1,%esi
call   1030 <pwr@plt>
mov    %eax,0x28(%r14,%rbx,4)
mov    %ebp,%edi
mov    $0x2,%esi
call   1030 <pwr@plt>
mov    %eax,0x50(%r14,%rbx,4)
mov    %ebp,%edi
mov    $0x3,%esi
call   1030 <pwr@plt>
mov    %eax,0x78(%r14,%rbx,4)
mov    %ebp,%edi
mov    $0x4,%esi
call   1030 <pwr@plt>
mov    %eax,0xa0(%r14,%rbx,4)
inc    %rbx
jne    1120 <table+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @table([10 x i32]* %0) {
%2 = alloca [10 x i32]*
%3 = alloca i32
%4 = alloca i32
store [10 x i32]* %0, [10 x i32]** %2
store i32 1, i32* %4
br label %5
5: ; preds = %29, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 11
br i1 %7, label %8, label %32
8: ; preds = %5
store i32 1, i32* %3
br label %9
9: ; preds = %25, %8
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 5
br i1 %11, label %12, label %28
12: ; preds = %9
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = call i32 @pwr(i32 %13, i32 %14)
%16 = load [10 x i32]*, [10 x i32]** %2
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %16, i64 %19
%21 = load i32, i32* %4
%22 = sub nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %20, i64 0, i64 %23
store i32 %15, i32* %24
br label %25
25: ; preds = %12
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %9
28: ; preds = %9
br label %29
29: ; preds = %28
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %5
32: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @table([10 x i32]* nocapture writeonly %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 1, %1 ], [ %14, %2 ]
%4 = add nsw i64 %3, -1
%5 = trunc i64 %3 to i32
%6 = tail call i32 @pwr(i32 %5, i32 1)
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 0, i64 %4
store i32 %6, i32* %7
%8 = tail call i32 @pwr(i32 %5, i32 2)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 1, i64 %4
store i32 %8, i32* %9
%10 = tail call i32 @pwr(i32 %5, i32 3)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 2, i64 %4
store i32 %10, i32* %11
%12 = tail call i32 @pwr(i32 %5, i32 4)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 3, i64 %4
store i32 %12, i32* %13
%14 = add nuw nsw i64 %3, 1
%15 = icmp eq i64 %14, 11
br i1 %15, label %16, label %2
16: ; preds = %2
ret void
}