#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 size, char *str_out[]) {
  int i = 0;
  while (i < size) {
    putc(str_out[part][i++], out);
  }
  putc(EOF, out);
}


x86 assembly (clang, -O0):
<writeFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1167 <writeFile+0x57>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <putc@plt>
jmp    112d <writeFile+0x1d>
mov    0x2e7a(%rip),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1030 <putc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeFile>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r15
test   %edx,%edx
jle    1149 <writeFile+0x39>
mov    %rcx,%r14
movslq %esi,%r12
mov    %edx,%r13d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%r12,8),%rax
movsbl (%rax,%rbx,1),%edi
add    $0x1,%rbx
mov    %r15,%rsi
call   1030 <putc@plt>
cmp    %rbx,%r13
jne    1130 <writeFile+0x20>
mov    0x2e98(%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 = %14, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %7
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load i8**, i8*** %8
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = load i32, i32* %9
%21 = add nsw i32 %20, 1
store i32 %21, i32* %9
%22 = sext i32 %20 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
%24 = load i8, i8* %23
%25 = load i32*, i32** %5
%26 = call i32 @putc(i8 signext %24, i32* %25)
br label %10
27: ; preds = %10
%28 = load i8, i8* @EOF
%29 = load i32*, i32** %5
%30 = call i32 @putc(i8 signext %28, i32* %29)
ret void
}

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