#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);
void createStringOfSize(int size, char *str_in[], char **str_out[]) {
  *str_in = (char *)malloc(size);
  int i;
  for (i = 0; i < 8; i++) {
    *str_out[i] = (char *)malloc(size / 8 + size % 8);
  }
}


x86 assembly (clang, -O0):
<createStringOfSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    1185 <createStringOfSize+0x75>
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    %edx,%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rdx
mov    (%rax,%rdx,8),%rax
mov    %rcx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113c <createStringOfSize+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createStringOfSize>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbp
mov    %edi,%ebx
call   1030 <malloc@plt>
mov    %rax,0x0(%rbp)
lea    0x7(%rbx),%ebp
test   %ebx,%ebx
cmovns %ebx,%ebp
mov    %ebp,%eax
and    $0xfffffff8,%eax
sub    %eax,%ebx
sar    $0x3,%ebp
add    %ebx,%ebp
mov    %ebp,%edi
call   1030 <malloc@plt>
mov    (%r14),%rcx
mov    %rax,(%rcx)
mov    %ebp,%edi
call   1030 <malloc@plt>
mov    0x8(%r14),%rcx
mov    %rax,(%rcx)
mov    %ebp,%edi
call   1030 <malloc@plt>
mov    0x10(%r14),%rcx
mov    %rax,(%rcx)
mov    %ebp,%edi
call   1030 <malloc@plt>
mov    0x18(%r14),%rcx
mov    %rax,(%rcx)
mov    %ebp,%edi
call   1030 <malloc@plt>
mov    0x20(%r14),%rcx
mov    %rax,(%rcx)
mov    %ebp,%edi
call   1030 <malloc@plt>
mov    0x28(%r14),%rcx
mov    %rax,(%rcx)
mov    %ebp,%edi
call   1030 <malloc@plt>
mov    0x30(%r14),%rcx
mov    %rax,(%rcx)
mov    %ebp,%edi
call   1030 <malloc@plt>
mov    0x38(%r14),%rcx
mov    %rax,(%rcx)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @createStringOfSize(i32 %0, i8** nocapture writeonly %1, i8*** nocapture %2) {
%4 = tail call i64 @malloc(i32 %0)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %1
%6 = sdiv i32 %0, 8
%7 = srem i32 %0, 8
%8 = add nsw i32 %6, %7
%9 = tail call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i8*
%11 = load i8**, i8*** %2
store i8* %10, i8** %11
%12 = tail call i64 @malloc(i32 %8)
%13 = inttoptr i64 %12 to i8*
%14 = getelementptr inbounds i8**, i8*** %2, i64 1
%15 = load i8**, i8*** %14
store i8* %13, i8** %15
%16 = tail call i64 @malloc(i32 %8)
%17 = inttoptr i64 %16 to i8*
%18 = getelementptr inbounds i8**, i8*** %2, i64 2
%19 = load i8**, i8*** %18
store i8* %17, i8** %19
%20 = tail call i64 @malloc(i32 %8)
%21 = inttoptr i64 %20 to i8*
%22 = getelementptr inbounds i8**, i8*** %2, i64 3
%23 = load i8**, i8*** %22
store i8* %21, i8** %23
%24 = tail call i64 @malloc(i32 %8)
%25 = inttoptr i64 %24 to i8*
%26 = getelementptr inbounds i8**, i8*** %2, i64 4
%27 = load i8**, i8*** %26
store i8* %25, i8** %27
%28 = tail call i64 @malloc(i32 %8)
%29 = inttoptr i64 %28 to i8*
%30 = getelementptr inbounds i8**, i8*** %2, i64 5
%31 = load i8**, i8*** %30
store i8* %29, i8** %31
%32 = tail call i64 @malloc(i32 %8)
%33 = inttoptr i64 %32 to i8*
%34 = getelementptr inbounds i8**, i8*** %2, i64 6
%35 = load i8**, i8*** %34
store i8* %33, i8** %35
%36 = tail call i64 @malloc(i32 %8)
%37 = inttoptr i64 %36 to i8*
%38 = getelementptr inbounds i8**, i8*** %2, i64 7
%39 = load i8**, i8*** %38
store i8* %37, i8** %39
ret void
}