#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 {
  char *iov_base;
  int iov_len;
};
typedef int /*<<< orphan*/ str3;
typedef int /*<<< orphan*/ str2;
typedef int /*<<< orphan*/ str1;

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ writev(int, struct iovec *, int);
int main(int argc, char *argv[]) {
  char str2[] = "This is mango speaking";
  char str3[] = "!!!!";
  char str1[] = "Hello, ";
  struct iovec iov[3];
  iov[0].iov_base = str1;
  iov[0].iov_len = sizeof(str1);
  iov[1].iov_base = str2;
  iov[1].iov_len = sizeof(str2);
  iov[2].iov_base = str3;
  iov[2].iov_len = sizeof(str3);
  writev(1, iov, 3);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebe(%rip),%eax
mov    %eax,-0x20(%rbp)
mov    0xeb8(%rip),%ax
mov    %ax,-0x1c(%rbp)
mov    0xeb0(%rip),%al
mov    %al,-0x1a(%rbp)
mov    0xea8(%rip),%eax
mov    %eax,-0x35(%rbp)
mov    0xea3(%rip),%al
mov    %al,-0x31(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x3d(%rbp)
lea    -0x3d(%rbp),%rax
mov    %rax,-0x70(%rbp)
movl   $0x8,-0x68(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
movl   $0x17,-0x58(%rbp)
lea    -0x35(%rbp),%rax
mov    %rax,-0x50(%rbp)
movl   $0x5,-0x48(%rbp)
lea    -0x70(%rbp),%rsi
mov    $0x1,%edi
mov    $0x3,%edx
call   1030 <writev@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movabs $0x676e696b616570,%rax
mov    %rax,0x4f(%rsp)
movb   $0x0,0x4(%rsp)
movl   $0x21212121,(%rsp)
movabs $0x202c6f6c6c6548,%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rax
mov    %rax,0x10(%rsp)
movl   $0x8,0x18(%rsp)
lea    0x40(%rsp),%rax
mov    %rax,0x20(%rsp)
movl   $0x17,0x28(%rsp)
mov    %rsp,%rax
mov    %rax,0x30(%rsp)
movl   $0x5,0x38(%rsp)
lea    0x10(%rsp),%rsi
mov    $0x1,%edi
mov    $0x3,%edx
call   1030 <writev@plt>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
%struct.iovec = type { i8*, i32 }
@__const.main.str2 = [23 x i8] c"This is mango speaking\00"
@__const.main.str3 = [5 x i8] c"!!!!\00"
@__const.main.str1 = [8 x i8] c"Hello, \00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [23 x i8]
%7 = alloca [5 x i8]
%8 = alloca [8 x i8]
%9 = alloca [3 x %struct.iovec]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [23 x i8]* %6 to i8*
%11 = bitcast [5 x i8]* %7 to i8*
%12 = bitcast [8 x i8]* %8 to i8*
%13 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%14 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %9, i64 0, i64 0
%15 = getelementptr inbounds %struct.iovec, %struct.iovec* %14, i32 0, i32 0
store i8* %13, i8** %15
%16 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %9, i64 0, i64 0
%17 = getelementptr inbounds %struct.iovec, %struct.iovec* %16, i32 0, i32 1
store i32 8, i32* %17
%18 = getelementptr inbounds [23 x i8], [23 x i8]* %6, i64 0, i64 0
%19 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %9, i64 0, i64 1
%20 = getelementptr inbounds %struct.iovec, %struct.iovec* %19, i32 0, i32 0
store i8* %18, i8** %20
%21 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %9, i64 0, i64 1
%22 = getelementptr inbounds %struct.iovec, %struct.iovec* %21, i32 0, i32 1
store i32 23, i32* %22
%23 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%24 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %9, i64 0, i64 2
%25 = getelementptr inbounds %struct.iovec, %struct.iovec* %24, i32 0, i32 0
store i8* %23, i8** %25
%26 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %9, i64 0, i64 2
%27 = getelementptr inbounds %struct.iovec, %struct.iovec* %26, i32 0, i32 1
store i32 5, i32* %27
%28 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %9, i64 0, i64 0
%29 = call i32 @writev(i32 1, %struct.iovec* %28, i32 3)
%30 = load i32, i32* @EXIT_SUCCESS
%31 = call i32 @exit(i32 %30)
unreachable
}

LLVM IR (-O2):
%struct.iovec = type { i8*, i32 }
@__const.main.str2 = [23 x i8] c"This is mango speaking\00"
@__const.main.str3 = [5 x i8] c"!!!!\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [23 x i8]
%4 = alloca [5 x i8]
%5 = alloca i64
%6 = alloca [3 x %struct.iovec]
%7 = getelementptr inbounds [23 x i8], [23 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%9 = bitcast i64* %5 to i8*
store i64 9056056326776136, i64* %5
%10 = bitcast [3 x %struct.iovec]* %6 to i8*
%11 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %6, i64 0, i64 0
%12 = bitcast [3 x %struct.iovec]* %6 to i64**
store i64* %5, i64** %12
%13 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %6, i64 0, i64 0, i32 1
store i32 8, i32* %13
%14 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %6, i64 0, i64 1, i32 0
store i8* %7, i8** %14
%15 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %6, i64 0, i64 1, i32 1
store i32 23, i32* %15
%16 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %6, i64 0, i64 2, i32 0
store i8* %8, i8** %16
%17 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %6, i64 0, i64 2, i32 1
store i32 5, i32* %17
%18 = call i32 @writev(i32 1, %struct.iovec* %11, i32 3)
%19 = load i32, i32* @EXIT_SUCCESS
%20 = call i32 @exit(i32 %19)
unreachable
}