#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 *sdsnew(char *);
char **zmalloc(int);
char **convertToSds(int count, char **args) {
  int j;
  char **sds = zmalloc(sizeof(char *) * count + 1);
  for (j = 0; j < count; j++)
    sds[j] = sdsnew(args[j]);
  return sds;
}


x86 assembly (clang, -O0):
<convertToSds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
add    $0x1,%rax
mov    %eax,%edi
call   1030 <zmalloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1187 <convertToSds+0x67>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <sdsnew@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <convertToSds+0x2d>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertToSds>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r15d
lea    0x1(,%r15,8),%edi
call   1030 <zmalloc@plt>
mov    %rax,%r12
test   %r15d,%r15d
jle    1166 <convertToSds+0x46>
mov    %r15d,%r15d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1040 <sdsnew@plt>
mov    %rax,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1150 <convertToSds+0x30>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8** @convertToSds(i32 %0, i8** nocapture %1) {
%3 = shl i32 %0, 3
%4 = or i32 %3, 1
%5 = tail call i8** @zmalloc(i32 %4)
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %17
7: ; preds = %2
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %15, %9 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i8* @sdsnew(i8* %12)
%14 = getelementptr inbounds i8*, i8** %5, i64 %10
store i8* %13, i8** %14
%15 = add nuw nsw i64 %10, 1
%16 = icmp eq i64 %15, %8
br i1 %16, label %17, label %9
17: ; preds = %9, %2
ret i8** %5
}