#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 **a2c(char ma[][10]) {
  char **res = (char **)malloc(sizeof(char *) * 9);
  int i;
  for (i = 0; i < 9; i++) {
    res[i] = ma[i];
  }
  return res;
}


x86 assembly (clang, -O0):
<a2c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x48,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x9,-0x14(%rbp)
jge    1164 <a2c+0x54>
mov    -0x8(%rbp),%rdx
movslq -0x14(%rbp),%rax
imul   $0xa,%rax,%rax
add    %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    1131 <a2c+0x21>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a2c>:
push   %rbx
mov    %rdi,%rbx
mov    $0x48,%edi
call   1030 <malloc@plt>
mov    %rbx,(%rax)
lea    0xa(%rbx),%rcx
mov    %rcx,0x8(%rax)
lea    0x14(%rbx),%rcx
mov    %rcx,0x10(%rax)
lea    0x1e(%rbx),%rcx
mov    %rcx,0x18(%rax)
lea    0x28(%rbx),%rcx
mov    %rcx,0x20(%rax)
lea    0x32(%rbx),%rcx
mov    %rcx,0x28(%rax)
lea    0x3c(%rbx),%rcx
mov    %rcx,0x30(%rax)
lea    0x46(%rbx),%rcx
mov    %rcx,0x38(%rax)
add    $0x50,%rbx
mov    %rbx,0x40(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i8** @a2c([10 x i8]* %0) {
%2 = alloca [10 x i8]*
%3 = alloca i8**
%4 = alloca i32
store [10 x i8]* %0, [10 x i8]** %2
%5 = call i64 @malloc(i32 72)
%6 = inttoptr i64 %5 to i8**
store i8** %6, i8*** %3
store i32 0, i32* %4
br label %7
7: ; preds = %20, %1
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 9
br i1 %9, label %10, label %23
10: ; preds = %7
%11 = load [10 x i8]*, [10 x i8]** %2
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %11, i64 %13
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%16 = load i8**, i8*** %3
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
store i8* %15, i8** %19
br label %20
20: ; preds = %10
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %7
23: ; preds = %7
%24 = load i8**, i8*** %3
ret i8** %24
}

LLVM IR (-O2):
define i8** @a2c([10 x i8]* %0) {
%2 = tail call i64 @malloc(i32 72)
%3 = inttoptr i64 %2 to i8**
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %0, i64 0, i64 0
store i8* %4, i8** %3
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %0, i64 1, i64 0
%6 = getelementptr inbounds i8*, i8** %3, i64 1
store i8* %5, i8** %6
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %0, i64 2, i64 0
%8 = getelementptr inbounds i8*, i8** %3, i64 2
store i8* %7, i8** %8
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %0, i64 3, i64 0
%10 = getelementptr inbounds i8*, i8** %3, i64 3
store i8* %9, i8** %10
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %0, i64 4, i64 0
%12 = getelementptr inbounds i8*, i8** %3, i64 4
store i8* %11, i8** %12
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %0, i64 5, i64 0
%14 = getelementptr inbounds i8*, i8** %3, i64 5
store i8* %13, i8** %14
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %0, i64 6, i64 0
%16 = getelementptr inbounds i8*, i8** %3, i64 6
store i8* %15, i8** %16
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %0, i64 7, i64 0
%18 = getelementptr inbounds i8*, i8** %3, i64 7
store i8* %17, i8** %18
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %0, i64 8, i64 0
%20 = getelementptr inbounds i8*, i8** %3, i64 8
store i8* %19, i8** %20
ret i8** %3
}