#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
void writeFile(FILE *out, int part, int sizes[], char *str_out[]) {
  int i = 0;
  while (i < sizes[part]) {
    putc(str_out[part][i++], out);
  }
  putc(EOF, out);
}


x86 assembly (clang, -O0):
<writeFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x18(%rbp),%rcx
movslq -0xc(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1170 <writeFile+0x60>
mov    -0x20(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x24(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <putc@plt>
jmp    112e <writeFile+0x1e>
mov    0x2e71(%rip),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <putc@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeFile>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r15
movslq %esi,%r13
cmpl   $0x0,(%rdx,%r13,4)
jle    114d <writeFile+0x3d>
mov    %rcx,%r14
mov    %rdx,%r12
xor    %ebx,%ebx
xchg   %ax,%ax
mov    (%r14,%r13,8),%rax
movsbl (%rax,%rbx,1),%edi
add    $0x1,%rbx
mov    %r15,%rsi
call   1030 <putc@plt>
movslq (%r12,%r13,4),%rax
cmp    %rax,%rbx
jl     1130 <writeFile+0x20>
mov    0x2e94(%rip),%rax
movsbl (%rax),%edi
mov    %r15,%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <putc@plt>

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

LLVM IR (-O2):
@EOF = global i8 0
define void @writeFile(i32* nocapture %0, i32 %1, i32* nocapture %2, i8** nocapture %3) {
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i32, i32* %2, i64 %5
%7 = load i32, i32* %6
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %4
%10 = getelementptr inbounds i8*, i8** %3, i64 %5
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %14, %11 ]
%13 = load i8*, i8** %10
%14 = add nuw nsw i64 %12, 1
%15 = getelementptr inbounds i8, i8* %13, i64 %12
%16 = load i8, i8* %15
%17 = tail call i32 @putc(i8 signext %16, i32* %0)
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %14, %19
br i1 %20, label %11, label %21
21: ; preds = %11, %4
%22 = load i8, i8* @EOF
%23 = tail call i32 @putc(i8 signext %22, i32* %0)
ret void
}