#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*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int main(void) {
  FILE *fpi, *fpo;
  char lastch = -1;
  fpi = fopen("keywords_constant", "rb");
  fpo = fopen("k", "wb");
  while (1) {
    char ch = fgetc(fpi);
    if (ch < 0)
      break;
    if (ch == ' ')
      ch = '\n';
    if (ch == '\r')
      continue;
    if (lastch == '\n' && ch == '\n') {
    } else
      fputc(ch, fpo);
    lastch = ch;
  }
  fclose(fpi);
  fclose(fpo);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0xff,-0x19(%rbp)
lea    0xea6(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xea4(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x1a(%rbp)
movsbl -0x1a(%rbp),%eax
cmp    $0x0,%eax
jge    119f <main+0x5f>
jmp    11fb <main+0xbb>
movsbl -0x1a(%rbp),%eax
cmp    $0x20,%eax
jne    11b0 <main+0x70>
movb   $0xa,-0x1a(%rbp)
movsbl -0x1a(%rbp),%eax
cmp    $0xd,%eax
jne    11c2 <main+0x82>
jmp    1181 <main+0x41>
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
jne    11e1 <main+0xa1>
movsbl -0x1a(%rbp),%eax
cmp    $0xa,%eax
jne    11e1 <main+0xa1>
jmp    11f0 <main+0xb0>
mov    -0x1a(%rbp),%al
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1050 <fputc@plt>
mov    -0x1a(%rbp),%al
mov    %al,-0x19(%rbp)
jmp    1181 <main+0x41>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xeb1(%rip),%rdi
lea    0xebc(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r12
lea    0xeb0(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
mov    %r12,%rdi
call   1040 <fgetc@plt>
test   %al,%al
js     11c8 <main+0x88>
mov    $0xff,%bl
mov    $0xa,%r15d
jmp    11aa <main+0x6a>
nopw   0x0(%rax,%rax,1)
movsbl %bpl,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
mov    %ebp,%ebx
mov    %r12,%rdi
call   1040 <fgetc@plt>
test   %al,%al
js     11c8 <main+0x88>
cmp    $0x20,%al
movzbl %al,%ebp
cmove  %r15d,%ebp
cmp    $0xd,%bpl
je     119e <main+0x5e>
cmp    $0xa,%bl
jne    1190 <main+0x50>
mov    $0xa,%bl
cmp    $0xa,%bpl
je     119e <main+0x5e>
jmp    1190 <main+0x50>
mov    %r12,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"keywords_constant\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [2 x i8] c"k\00"
@.str.3 = [3 x i8] c"wb\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i8
%5 = alloca i8
store i32 0, i32* %1
store i8 -1, i8* %4
%6 = call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %2
%7 = call i32* @fopen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %7, i32** %3
br label %8
8: ; preds = %0, %24, %38
%9 = load i32*, i32** %2
%10 = call signext i8 @fgetc(i32* %9)
store i8 %10, i8* %5
%11 = load i8, i8* %5
%12 = sext i8 %11 to i32
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %8
br label %40
15: ; preds = %8
%16 = load i8, i8* %5
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 32
br i1 %18, label %19, label %20
19: ; preds = %15
store i8 10, i8* %5
br label %20
20: ; preds = %19, %15
%21 = load i8, i8* %5
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 13
br i1 %23, label %24, label %25
24: ; preds = %20
br label %8
25: ; preds = %20
%26 = load i8, i8* %4
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 10
br i1 %28, label %29, label %34
29: ; preds = %25
%30 = load i8, i8* %5
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 10
br i1 %32, label %33, label %34
33: ; preds = %29
br label %38
34: ; preds = %29, %25
%35 = load i8, i8* %5
%36 = load i32*, i32** %3
%37 = call i32 @fputc(i8 signext %35, i32* %36)
br label %38
38: ; preds = %34, %33
%39 = load i8, i8* %5
store i8 %39, i8* %4
br label %8
40: ; preds = %14
%41 = load i32*, i32** %2
%42 = call i32 @fclose(i32* %41)
%43 = load i32*, i32** %3
%44 = call i32 @fclose(i32* %43)
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
@.str = [18 x i8] c"keywords_constant\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [2 x i8] c"k\00"
@.str.3 = [3 x i8] c"wb\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call signext i8 @fgetc(i32* %1)
%4 = icmp slt i8 %3, 0
br i1 %4, label %21, label %5
5: ; preds = %0, %17
%6 = phi i8 [ %19, %17 ], [ %3, %0 ]
%7 = phi i8 [ %18, %17 ], [ -1, %0 ]
%8 = icmp eq i8 %6, 32
%9 = select i1 %8, i8 10, i8 %6
%10 = icmp eq i8 %9, 13
br i1 %10, label %17, label %11
11: ; preds = %5
%12 = icmp eq i8 %7, 10
%13 = icmp eq i8 %9, 10
%14 = and i1 %12, %13
br i1 %14, label %17, label %15
15: ; preds = %11
%16 = tail call i32 @fputc(i8 signext %9, i32* %2)
br label %17
17: ; preds = %15, %11, %5
%18 = phi i8 [ %7, %5 ], [ 10, %11 ], [ %9, %15 ]
%19 = tail call signext i8 @fgetc(i32* %1)
%20 = icmp slt i8 %19, 0
br i1 %20, label %21, label %5
21: ; preds = %17, %0
%22 = tail call i32 @fclose(i32* %1)
%23 = tail call i32 @fclose(i32* %2)
ret i32 0
}