#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;
scalar_t__ ferror(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int ascienc(FILE *in, FILE *out) {
  int c;
  while ((c = fgetc(in)) != EOF) {
    if (ferror(in) || ferror(out))
      return 1;
    if (c != '\n')
      fprintf(out, "&#%u;", c);
    else
      fputc('\n', out);
  }
  return 0;
}


x86 assembly (clang, -O0):
<ascienc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e85(%rip),%rcx
cmp    (%rcx),%eax
je     11d2 <ascienc+0x92>
mov    -0x10(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
jne    1191 <ascienc+0x51>
mov    -0x18(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     119d <ascienc+0x5d>
movl   $0x1,-0x4(%rbp)
jmp    11d9 <ascienc+0x99>
cmpl   $0xa,-0x1c(%rbp)
je     11bf <ascienc+0x7f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xe4b(%rip),%rsi
call   1060 <fprintf@plt>
jmp    11cd <ascienc+0x8d>
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1050 <fputc@plt>
jmp    1150 <ascienc+0x10>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascienc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <fgetc@plt>
mov    0x2e8b(%rip),%r13
cmp    0x0(%r13),%eax
jne    1176 <ascienc+0x36>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
lea    0xe81(%rip),%r15
mov    $0x1,%ebx
jmp    11ad <ascienc+0x6d>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
mov    %r12,%rdi
call   1040 <fgetc@plt>
mov    %eax,%ebp
cmp    0x0(%r13),%eax
je     1163 <ascienc+0x23>
mov    %r12,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    1165 <ascienc+0x25>
mov    %r14,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    1165 <ascienc+0x25>
cmp    $0xa,%ebp
je     1190 <ascienc+0x50>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1060 <fprintf@plt>
jmp    119d <ascienc+0x5d>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [6 x i8] c"&#%u;\00"
define i32 @ascienc(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
br label %7
7: ; preds = %31, %2
%8 = load i32*, i32** %4
%9 = call i32 @fgetc(i32* %8)
store i32 %9, i32* %6
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %32
12: ; preds = %7
%13 = load i32*, i32** %4
%14 = call i64 @ferror(i32* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = load i32*, i32** %5
%18 = call i64 @ferror(i32* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %16, %12
store i32 1, i32* %3
br label %33
21: ; preds = %16
%22 = load i32, i32* %6
%23 = icmp ne i32 %22, 10
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load i32*, i32** %5
%26 = load i32, i32* %6
%27 = call i32 @fprintf(i32* %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %26)
br label %31
28: ; preds = %21
%29 = load i32*, i32** %5
%30 = call i32 @fputc(i8 signext 10, i32* %29)
br label %31
31: ; preds = %28, %24
br label %7
32: ; preds = %7
store i32 0, i32* %3
br label %33
33: ; preds = %32, %20
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [6 x i8] c"&#%u;\00"
define i32 @ascienc(i32* nocapture %0, i32* nocapture %1) {
%3 = tail call i32 @fgetc(i32* %0)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %23, label %6
6: ; preds = %2, %19
%7 = phi i32 [ %20, %19 ], [ %3, %2 ]
%8 = tail call i64 @ferror(i32* %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %23
10: ; preds = %6
%11 = tail call i64 @ferror(i32* %1)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = icmp eq i32 %7, 10
br i1 %14, label %17, label %15
15: ; preds = %13
%16 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %19
17: ; preds = %13
%18 = tail call i32 @fputc(i8 signext 10, i32* %1)
br label %19
19: ; preds = %17, %15
%20 = tail call i32 @fgetc(i32* %0)
%21 = load i32, i32* @EOF
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %6
23: ; preds = %10, %6, %19, %2
%24 = phi i32 [ 0, %2 ], [ 0, %19 ], [ 1, %6 ], [ 1, %10 ]
ret i32 %24
}