int readlines(char *lineptr[], int nlines) {
  char *lines[] = {"asdfsf", "fhcgfh", "bdsff", "dsf",
                   "aaa",    "fddf",   "zzz",   "dsf"};
  int cnt = 8;
  int i;
  for (i = 0; i < cnt; i++) {
    lineptr[i] = lines[i];
  }
  return cnt;
}


x86 assembly (clang, -O0):
<readlines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x50(%rbp),%rdi
lea    0x2cb6(%rip),%rsi
mov    $0x40,%edx
call   1030 <memcpy@plt>
movl   $0x8,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    1171 <readlines+0x61>
movslq -0x58(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdx
mov    -0x8(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1142 <readlines+0x32>
mov    -0x54(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readlines>:
movaps 0x2d39(%rip),%xmm0
movups %xmm0,0x30(%rdi)
movaps 0x2d1e(%rip),%xmm0
movups %xmm0,0x20(%rdi)
movaps 0x2d03(%rip),%xmm0
movups %xmm0,0x10(%rdi)
movaps 0x2ce8(%rip),%xmm0
movups %xmm0,(%rdi)
mov    $0x8,%eax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"asdfsf\00"
@.str.1 = [7 x i8] c"fhcgfh\00"
@.str.2 = [6 x i8] c"bdsff\00"
@.str.3 = [4 x i8] c"dsf\00"
@.str.4 = [4 x i8] c"aaa\00"
@.str.5 = [5 x i8] c"fddf\00"
@.str.6 = [4 x i8] c"zzz\00"
@__const.readlines.lines = [8 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0)]
define i32 @readlines(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca [8 x i8*]
%6 = alloca i32
%7 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%8 = bitcast [8 x i8*]* %5 to i8*
store i32 8, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %22, %2
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %25
13: ; preds = %9
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [8 x i8*], [8 x i8*]* %5, i64 0, i64 %15
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %3
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
store i8* %17, i8** %21
br label %22
22: ; preds = %13
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
store i32 %24, i32* %7
br label %9
25: ; preds = %9
%26 = load i32, i32* %6
ret i32 %26
}

LLVM IR (-O2):
@.str = [7 x i8] c"asdfsf\00"
@.str.1 = [7 x i8] c"fhcgfh\00"
@.str.2 = [6 x i8] c"bdsff\00"
@.str.3 = [4 x i8] c"dsf\00"
@.str.4 = [4 x i8] c"aaa\00"
@.str.5 = [5 x i8] c"fddf\00"
@.str.6 = [4 x i8] c"zzz\00"
@__const.readlines.lines = [8 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0)]
define i32 @readlines(i8** nocapture writeonly %0, i32 %1) {
%3 = bitcast i8** %0 to i8*
ret i32 8
}