#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 O_WRONLY;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ close(int);
int creat(char *, int);
int /*<<< orphan*/ lseek(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ write(int, char *, int);
int main(void) {
  char buf1[] = "123456789abcdefg";
  char buf2[] = "hijklmnopqrstuvw";
  int fd;
  fd = creat("t.txt", O_WRONLY | 777);
  write(fd, buf1, 16);
  lseek(fd, 48, SEEK_SET);
  write(fd, buf2, 16);
  close(fd);
  system("od -c t.txt");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe95(%rip),%al
mov    %al,-0x10(%rbp)
mov    0xe9b(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe98(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe96(%rip),%al
mov    %al,-0x30(%rbp)
mov    0x2e2c(%rip),%rax
mov    (%rax),%esi
or     $0x309,%esi
lea    0xe84(%rip),%rdi
call   1070 <creat@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x10,%edx
call   1030 <write@plt>
mov    -0x44(%rbp),%edi
mov    0x2e0a(%rip),%rax
mov    (%rax),%edx
mov    $0x30,%esi
call   1050 <lseek@plt>
mov    -0x44(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x10,%edx
call   1030 <write@plt>
mov    -0x44(%rbp),%edi
call   1060 <close@plt>
lea    0xe2f(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movaps 0xea4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movb   $0x0,0x30(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
mov    0x2e53(%rip),%rax
mov    $0x309,%esi
or     (%rax),%esi
lea    0xeac(%rip),%rdi
call   1070 <creat@plt>
mov    %eax,%ebx
lea    0x20(%rsp),%rsi
mov    %eax,%edi
mov    $0x10,%edx
call   1030 <write@plt>
mov    0x2e36(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    $0x30,%esi
call   1050 <lseek@plt>
mov    %rsp,%rsi
mov    %ebx,%edi
mov    $0x10,%edx
call   1030 <write@plt>
mov    %ebx,%edi
call   1060 <close@plt>
lea    0xe5c(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.buf1 = [17 x i8] c"123456789abcdefg\00"
@__const.main.buf2 = [17 x i8] c"hijklmnopqrstuvw\00"
@.str = [6 x i8] c"t.txt\00"
@O_WRONLY = global i32 0
@SEEK_SET = global i32 0
@.str.1 = [12 x i8] c"od -c t.txt\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [17 x i8]
%3 = alloca [17 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [17 x i8]* %2 to i8*
%6 = bitcast [17 x i8]* %3 to i8*
%7 = load i32, i32* @O_WRONLY
%8 = or i32 %7, 777
%9 = call i32 @creat(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%12 = call i32 @write(i32 %10, i8* %11, i32 16)
%13 = load i32, i32* %4
%14 = load i32, i32* @SEEK_SET
%15 = call i32 @lseek(i32 %13, i32 48, i32 %14)
%16 = load i32, i32* %4
%17 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%18 = call i32 @write(i32 %16, i8* %17, i32 16)
%19 = load i32, i32* %4
%20 = call i32 @close(i32 %19)
%21 = call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.buf1 = [17 x i8] c"123456789abcdefg\00"
@__const.main.buf2 = [17 x i8] c"hijklmnopqrstuvw\00"
@.str = [6 x i8] c"t.txt\00"
@O_WRONLY = global i32 0
@SEEK_SET = global i32 0
@.str.1 = [12 x i8] c"od -c t.txt\00"
define i32 @main() {
%1 = alloca [17 x i8]
%2 = alloca [17 x i8]
%3 = getelementptr inbounds [17 x i8], [17 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @O_WRONLY
%6 = or i32 %5, 777
%7 = tail call i32 @creat(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @write(i32 %7, i8* %3, i32 16)
%9 = load i32, i32* @SEEK_SET
%10 = tail call i32 @lseek(i32 %7, i32 48, i32 %9)
%11 = call i32 @write(i32 %7, i8* %4, i32 16)
%12 = tail call i32 @close(i32 %7)
%13 = tail call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}