#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__ calloc(int, int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strcat(char *, char *);
char **push_back_and_free_origin(char **dest, char **origin) {
  int index_dest = -1;
  while (dest[++index_dest])
    ;
  int i = 1;
  while (origin[i]) {
    dest[index_dest] = (char *)calloc(100, sizeof(char));
    memset(dest[index_dest], 0, sizeof(*dest[index_dest]));
    strcat(dest[index_dest++], origin[i]);
    free(origin[i++]);
  }
  return dest;
}


x86 assembly (clang, -O0):
<push_back_and_free_origin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1177 <push_back_and_free_origin+0x37>
jmp    1157 <push_back_and_free_origin+0x17>
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     120e <push_back_and_free_origin+0xce>
mov    $0x64,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1060 <strcat@plt>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
jmp    117e <push_back_and_free_origin+0x3e>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<push_back_and_free_origin>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r14
xor    %eax,%eax
cmpq   $0x0,(%r14,%rax,8)
lea    0x1(%rax),%rax
jne    1150 <push_back_and_free_origin+0x10>
cmpq   $0x0,0x8(%r12)
je     11b6 <push_back_and_free_origin+0x76>
add    $0xffffffff,%eax
cltq
lea    (%r14,%rax,8),%r15
xor    %ebx,%ebx
xchg   %ax,%ax
mov    $0x64,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,(%r15,%rbx,1)
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    (%r15,%rbx,1),%rdi
mov    0x8(%r12,%rbx,1),%rsi
call   1060 <strcat@plt>
mov    0x8(%r12,%rbx,1),%rdi
call   1030 <free@plt>
cmpq   $0x0,0x10(%r12,%rbx,1)
lea    0x8(%rbx),%rbx
jne    1170 <push_back_and_free_origin+0x30>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8** @push_back_and_free_origin(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i8** %0, i8*** %3
store i8** %1, i8*** %4
store i32 -1, i32* %5
br label %7
7: ; preds = %15, %2
%8 = load i8**, i8*** %3
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 1
store i32 %10, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8*, i8** %8, i64 %11
%13 = load i8*, i8** %12
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %16
15: ; preds = %7
br label %7
16: ; preds = %7
store i32 1, i32* %6
br label %17
17: ; preds = %24, %16
%18 = load i8**, i8*** %4
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %56
24: ; preds = %17
%25 = call i64 @calloc(i32 100, i32 1)
%26 = inttoptr i64 %25 to i8*
%27 = load i8**, i8*** %3
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
store i8* %26, i8** %30
%31 = load i8**, i8*** %3
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %31, i64 %33
%35 = load i8*, i8** %34
%36 = call i32 @memset(i8* %35, i32 0, i32 1)
%37 = load i8**, i8*** %3
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
%40 = sext i32 %38 to i64
%41 = getelementptr inbounds i8*, i8** %37, i64 %40
%42 = load i8*, i8** %41
%43 = load i8**, i8*** %4
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %43, i64 %45
%47 = load i8*, i8** %46
%48 = call i32 @strcat(i8* %42, i8* %47)
%49 = load i8**, i8*** %4
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
%52 = sext i32 %50 to i64
%53 = getelementptr inbounds i8*, i8** %49, i64 %52
%54 = load i8*, i8** %53
%55 = call i32 @free(i8* %54)
br label %17
56: ; preds = %17
%57 = load i8**, i8*** %3
ret i8** %57
}

LLVM IR (-O2):
define i8** @push_back_and_free_origin(i8** returned %0, i8** nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %5, %3 ], [ -1, %2 ]
%5 = add nsw i64 %4, 1
%6 = getelementptr inbounds i8*, i8** %0, i64 %5
%7 = load i8*, i8** %6
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %34, label %13
13: ; preds = %9
%14 = shl i64 %5, 32
%15 = ashr exact i64 %14, 32
br label %16
16: ; preds = %13, %16
%17 = phi i64 [ %15, %13 ], [ %24, %16 ]
%18 = phi i64 [ 1, %13 ], [ %28, %16 ]
%19 = phi i8** [ %10, %13 ], [ %31, %16 ]
%20 = tail call i64 @calloc(i32 100, i32 1)
%21 = inttoptr i64 %20 to i8*
%22 = getelementptr inbounds i8*, i8** %0, i64 %17
store i8* %21, i8** %22
%23 = tail call i32 @memset(i8* %21, i32 0, i32 1)
%24 = add i64 %17, 1
%25 = load i8*, i8** %22
%26 = load i8*, i8** %19
%27 = tail call i32 @strcat(i8* %25, i8* %26)
%28 = add nuw i64 %18, 1
%29 = load i8*, i8** %19
%30 = tail call i32 @free(i8* %29)
%31 = getelementptr inbounds i8*, i8** %1, i64 %28
%32 = load i8*, i8** %31
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %16
34: ; preds = %16, %9
ret i8** %0
}