#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 */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(int *, int, int, int /*<<< orphan*/ *);
int main(int argc, char *argv[], char *env[]) {
  FILE *f = fopen(argv[1], "r+");
  int T[7] = {256, 12546, 58495, -1, 0, 18, 511};
  for (int i = 0; i < 7; i++)
    fwrite(&T[i], 2, 1, f);
  fclose(f);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea7(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe9f(%rip),%eax
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x7,-0x44(%rbp)
jge    11cd <main+0x9d>
movslq -0x44(%rbp),%rax
lea    -0x40(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   1050 <fwrite@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1193 <main+0x63>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0x8(%rsi),%rdi
lea    0xebe(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
movups 0xecb(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xc(%rsp),%r14
mov    %rsp,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
lea    0x4(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0x8(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0x10(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0x14(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0x18(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"r+\00"
@__const.main.T = [7 x i32] [i32 256, i32 12546, i32 58495, i32 -1, i32 0, i32 18, i32 511]
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32*
%9 = alloca [7 x i32]
%10 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%11 = load i8**, i8*** %6
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %14, i32** %8
%15 = bitcast [7 x i32]* %9 to i8*
store i32 0, i32* %10
br label %16
16: ; preds = %25, %3
%17 = load i32, i32* %10
%18 = icmp slt i32 %17, 7
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = load i32, i32* %10
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 %21
%23 = load i32*, i32** %8
%24 = call i32 @fwrite(i32* %22, i32 2, i32 1, i32* %23)
br label %25
25: ; preds = %19
%26 = load i32, i32* %10
%27 = add nsw i32 %26, 1
store i32 %27, i32* %10
br label %16
28: ; preds = %16
%29 = load i32*, i32** %8
%30 = call i32 @fclose(i32* %29)
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
@.str = [3 x i8] c"r+\00"
@__const.main.T = [7 x i32] [i32 256, i32 12546, i32 58495, i32 -1, i32 0, i32 18, i32 511]
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture readnone %2) {
%4 = alloca [7 x i32]
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = bitcast [7 x i32]* %4 to i8*
%9 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 0
%10 = call i32 @fwrite(i32* %9, i32 2, i32 1, i32* %7)
%11 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 1
%12 = call i32 @fwrite(i32* %11, i32 2, i32 1, i32* %7)
%13 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 2
%14 = call i32 @fwrite(i32* %13, i32 2, i32 1, i32* %7)
%15 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 3
%16 = call i32 @fwrite(i32* %15, i32 2, i32 1, i32* %7)
%17 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 4
%18 = call i32 @fwrite(i32* %17, i32 2, i32 1, i32* %7)
%19 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 5
%20 = call i32 @fwrite(i32* %19, i32 2, i32 1, i32* %7)
%21 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 6
%22 = call i32 @fwrite(i32* %21, i32 2, i32 1, i32* %7)
%23 = tail call i32 @fclose(i32* %7)
ret i32 0
}