#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 off_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fseeko(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int strlen(char *);
int main(int argc, char *const *argv) {
  FILE *fp = fopen("gigaslam.gif", "w");
  char header[] = "<html>\n<table>\n<tr><td>\n";
  char trailer[] = "</html>\n";
  off_t howBig = 1000000000ll;
  fwrite(header, sizeof header, 1, fp);
  fseeko(fp, howBig - strlen(trailer), 0);
  fwrite(trailer, strlen(trailer), 1, fp);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
lea    0xe99(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    0xe9c(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe99(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe96(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe94(%rip),%al
mov    %al,-0x28(%rbp)
mov    0xe61(%rip),%rax
mov    %rax,-0x49(%rbp)
mov    0xe5f(%rip),%al
mov    %al,-0x41(%rbp)
movl   $0x3b9aca00,-0x50(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x19,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x64(%rbp)
lea    -0x49(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x64(%rbp),%esi
mov    -0x60(%rbp),%rdi
sub    %eax,%esi
xor    %edx,%edx
call   1050 <fseeko@plt>
lea    -0x49(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x49(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    %eax,%esi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xea2(%rip),%rdi
lea    0xea8(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
movups 0xeb5(%rip),%xmm0
movups %xmm0,0x19(%rsp)
movaps 0xea0(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0xa3e6c6d74682f3c,%rax
6c 3e 0a
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1070 <fwrite@plt>
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    $0x3b9aca00,%esi
sub    %eax,%esi
mov    %rbx,%rdi
xor    %edx,%edx
call   1050 <fseeko@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1070 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"gigaslam.gif\00"
@.str.1 = [2 x i8] c"w\00"
@__const.main.header = [25 x i8] c"<html>\0A<table>\0A<tr><td>\0A\00"
@__const.main.trailer = [9 x i8] c"</html>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [25 x i8]
%8 = alloca [9 x i8]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %6
%11 = bitcast [25 x i8]* %7 to i8*
%12 = bitcast [9 x i8]* %8 to i8*
store i32 1000000000, i32* %9
%13 = getelementptr inbounds [25 x i8], [25 x i8]* %7, i64 0, i64 0
%14 = load i32*, i32** %6
%15 = call i32 @fwrite(i8* %13, i32 25, i32 1, i32* %14)
%16 = load i32*, i32** %6
%17 = load i32, i32* %9
%18 = getelementptr inbounds [9 x i8], [9 x i8]* %8, i64 0, i64 0
%19 = call i32 @strlen(i8* %18)
%20 = sub nsw i32 %17, %19
%21 = call i32 @fseeko(i32* %16, i32 %20, i32 0)
%22 = getelementptr inbounds [9 x i8], [9 x i8]* %8, i64 0, i64 0
%23 = getelementptr inbounds [9 x i8], [9 x i8]* %8, i64 0, i64 0
%24 = call i32 @strlen(i8* %23)
%25 = load i32*, i32** %6
%26 = call i32 @fwrite(i8* %22, i32 %24, i32 1, i32* %25)
%27 = load i32*, i32** %6
%28 = call i32 @fclose(i32* %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"gigaslam.gif\00"
@.str.1 = [2 x i8] c"w\00"
@__const.main.header = [25 x i8] c"<html>\0A<table>\0A<tr><td>\0A\00"
@__const.main.trailer = [9 x i8] c"</html>\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [25 x i8]
%4 = alloca [9 x i8]
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%8 = call i32 @fwrite(i8* %6, i32 25, i32 1, i32* %5)
%9 = call i32 @strlen(i8* %7)
%10 = sub nsw i32 1000000000, %9
%11 = call i32 @fseeko(i32* %5, i32 %10, i32 0)
%12 = call i32 @strlen(i8* %7)
%13 = call i32 @fwrite(i8* %7, i32 %12, i32 1, i32* %5)
%14 = call i32 @fclose(i32* %5)
ret i32 0
}