#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 EOF;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putc(float, int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  FILE *f, *lp;
  int c, i;
  lp = fopen("prt:", "w");
  if (lp == NULL) {
    printf("Cannot open line printer");
    exit(20);
  }
  fprintf(lp, "\033#3");
  for (i = 1; i <= argc - 1; i++) {
    f = fopen(argv[i], "r");
    if (f == NULL) {
      printf("Cannot find file \"%s\"\n", argv[i]);
      continue;
    }
    printf("Printing %s\n", argv[i]);
    while ((c = getc(f)) != EOF)
      putc(c, lp);
    putc('\f', lp);
    fclose(f);
  }
  fclose(lp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe77(%rip),%rdi
lea    0xe75(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11c0 <main+0x50>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x14,%edi
call   1080 <exit@plt>
mov    -0x20(%rbp),%rdi
lea    0xe59(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     129e <main+0x12e>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe27(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    122e <main+0xbe>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1290 <main+0x120>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1090 <getc@plt>
mov    %eax,-0x24(%rbp)
mov    0x2d8d(%rip),%rcx
cmp    (%rcx),%eax
je     1276 <main+0x106>
cvtsi2ssl -0x24(%rbp),%xmm0
mov    -0x20(%rbp),%rdi
call   1050 <putc@plt>
jmp    1248 <main+0xd8>
mov    -0x20(%rbp),%rdi
movss  0xd7e(%rip),%xmm0
call   1050 <putc@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11d7 <main+0x67>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xe7d(%rip),%rdi
lea    0xe7b(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     1279 <main+0x109>
mov    %rax,%rbx
lea    0xe7e(%rip),%rdi
mov    $0x1,%r12d
mov    $0x3,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1080 <fwrite@plt>
cmp    $0x2,%ebp
jl     1260 <main+0xf0>
mov    %ebp,%r13d
mov    0x2e17(%rip),%r15
jmp    1201 <main+0x91>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movss  0xe18(%rip),%xmm0
mov    %rbx,%rdi
call   1050 <putc@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
add    $0x1,%r12
cmp    %r13,%r12
je     1260 <main+0xf0>
mov    (%r14,%r12,8),%rdi
lea    0xe16(%rip),%rsi
call   1060 <fopen@plt>
mov    (%r14,%r12,8),%rsi
test   %rax,%rax
je     1250 <main+0xe0>
mov    %rax,%rbp
lea    0xe1b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1090 <getc@plt>
cmp    (%r15),%eax
je     11e0 <main+0x70>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    %rbx,%rdi
call   1050 <putc@plt>
jmp    1230 <main+0xc0>
xchg   %ax,%ax
lea    0xdd1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f8 <main+0x88>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd8b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x14,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"prt:\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [25 x i8] c"Cannot open line printer\00"
@.str.3 = [4 x i8] c"\1B\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [23 x i8] c"Cannot find file \22%s\22\0A\00"
@.str.6 = [13 x i8] c"Printing %s\0A\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%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 ([5 x i8], [5 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** %7
%11 = load i32*, i32** %7
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @exit(i32 20)
unreachable
16: ; preds = %2
%17 = load i32*, i32** %7
%18 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %9
br label %19
19: ; preds = %62, %16
%20 = load i32, i32* %9
%21 = load i32, i32* %4
%22 = sub nsw i32 %21, 1
%23 = icmp sle i32 %20, %22
br i1 %23, label %24, label %65
24: ; preds = %19
%25 = load i8**, i8*** %5
%26 = load i32, i32* %9
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %30, i32** %6
%31 = load i32*, i32** %6
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %40
33: ; preds = %24
%34 = load i8**, i8*** %5
%35 = load i32, i32* %9
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %38)
br label %62
40: ; preds = %24
%41 = load i8**, i8*** %5
%42 = load i32, i32* %9
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %52, %40
%48 = load i32*, i32** %6
%49 = call i32 @getc(i32* %48)
store i32 %49, i32* %8
%50 = load i32, i32* @EOF
%51 = icmp ne i32 %49, %50
br i1 %51, label %52, label %57
52: ; preds = %47
%53 = load i32, i32* %8
%54 = sitofp i32 %53 to float
%55 = load i32*, i32** %7
%56 = call i32 @putc(float %54, i32* %55)
br label %47
57: ; preds = %47
%58 = load i32*, i32** %7
%59 = call i32 @putc(float 1.200000e+01, i32* %58)
%60 = load i32*, i32** %6
%61 = call i32 @fclose(i32* %60)
br label %62
62: ; preds = %57, %33
%63 = load i32, i32* %9
%64 = add nsw i32 %63, 1
store i32 %64, i32* %9
br label %19
65: ; preds = %19
%66 = load i32*, i32** %7
%67 = call i32 @fclose(i32* %66)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"prt:\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [25 x i8] c"Cannot open line printer\00"
@.str.3 = [4 x i8] c"\1B\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [23 x i8] c"Cannot find file \22%s\22\0A\00"
@.str.6 = [13 x i8] c"Printing %s\0A\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @exit(i32 20)
unreachable
8: ; preds = %2
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64 3, i64 1, i32* %3)
%10 = icmp sgt i32 %0, 1
br i1 %10, label %11, label %40
11: ; preds = %8
%12 = zext i32 %0 to i64
br label %13
13: ; preds = %11, %37
%14 = phi i64 [ 1, %11 ], [ %38, %37 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = tail call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i32* %17, null
%19 = load i8*, i8** %15
br i1 %18, label %20, label %22
20: ; preds = %13
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %19)
br label %37
22: ; preds = %13
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %19)
%24 = tail call i32 @getc(i32* %17)
%25 = load i32, i32* @EOF
%26 = icmp eq i32 %24, %25
br i1 %26, label %34, label %27
27: ; preds = %22, %27
%28 = phi i32 [ %31, %27 ], [ %24, %22 ]
%29 = sitofp i32 %28 to float
%30 = tail call i32 @putc(float %29, i32* %3)
%31 = tail call i32 @getc(i32* %17)
%32 = load i32, i32* @EOF
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %27
34: ; preds = %27, %22
%35 = tail call i32 @putc(float 1.200000e+01, i32* %3)
%36 = tail call i32 @fclose(i32* %17)
br label %37
37: ; preds = %34, %20
%38 = add nuw nsw i64 %14, 1
%39 = icmp eq i64 %38, %12
br i1 %39, label %40, label %13
40: ; preds = %37, %8
%41 = tail call i32 @fclose(i32* %3)
ret i32 0
}