#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 */
struct ent_vec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ent_add(struct ent_vec *, char *, int);
int /*<<< orphan*/ ent_resize(struct ent_vec *, size_t);
void ent_args(struct ent_vec *self, int count, char *values[]) {
  int ind;
  ent_resize(self, (size_t)count);
  for (ind = 0; ind < count; ind++) {
    ent_add(self, values[ind], false);
  }
}


x86 assembly (clang, -O0):
<ent_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rsi
call   1030 <ent_resize@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1178 <ent_args+0x58>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
xor    %edx,%edx
call   1040 <ent_add@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1147 <ent_args+0x27>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ent_args>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%r12
movslq %esi,%rbp
mov    %rbp,%rsi
call   1030 <ent_resize@plt>
test   %ebp,%ebp
jle    1167 <ent_args+0x47>
mov    %r15d,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rsi
mov    %r12,%rdi
xor    %edx,%edx
call   1040 <ent_add@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <ent_args+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ent_vec = type { i32 }
define void @ent_args(%struct.ent_vec* %0, i32 %1, i8** %2) {
%4 = alloca %struct.ent_vec*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
store %struct.ent_vec* %0, %struct.ent_vec** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%8 = load %struct.ent_vec*, %struct.ent_vec** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = call i32 @ent_resize(%struct.ent_vec* %8, i64 %10)
store i32 0, i32* %7
br label %12
12: ; preds = %24, %3
%13 = load i32, i32* %7
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %27
16: ; preds = %12
%17 = load %struct.ent_vec*, %struct.ent_vec** %4
%18 = load i8**, i8*** %6
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @ent_add(%struct.ent_vec* %17, i8* %22, i32 0)
br label %24
24: ; preds = %16
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %12
27: ; preds = %12
ret void
}

LLVM IR (-O2):
%struct.ent_vec = type { i32 }
define void @ent_args(%struct.ent_vec* %0, i32 %1, i8** nocapture %2) {
%4 = sext i32 %1 to i64
%5 = tail call i32 @ent_resize(%struct.ent_vec* %0, i64 %4)
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %16
7: ; preds = %3
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %14, %9 ]
%11 = getelementptr inbounds i8*, i8** %2, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i32 @ent_add(%struct.ent_vec* %0, i8* %12, i32 0)
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, %8
br i1 %15, label %16, label %9
16: ; preds = %9, %3
ret void
}