#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*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
int main(void) {
  FILE *myfile;
  char newfroot[14] = "Snozberry";
  int record, offset;
  if (!(myfile = fopen("froot.txt", "r+"))) {
    puts("Error opening file");
    return 1;
  }
  record = 12;
  offset = record * 14;
  fseek(myfile, offset, SEEK_SET);
  fwrite(newfroot, 14, 1, myfile);
  fclose(myfile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x1e(%rbp)
mov    0xe98(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xe92(%rip),%ax
mov    %ax,-0x12(%rbp)
lea    0xe89(%rip),%rdi
lea    0xe8c(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11b7 <main+0x67>
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1201 <main+0xb1>
movl   $0xc,-0x24(%rbp)
imul   $0xe,-0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    0x2e0d(%rip),%rax
mov    (%rax),%edx
call   1050 <fseek@plt>
lea    -0x1e(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0xe,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x727265627a6f6e53,%rax
65 72 72
mov    %rax,(%rsp)
movq   $0x797272,0x6(%rsp)
lea    0xe9b(%rip),%rdi
lea    0xe9e(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11be <main+0x6e>
mov    %rax,%rbx
mov    0x2e52(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0xa8,%esi
call   1050 <fseek@plt>
mov    %rsp,%rdi
mov    $0xe,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1070 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    11cf <main+0x7f>
lea    0xe56(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.newfroot = [14 x i8] c"Snozberry\00\00\00\00\00"
@.str = [10 x i8] c"froot.txt\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [19 x i8] c"Error opening file\00"
@SEEK_SET = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [14 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [14 x i8]* %3 to i8*
%7 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %2
%8 = icmp ne i32* %7, null
br i1 %8, label %11, label %9
9: ; preds = %0
%10 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %23
11: ; preds = %0
store i32 12, i32* %4
%12 = load i32, i32* %4
%13 = mul nsw i32 %12, 14
store i32 %13, i32* %5
%14 = load i32*, i32** %2
%15 = load i32, i32* %5
%16 = load i32, i32* @SEEK_SET
%17 = call i32 @fseek(i32* %14, i32 %15, i32 %16)
%18 = getelementptr inbounds [14 x i8], [14 x i8]* %3, i64 0, i64 0
%19 = load i32*, i32** %2
%20 = call i32 @fwrite(i8* %18, i32 14, i32 1, i32* %19)
%21 = load i32*, i32** %2
%22 = call i32 @fclose(i32* %21)
store i32 0, i32* %1
br label %23
23: ; preds = %11, %9
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@__const.main.newfroot = [14 x i8] c"Snozberry\00\00\00\00\00"
@.str = [10 x i8] c"froot.txt\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [19 x i8] c"Error opening file\00"
@SEEK_SET = global i32 0
define i32 @main() {
%1 = alloca [14 x i8]
%2 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %12
7: ; preds = %0
%8 = load i32, i32* @SEEK_SET
%9 = tail call i32 @fseek(i32* %3, i32 168, i32 %8)
%10 = call i32 @fwrite(i8* %2, i32 14, i32 1, i32* %3)
%11 = tail call i32 @fclose(i32* %3)
br label %12
12: ; preds = %7, %5
%13 = phi i32 [ 0, %7 ], [ 1, %5 ]
ret i32 %13
}