#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__ malloc(int);
char **allocate_possibles(int n) {
  int max_possible = 54 * n + 25;
  char **p = (char **)malloc(sizeof(char *) * max_possible);
  for (int i = 0; i < max_possible; i++) {
    p[i] = (char *)malloc(sizeof(char) * (n + 1));
  }
  return p;
}


x86 assembly (clang, -O0):
<allocate_possibles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
imul   $0x36,-0x4(%rbp),%eax
add    $0x19,%eax
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    117b <allocate_possibles+0x6b>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113f <allocate_possibles+0x2f>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocate_possibles>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
imul   $0x36,%edi,%ebx
lea    0xc8(,%rbx,8),%edi
call   1030 <malloc@plt>
mov    %rax,%r15
cmp    $0xffffffe8,%ebx
jl     1155 <allocate_possibles+0x45>
add    $0x19,%ebx
add    $0x1,%r14d
mov    %ebx,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14d,%edi
call   1030 <malloc@plt>
mov    %rax,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <allocate_possibles+0x30>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i8** @allocate_possibles(i32 %0) {
%2 = mul nsw i32 %0, 54
%3 = add nsw i32 %2, 25
%4 = shl i32 %3, 3
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8**
%7 = icmp sgt i32 %2, -25
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = add nsw i32 %0, 1
%10 = zext i32 %3 to i64
br label %12
11: ; preds = %12, %1
ret i8** %6
12: ; preds = %8, %12
%13 = phi i64 [ 0, %8 ], [ %17, %12 ]
%14 = tail call i64 @malloc(i32 %9)
%15 = inttoptr i64 %14 to i8*
%16 = getelementptr inbounds i8*, i8** %6, i64 %13
store i8* %15, i8** %16
%17 = add nuw nsw i64 %13, 1
%18 = icmp eq i64 %17, %10
br i1 %18, label %11, label %12
}