#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*/ devo_fputc(int, void *);
long devo_fseek(void *, long, int);
void fempty(void *stream) {
  long pos = 0;
  long len = devo_fseek(stream, 0, 2);
  devo_fseek(stream, 0, 0);
  while (pos < len) {
    devo_fputc(0x00, stream);
    pos += 4096;
    devo_fseek(stream, pos, 0);
  }
  devo_fseek(stream, 0, 0);
}


x86 assembly (clang, -O0):
<fempty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x2,%edx
call   1040 <devo_fseek@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <devo_fseek@plt>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1194 <fempty+0x74>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1030 <devo_fputc@plt>
mov    -0x10(%rbp),%rax
add    $0x1000,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1040 <devo_fseek@plt>
jmp    1159 <fempty+0x39>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <devo_fseek@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fempty>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
xor    %esi,%esi
mov    $0x2,%edx
call   1040 <devo_fseek@plt>
mov    %rax,%r14
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <devo_fseek@plt>
test   %r14,%r14
jle    1173 <fempty+0x53>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %r15,%rsi
call   1030 <devo_fputc@plt>
add    $0x1000,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <devo_fseek@plt>
cmp    %r14,%rbx
jl     1150 <fempty+0x30>
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <devo_fseek@plt>

LLVM IR (-O0):
define void @fempty(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %3
%5 = load i8*, i8** %2
%6 = call i64 @devo_fseek(i8* %5, i64 0, i32 2)
store i64 %6, i64* %4
%7 = load i8*, i8** %2
%8 = call i64 @devo_fseek(i8* %7, i64 0, i32 0)
br label %9
9: ; preds = %13, %1
%10 = load i64, i64* %3
%11 = load i64, i64* %4
%12 = icmp slt i64 %10, %11
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = load i8*, i8** %2
%15 = call i32 @devo_fputc(i32 0, i8* %14)
%16 = load i64, i64* %3
%17 = add nsw i64 %16, 4096
store i64 %17, i64* %3
%18 = load i8*, i8** %2
%19 = load i64, i64* %3
%20 = call i64 @devo_fseek(i8* %18, i64 %19, i32 0)
br label %9
21: ; preds = %9
%22 = load i8*, i8** %2
%23 = call i64 @devo_fseek(i8* %22, i64 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @fempty(i8* %0) {
%2 = tail call i64 @devo_fseek(i8* %0, i64 0, i32 2)
%3 = tail call i64 @devo_fseek(i8* %0, i64 0, i32 0)
%4 = icmp sgt i64 %2, 0
br i1 %4, label %5, label %11
5: ; preds = %1, %5
%6 = phi i64 [ %8, %5 ], [ 0, %1 ]
%7 = tail call i32 @devo_fputc(i32 0, i8* %0)
%8 = add nuw nsw i64 %6, 4096
%9 = tail call i64 @devo_fseek(i8* %0, i64 %8, i32 0)
%10 = icmp slt i64 %8, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %1
%12 = tail call i64 @devo_fseek(i8* %0, i64 0, i32 0)
ret void
}