#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 iovec {
  int iov_len;
  int /*<<< orphan*/ iov_base;
};

/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ write(int /*<<< orphan*/, int /*<<< orphan*/, int);
void print_cadena(struct iovec *iov, int tam_array) {
  int i;
  for (i = 0; i < tam_array; i++) {
    write(STDOUT_FILENO, iov[i].iov_base, (iov[i].iov_len) * sizeof(char));
  }
}


x86 assembly (clang, -O0):
<print_cadena>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    116c <print_cadena+0x5c>
mov    0x2eb7(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    0x4(%rax,%rcx,8),%esi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movslq (%rax,%rcx,8),%rax
shl    $0x0,%rax
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_cadena+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_cadena>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    114b <print_cadena+0x3b>
mov    %rdi,%r15
mov    %esi,%r14d
xor    %ebx,%ebx
mov    0x2ec5(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    (%r12),%edi
mov    (%r15,%rbx,8),%edx
mov    0x4(%r15,%rbx,8),%esi
call   1030 <write@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <print_cadena+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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