#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*/ rewind_tape(int);
int /*<<< orphan*/ space_forward_block(int, int);
int /*<<< orphan*/ space_forward_filemark(int, int);
int /*<<< orphan*/ write_block(int, int);
int /*<<< orphan*/ write_filemarks(int, int);
void write_tape_pattern_2(int fd) {
  rewind_tape(fd);
  space_forward_filemark(fd, 1);
  space_forward_block(fd, 5);
  write_block(fd, 128 * 1024);
  write_block(fd, 128 * 1024);
  write_block(fd, 128 * 1024);
  write_filemarks(fd, 1);
  write_block(fd, 128 * 1024);
  write_filemarks(fd, 1);
  write_block(fd, 128 * 1024);
  write_filemarks(fd, 2);
}


x86 assembly (clang, -O0):
<write_tape_pattern_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <rewind_tape@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1070 <space_forward_filemark@plt>
mov    -0x4(%rbp),%edi
mov    $0x5,%esi
call   1060 <space_forward_block@plt>
mov    -0x4(%rbp),%edi
mov    $0x20000,%esi
call   1030 <write_block@plt>
mov    -0x4(%rbp),%edi
mov    $0x20000,%esi
call   1030 <write_block@plt>
mov    -0x4(%rbp),%edi
mov    $0x20000,%esi
call   1030 <write_block@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1040 <write_filemarks@plt>
mov    -0x4(%rbp),%edi
mov    $0x20000,%esi
call   1030 <write_block@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1040 <write_filemarks@plt>
mov    -0x4(%rbp),%edi
mov    $0x20000,%esi
call   1030 <write_block@plt>
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1040 <write_filemarks@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_tape_pattern_2>:
push   %rbx
mov    %edi,%ebx
call   1050 <rewind_tape@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1070 <space_forward_filemark@plt>
mov    %ebx,%edi
mov    $0x5,%esi
call   1060 <space_forward_block@plt>
mov    %ebx,%edi
mov    $0x20000,%esi
call   1030 <write_block@plt>
mov    %ebx,%edi
mov    $0x20000,%esi
call   1030 <write_block@plt>
mov    %ebx,%edi
mov    $0x20000,%esi
call   1030 <write_block@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1040 <write_filemarks@plt>
mov    %ebx,%edi
mov    $0x20000,%esi
call   1030 <write_block@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1040 <write_filemarks@plt>
mov    %ebx,%edi
mov    $0x20000,%esi
call   1030 <write_block@plt>
mov    %ebx,%edi
mov    $0x2,%esi
pop    %rbx
jmp    1040 <write_filemarks@plt>

LLVM IR (-O0):
define void @write_tape_pattern_2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @rewind_tape(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @space_forward_filemark(i32 %5, i32 1)
%7 = load i32, i32* %2
%8 = call i32 @space_forward_block(i32 %7, i32 5)
%9 = load i32, i32* %2
%10 = call i32 @write_block(i32 %9, i32 131072)
%11 = load i32, i32* %2
%12 = call i32 @write_block(i32 %11, i32 131072)
%13 = load i32, i32* %2
%14 = call i32 @write_block(i32 %13, i32 131072)
%15 = load i32, i32* %2
%16 = call i32 @write_filemarks(i32 %15, i32 1)
%17 = load i32, i32* %2
%18 = call i32 @write_block(i32 %17, i32 131072)
%19 = load i32, i32* %2
%20 = call i32 @write_filemarks(i32 %19, i32 1)
%21 = load i32, i32* %2
%22 = call i32 @write_block(i32 %21, i32 131072)
%23 = load i32, i32* %2
%24 = call i32 @write_filemarks(i32 %23, i32 2)
ret void
}

LLVM IR (-O2):
define void @write_tape_pattern_2(i32 %0) {
%2 = tail call i32 @rewind_tape(i32 %0)
%3 = tail call i32 @space_forward_filemark(i32 %0, i32 1)
%4 = tail call i32 @space_forward_block(i32 %0, i32 5)
%5 = tail call i32 @write_block(i32 %0, i32 131072)
%6 = tail call i32 @write_block(i32 %0, i32 131072)
%7 = tail call i32 @write_block(i32 %0, i32 131072)
%8 = tail call i32 @write_filemarks(i32 %0, i32 1)
%9 = tail call i32 @write_block(i32 %0, i32 131072)
%10 = tail call i32 @write_filemarks(i32 %0, i32 1)
%11 = tail call i32 @write_block(i32 %0, i32 131072)
%12 = tail call i32 @write_filemarks(i32 %0, i32 2)
ret void
}