#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 */
int /*<<< orphan*/ strlen(char const *);
scalar_t__ write(int, char const *, int /*<<< orphan*/);
void write_message(int fd, const char *p1, const char *p2, const char *p3,
                   const char *p4) {
  int ret = 0;
  if (p1)
    ret += write(fd, p1, strlen(p1));
  if (p2)
    ret += write(fd, p2, strlen(p2));
  if (p3)
    ret += write(fd, p3, strlen(p3));
  if (p4)
    ret += write(fd, p4, strlen(p4));
}


x86 assembly (clang, -O0):
<write_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     117f <write_message+0x5f>
mov    -0x4(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %rax,%rcx
movslq -0x2c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11bc <write_message+0x9c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x4c(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %rax,%rcx
movslq -0x2c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2c(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11f9 <write_message+0xd9>
mov    -0x4(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %rax,%rcx
movslq -0x2c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2c(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1236 <write_message+0x116>
mov    -0x4(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %rax,%rcx
movslq -0x2c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2c(%rbp)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_message>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8,%r14
mov    %rcx,%r12
mov    %rdx,%rbp
mov    %edi,%r15d
test   %rsi,%rsi
je     1151 <write_message+0x31>
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
test   %rbp,%rbp
je     116b <write_message+0x4b>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %r15d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <write@plt>
test   %r12,%r12
je     1185 <write_message+0x65>
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %r15d,%edi
mov    %r12,%rsi
mov    %eax,%edx
call   1030 <write@plt>
test   %r14,%r14
je     11a7 <write_message+0x87>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %r15d,%edi
mov    %r14,%rsi
mov    %eax,%edx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <write@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @write_message(i32 %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
store i32 %0, i32* %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
store i32 0, i32* %11
%12 = load i8*, i8** %7
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %24
14: ; preds = %5
%15 = load i32, i32* %6
%16 = load i8*, i8** %7
%17 = load i8*, i8** %7
%18 = call i32 @strlen(i8* %17)
%19 = call i64 @write(i32 %15, i8* %16, i32 %18)
%20 = load i32, i32* %11
%21 = sext i32 %20 to i64
%22 = add nsw i64 %21, %19
%23 = trunc i64 %22 to i32
store i32 %23, i32* %11
br label %24
24: ; preds = %14, %5
%25 = load i8*, i8** %8
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %37
27: ; preds = %24
%28 = load i32, i32* %6
%29 = load i8*, i8** %8
%30 = load i8*, i8** %8
%31 = call i32 @strlen(i8* %30)
%32 = call i64 @write(i32 %28, i8* %29, i32 %31)
%33 = load i32, i32* %11
%34 = sext i32 %33 to i64
%35 = add nsw i64 %34, %32
%36 = trunc i64 %35 to i32
store i32 %36, i32* %11
br label %37
37: ; preds = %27, %24
%38 = load i8*, i8** %9
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %50
40: ; preds = %37
%41 = load i32, i32* %6
%42 = load i8*, i8** %9
%43 = load i8*, i8** %9
%44 = call i32 @strlen(i8* %43)
%45 = call i64 @write(i32 %41, i8* %42, i32 %44)
%46 = load i32, i32* %11
%47 = sext i32 %46 to i64
%48 = add nsw i64 %47, %45
%49 = trunc i64 %48 to i32
store i32 %49, i32* %11
br label %50
50: ; preds = %40, %37
%51 = load i8*, i8** %10
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %63
53: ; preds = %50
%54 = load i32, i32* %6
%55 = load i8*, i8** %10
%56 = load i8*, i8** %10
%57 = call i32 @strlen(i8* %56)
%58 = call i64 @write(i32 %54, i8* %55, i32 %57)
%59 = load i32, i32* %11
%60 = sext i32 %59 to i64
%61 = add nsw i64 %60, %58
%62 = trunc i64 %61 to i32
store i32 %62, i32* %11
br label %63
63: ; preds = %53, %50
ret void
}

LLVM IR (-O2):
define void @write_message(i32 %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = icmp eq i8* %1, null
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = tail call i32 @strlen(i8* %1)
%9 = tail call i64 @write(i32 %0, i8* %1, i32 %8)
br label %10
10: ; preds = %7, %5
%11 = icmp eq i8* %2, null
br i1 %11, label %15, label %12
12: ; preds = %10
%13 = tail call i32 @strlen(i8* %2)
%14 = tail call i64 @write(i32 %0, i8* %2, i32 %13)
br label %15
15: ; preds = %12, %10
%16 = icmp eq i8* %3, null
br i1 %16, label %20, label %17
17: ; preds = %15
%18 = tail call i32 @strlen(i8* %3)
%19 = tail call i64 @write(i32 %0, i8* %3, i32 %18)
br label %20
20: ; preds = %17, %15
%21 = icmp eq i8* %4, null
br i1 %21, label %25, label %22
22: ; preds = %20
%23 = tail call i32 @strlen(i8* %4)
%24 = tail call i64 @write(i32 %0, i8* %4, i32 %23)
br label %25
25: ; preds = %22, %20
ret void
}