#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_CUR;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int main() {
  FILE *file;
  char ch;
  int i;
  file = fopen("out.txt", "w");
  puts("Enter 16 characters :");
  for (i = 0; i < 16; ++i) {
    fputc(fgetc(stdin), file);
  }
  fseek(file, 48, SEEK_CUR);
  puts("Enter 16 more characters :");
  fflush(stdin);
  for (i = 0; i < 16; ++i) {
    fputc(fgetc(stdin), file);
  }
  fclose(file);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
lea    0xe7b(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x10,-0x18(%rbp)
jge    11da <main+0x6a>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1060 <fputc@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a9 <main+0x39>
mov    -0x10(%rbp),%rdi
mov    0x2e03(%rip),%rax
mov    (%rax),%edx
mov    $0x30,%esi
call   1080 <fseek@plt>
lea    0xe28(%rip),%rdi
call   1030 <puts@plt>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x10,-0x18(%rbp)
jge    1243 <main+0xd3>
mov    0x2dbd(%rip),%rax
mov    (%rax),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1060 <fputc@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1212 <main+0xa2>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe85(%rip),%rdi
lea    0xe86(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
lea    0xe79(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e43(%rip),%r14
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    0x2d24(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x30,%esi
call   1080 <fseek@plt>
lea    0xd46(%rip),%rdi
call   1030 <puts@plt>
mov    (%r14),%edi
call   1070 <fflush@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <fputc@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"out.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [22 x i8] c"Enter 16 characters :\00"
@stdin = global i32 0
@SEEK_CUR = global i32 0
@.str.3 = [27 x i8] c"Enter 16 more characters :\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i8
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %2
%6 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 16
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i32, i32* @stdin
%12 = call i32 @fgetc(i32 %11)
%13 = load i32*, i32** %2
%14 = call i32 @fputc(i32 %12, i32* %13)
br label %15
15: ; preds = %10
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
br label %7
18: ; preds = %7
%19 = load i32*, i32** %2
%20 = load i32, i32* @SEEK_CUR
%21 = call i32 @fseek(i32* %19, i32 48, i32 %20)
%22 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%23 = load i32, i32* @stdin
%24 = call i32 @fflush(i32 %23)
store i32 0, i32* %4
br label %25
25: ; preds = %33, %18
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 16
br i1 %27, label %28, label %36
28: ; preds = %25
%29 = load i32, i32* @stdin
%30 = call i32 @fgetc(i32 %29)
%31 = load i32*, i32** %2
%32 = call i32 @fputc(i32 %30, i32* %31)
br label %33
33: ; preds = %28
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %25
36: ; preds = %25
%37 = load i32*, i32** %2
%38 = call i32 @fclose(i32* %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"out.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [22 x i8] c"Enter 16 characters :\00"
@stdin = global i32 0
@SEEK_CUR = global i32 0
@.str.3 = [27 x i8] c"Enter 16 more characters :\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%3 = load i32, i32* @stdin
%4 = tail call i32 @fgetc(i32 %3)
%5 = tail call i32 @fputc(i32 %4, i32* %1)
%6 = load i32, i32* @stdin
%7 = tail call i32 @fgetc(i32 %6)
%8 = tail call i32 @fputc(i32 %7, i32* %1)
%9 = load i32, i32* @stdin
%10 = tail call i32 @fgetc(i32 %9)
%11 = tail call i32 @fputc(i32 %10, i32* %1)
%12 = load i32, i32* @stdin
%13 = tail call i32 @fgetc(i32 %12)
%14 = tail call i32 @fputc(i32 %13, i32* %1)
%15 = load i32, i32* @stdin
%16 = tail call i32 @fgetc(i32 %15)
%17 = tail call i32 @fputc(i32 %16, i32* %1)
%18 = load i32, i32* @stdin
%19 = tail call i32 @fgetc(i32 %18)
%20 = tail call i32 @fputc(i32 %19, i32* %1)
%21 = load i32, i32* @stdin
%22 = tail call i32 @fgetc(i32 %21)
%23 = tail call i32 @fputc(i32 %22, i32* %1)
%24 = load i32, i32* @stdin
%25 = tail call i32 @fgetc(i32 %24)
%26 = tail call i32 @fputc(i32 %25, i32* %1)
%27 = load i32, i32* @stdin
%28 = tail call i32 @fgetc(i32 %27)
%29 = tail call i32 @fputc(i32 %28, i32* %1)
%30 = load i32, i32* @stdin
%31 = tail call i32 @fgetc(i32 %30)
%32 = tail call i32 @fputc(i32 %31, i32* %1)
%33 = load i32, i32* @stdin
%34 = tail call i32 @fgetc(i32 %33)
%35 = tail call i32 @fputc(i32 %34, i32* %1)
%36 = load i32, i32* @stdin
%37 = tail call i32 @fgetc(i32 %36)
%38 = tail call i32 @fputc(i32 %37, i32* %1)
%39 = load i32, i32* @stdin
%40 = tail call i32 @fgetc(i32 %39)
%41 = tail call i32 @fputc(i32 %40, i32* %1)
%42 = load i32, i32* @stdin
%43 = tail call i32 @fgetc(i32 %42)
%44 = tail call i32 @fputc(i32 %43, i32* %1)
%45 = load i32, i32* @stdin
%46 = tail call i32 @fgetc(i32 %45)
%47 = tail call i32 @fputc(i32 %46, i32* %1)
%48 = load i32, i32* @stdin
%49 = tail call i32 @fgetc(i32 %48)
%50 = tail call i32 @fputc(i32 %49, i32* %1)
%51 = load i32, i32* @SEEK_CUR
%52 = tail call i32 @fseek(i32* %1, i32 48, i32 %51)
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%54 = load i32, i32* @stdin
%55 = tail call i32 @fflush(i32 %54)
%56 = load i32, i32* @stdin
%57 = tail call i32 @fgetc(i32 %56)
%58 = tail call i32 @fputc(i32 %57, i32* %1)
%59 = load i32, i32* @stdin
%60 = tail call i32 @fgetc(i32 %59)
%61 = tail call i32 @fputc(i32 %60, i32* %1)
%62 = load i32, i32* @stdin
%63 = tail call i32 @fgetc(i32 %62)
%64 = tail call i32 @fputc(i32 %63, i32* %1)
%65 = load i32, i32* @stdin
%66 = tail call i32 @fgetc(i32 %65)
%67 = tail call i32 @fputc(i32 %66, i32* %1)
%68 = load i32, i32* @stdin
%69 = tail call i32 @fgetc(i32 %68)
%70 = tail call i32 @fputc(i32 %69, i32* %1)
%71 = load i32, i32* @stdin
%72 = tail call i32 @fgetc(i32 %71)
%73 = tail call i32 @fputc(i32 %72, i32* %1)
%74 = load i32, i32* @stdin
%75 = tail call i32 @fgetc(i32 %74)
%76 = tail call i32 @fputc(i32 %75, i32* %1)
%77 = load i32, i32* @stdin
%78 = tail call i32 @fgetc(i32 %77)
%79 = tail call i32 @fputc(i32 %78, i32* %1)
%80 = load i32, i32* @stdin
%81 = tail call i32 @fgetc(i32 %80)
%82 = tail call i32 @fputc(i32 %81, i32* %1)
%83 = load i32, i32* @stdin
%84 = tail call i32 @fgetc(i32 %83)
%85 = tail call i32 @fputc(i32 %84, i32* %1)
%86 = load i32, i32* @stdin
%87 = tail call i32 @fgetc(i32 %86)
%88 = tail call i32 @fputc(i32 %87, i32* %1)
%89 = load i32, i32* @stdin
%90 = tail call i32 @fgetc(i32 %89)
%91 = tail call i32 @fputc(i32 %90, i32* %1)
%92 = load i32, i32* @stdin
%93 = tail call i32 @fgetc(i32 %92)
%94 = tail call i32 @fputc(i32 %93, i32* %1)
%95 = load i32, i32* @stdin
%96 = tail call i32 @fgetc(i32 %95)
%97 = tail call i32 @fputc(i32 %96, i32* %1)
%98 = load i32, i32* @stdin
%99 = tail call i32 @fgetc(i32 %98)
%100 = tail call i32 @fputc(i32 %99, i32* %1)
%101 = load i32, i32* @stdin
%102 = tail call i32 @fgetc(i32 %101)
%103 = tail call i32 @fputc(i32 %102, i32* %1)
%104 = tail call i32 @fclose(i32* %1)
ret i32 0
}