#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 */
typedef int /*<<< orphan*/ items;

/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char **provide() {
  char *items[] = {"abi", "accounting", NULL};
  char **arr = items;
  char **results = (char **)malloc(sizeof(char *) * sizeof(items));
  int i = 0;
  while (*arr) {
    results[i] = (char *)malloc(sizeof(char) * strlen(*arr));
    strcpy(results[i++], *arr);
    arr++;
  }
  return results;
}


x86 assembly (clang, -O0):
<provide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x2cc1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cbe(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cbb(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0xc0,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x28(%rbp),%rax
cmpq   $0x0,(%rax)
je     11df <provide+0xaf>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rdx
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x34(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
jmp    1176 <provide+0x46>
mov    -0x30(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<provide>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2cd2(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0x2cb6(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    $0xc0,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
lea    0xe9e(%rip),%rdi
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1040 <strlen@plt>
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,(%r14,%rbx,1)
mov    (%rsp,%rbx,1),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    0x8(%rsp,%rbx,1),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1170 <provide+0x40>
mov    %r14,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"abi\00"
@.str.1 = [11 x i8] c"accounting\00"
@__const.provide.items = [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i32 0, i32 0), i8* null]
define i8** @provide() {
%1 = alloca [3 x i8*]
%2 = alloca i8**
%3 = alloca i8**
%4 = alloca i32
%5 = bitcast [3 x i8*]* %1 to i8*
%6 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 0
store i8** %6, i8*** %2
%7 = call i64 @malloc(i32 192)
%8 = inttoptr i64 %7 to i8**
store i8** %8, i8*** %3
store i32 0, i32* %4
br label %9
9: ; preds = %13, %0
%10 = load i8**, i8*** %2
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %37
13: ; preds = %9
%14 = load i8**, i8*** %2
%15 = load i8*, i8** %14
%16 = call i32 @strlen(i8* %15)
%17 = sext i32 %16 to i64
%18 = mul i64 1, %17
%19 = trunc i64 %18 to i32
%20 = call i64 @malloc(i32 %19)
%21 = inttoptr i64 %20 to i8*
%22 = load i8**, i8*** %3
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
store i8* %21, i8** %25
%26 = load i8**, i8*** %3
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
%29 = sext i32 %27 to i64
%30 = getelementptr inbounds i8*, i8** %26, i64 %29
%31 = load i8*, i8** %30
%32 = load i8**, i8*** %2
%33 = load i8*, i8** %32
%34 = call i32 @strcpy(i8* %31, i8* %33)
%35 = load i8**, i8*** %2
%36 = getelementptr inbounds i8*, i8** %35, i32 1
store i8** %36, i8*** %2
br label %9
37: ; preds = %9
%38 = load i8**, i8*** %3
ret i8** %38
}

LLVM IR (-O2):
@.str = [4 x i8] c"abi\00"
@.str.1 = [11 x i8] c"accounting\00"
@__const.provide.items = [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i32 0, i32 0), i8* null]
define i8** @provide() {
%1 = alloca [3 x i8*]
%2 = bitcast [3 x i8*]* %1 to i8*
%3 = tail call i64 @malloc(i32 192)
%4 = inttoptr i64 %3 to i8**
%5 = getelementptr inbounds [3 x i8*], [3 x i8*]* %1, i64 0, i64 0
br label %6
6: ; preds = %0, %6
%7 = phi i64 [ 0, %0 ], [ %14, %6 ]
%8 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %0 ], [ %18, %6 ]
%9 = phi i8** [ %5, %0 ], [ %17, %6 ]
%10 = tail call i32 @strlen(i8* %8)
%11 = tail call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i8*
%13 = getelementptr inbounds i8*, i8** %4, i64 %7
store i8* %12, i8** %13
%14 = add nuw i64 %7, 1
%15 = load i8*, i8** %9
%16 = tail call i32 @strcpy(i8* %12, i8* %15)
%17 = getelementptr inbounds i8*, i8** %9, i64 1
%18 = load i8*, i8** %17
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %6
20: ; preds = %6
ret i8** %4
}