#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*/ printf(char *);
int /*<<< orphan*/ putc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stdout;
int main() {
  FILE *fp;
  int ch;
  fp = fopen("file.txt", "w");
  for (ch = 33; ch <= 100; ch++)
    putc(ch, fp);
  fclose(fp);
  for (ch = 33; ch <= 100; ch++)
    putc(ch, stdout);
  printf("\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeac(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x21,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jg     1191 <main+0x51>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <putc@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116d <main+0x2d>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x21,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jg     11cb <main+0x8b>
mov    -0x14(%rbp),%edi
mov    0x2e2b(%rip),%rax
mov    (%rax),%rsi
call   1050 <putc@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a1 <main+0x61>
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    $0x21,%ebp
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
add    $0x1,%ebp
cmp    $0x65,%ebp
jne    1160 <main+0x20>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    $0x21,%ebx
mov    0x2e5a(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%rbp),%rsi
mov    %ebx,%edi
call   1050 <putc@plt>
add    $0x1,%ebx
cmp    $0x65,%ebx
jne    1190 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [2 x i8] c"w\00"
@stdout = global i32* null
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %2
store i32 33, i32* %3
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 100
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32, i32* %3
%10 = load i32*, i32** %2
%11 = call i32 @putc(i32 %9, i32* %10)
br label %12
12: ; preds = %8
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %5
15: ; preds = %5
%16 = load i32*, i32** %2
%17 = call i32 @fclose(i32* %16)
store i32 33, i32* %3
br label %18
18: ; preds = %25, %15
%19 = load i32, i32* %3
%20 = icmp sle i32 %19, 100
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i32, i32* %3
%23 = load i32*, i32** @stdout
%24 = call i32 @putc(i32 %22, i32* %23)
br label %25
25: ; preds = %21
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %18
28: ; preds = %18
%29 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [2 x i8] c"w\00"
@stdout = global i32* null
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 33, %0 ], [ %5, %2 ]
%4 = tail call i32 @putc(i32 %3, i32* %1)
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 101
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = tail call i32 @fclose(i32* %1)
br label %9
9: ; preds = %7, %9
%10 = phi i32 [ 33, %7 ], [ %13, %9 ]
%11 = load i32*, i32** @stdout
%12 = tail call i32 @putc(i32 %10, i32* %11)
%13 = add nuw nsw i32 %10, 1
%14 = icmp eq i32 %13, 101
br i1 %14, label %15, label %9
15: ; preds = %9
%16 = tail call i32 @putchar(i32 10)
ret i32 0
}