#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 fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int is_escaped_newline(FILE *input, FILE *output, int c) {
  if (c == '\\') {
    c = fgetc(input);
    if (c != '\n') {
      fputc(c, output);
    } else {
      fseek(output, -1, SEEK_CUR);
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_escaped_newline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x5c,-0x1c(%rbp)
jne    119c <is_escaped_newline+0x6c>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
je     1174 <is_escaped_newline+0x44>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1040 <fputc@plt>
jmp    1197 <is_escaped_newline+0x67>
mov    -0x18(%rbp),%rdi
mov    0x2e69(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1050 <fseek@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a3 <is_escaped_newline+0x73>
jmp    119c <is_escaped_newline+0x6c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_escaped_newline>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
cmp    $0x5c,%edx
jne    116f <is_escaped_newline+0x3f>
mov    %rsi,%r14
call   1030 <fgetc@plt>
cmp    $0xa,%eax
jne    1165 <is_escaped_newline+0x35>
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0xffffffff,%esi
call   1050 <fseek@plt>
mov    $0x1,%ebx
jmp    116f <is_escaped_newline+0x3f>
mov    %eax,%edi
mov    %r14,%rsi
call   1040 <fputc@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SEEK_CUR = global i32 0
define i32 @is_escaped_newline(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 92
br i1 %9, label %10, label %24
10: ; preds = %3
%11 = load i32*, i32** %5
%12 = call i32 @fgetc(i32* %11)
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = icmp ne i32 %13, 10
br i1 %14, label %15, label %19
15: ; preds = %10
%16 = load i32, i32* %7
%17 = load i32*, i32** %6
%18 = call i32 @fputc(i32 %16, i32* %17)
br label %23
19: ; preds = %10
%20 = load i32*, i32** %6
%21 = load i32, i32* @SEEK_CUR
%22 = call i32 @fseek(i32* %20, i32 -1, i32 %21)
store i32 1, i32* %4
br label %25
23: ; preds = %15
br label %24
24: ; preds = %23, %3
store i32 0, i32* %4
br label %25
25: ; preds = %24, %19
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
define i32 @is_escaped_newline(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 92
br i1 %4, label %5, label %13
5: ; preds = %3
%6 = tail call i32 @fgetc(i32* %0)
%7 = icmp eq i32 %6, 10
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @fputc(i32 %6, i32* %1)
br label %13
10: ; preds = %5
%11 = load i32, i32* @SEEK_CUR
%12 = tail call i32 @fseek(i32* %1, i32 -1, i32 %11)
br label %13
13: ; preds = %3, %8, %10
%14 = phi i32 [ 1, %10 ], [ 0, %8 ], [ 0, %3 ]
ret i32 %14
}