#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 */
char *gu_str_append(char *, size_t *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
char *gu_str_table_set_cols(char *str, size_t *off, size_t n,
                            const char const *cols[]) {
  size_t i;
  for (i = 0; i < n; ++i) {
    str = gu_str_append(str, off, cols[i], strlen(cols[i]));
  }
  return str;
}


x86 assembly (clang, -O0):
<gu_str_table_set_cols>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11a7 <gu_str_table_set_cols+0x87>
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    %eax,%ecx
call   1040 <gu_str_append@plt>
mov    %rax,-0x8(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1140 <gu_str_table_set_cols+0x20>
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gu_str_table_set_cols>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
test   %rdx,%rdx
je     1168 <gu_str_table_set_cols+0x48>
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
xor    %ebp,%ebp
xchg   %ax,%ax
mov    (%r14,%rbp,8),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1040 <gu_str_append@plt>
mov    %rax,%r13
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1140 <gu_str_table_set_cols+0x20>
mov    %r13,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @gu_str_table_set_cols(i8* %0, i64* %1, i64 %2, i8** nocapture %3) {
%5 = icmp eq i64 %2, 0
br i1 %5, label %15, label %6
6: ; preds = %4, %6
%7 = phi i64 [ %13, %6 ], [ 0, %4 ]
%8 = phi i8* [ %12, %6 ], [ %0, %4 ]
%9 = getelementptr inbounds i8*, i8** %3, i64 %7
%10 = load i8*, i8** %9
%11 = tail call i32 @strlen(i8* %10)
%12 = tail call i8* @gu_str_append(i8* %8, i64* %1, i8* %10, i32 %11)
%13 = add nuw i64 %7, 1
%14 = icmp eq i64 %13, %2
br i1 %14, label %15, label %6
15: ; preds = %6, %4
%16 = phi i8* [ %0, %4 ], [ %12, %6 ]
ret i8* %16
}