#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*/ SEEK_SET;
int /*<<< orphan*/ lseek(int, int, int /*<<< orphan*/);
unsigned char *malloc_aligned(int);
int write(int, unsigned char *, int);
int tst(int f) {
  unsigned char *buff;
  buff = malloc_aligned(0x200);
  buff[0] = 3;
  buff[1] = 0;
  buff[2] = 0;
  buff[3] = 0;
  buff[4] = 0x04;
  buff[5] = 0;
  buff[6] = 0;
  buff[7] = 0;
  lseek(f, 0x4400, SEEK_SET);
  return write(f, buff, 0x200);
}


x86 assembly (clang, -O0):
<tst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x200,%edi
call   1040 <malloc_aligned@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x3,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x3(%rax)
mov    -0x10(%rbp),%rax
movb   $0x4,0x4(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x5(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x6(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x7(%rax)
mov    -0x4(%rbp),%edi
mov    0x2e4e(%rip),%rax
mov    (%rax),%edx
mov    $0x4400,%esi
call   1050 <lseek@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x200,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tst>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x200,%edi
call   1040 <malloc_aligned@plt>
mov    %rax,%rbx
movabs $0x400000003,%rax
mov    %rax,(%rbx)
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
mov    $0x4400,%esi
call   1050 <lseek@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x200,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write@plt>

LLVM IR (-O0):
@SEEK_SET = global i32 0
define i32 @tst(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = call i8* @malloc_aligned(i32 512)
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
store i8 3, i8* %6
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8 0, i8* %8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 2
store i8 0, i8* %10
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 3
store i8 0, i8* %12
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 4
store i8 4, i8* %14
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 5
store i8 0, i8* %16
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 6
store i8 0, i8* %18
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 7
store i8 0, i8* %20
%21 = load i32, i32* %2
%22 = load i32, i32* @SEEK_SET
%23 = call i32 @lseek(i32 %21, i32 17408, i32 %22)
%24 = load i32, i32* %2
%25 = load i8*, i8** %3
%26 = call i32 @write(i32 %24, i8* %25, i32 512)
ret i32 %26
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define i32 @tst(i32 %0) {
%2 = tail call i8* @malloc_aligned(i32 512)
store i8 3, i8* %2
%3 = getelementptr inbounds i8, i8* %2, i64 1
store i8 0, i8* %3
%4 = getelementptr inbounds i8, i8* %2, i64 2
store i8 0, i8* %4
%5 = getelementptr inbounds i8, i8* %2, i64 3
store i8 0, i8* %5
%6 = getelementptr inbounds i8, i8* %2, i64 4
store i8 4, i8* %6
%7 = getelementptr inbounds i8, i8* %2, i64 5
store i8 0, i8* %7
%8 = getelementptr inbounds i8, i8* %2, i64 6
store i8 0, i8* %8
%9 = getelementptr inbounds i8, i8* %2, i64 7
store i8 0, i8* %9
%10 = load i32, i32* @SEEK_SET
%11 = tail call i32 @lseek(i32 %0, i32 17408, i32 %10)
%12 = tail call i32 @write(i32 %0, i8* %2, i32 512)
ret i32 %12
}