#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*/ line;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgetline(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *);
int main(void) {
  FILE *fpi, *fpo;
  char line[80];
  fpi = fopen("keywords_constant", "rb");
  fpo = fopen("keywords_constant.h", "wb");
  if (!fpi || !fpo) {
    printf("egads!\n");
    return 1;
  }
  fprintf(fpo, "static const char *keywords_constant[] = {\n");
  for (;;) {
    fgetline(fpi, line, sizeof(line));
    if (line[0] == 0)
      break;
    fprintf(fpo, "\t\"%s\",\n", line);
  }
  fprintf(fpo, "NULL\n");
  fprintf(fpo, "};\n\n");
  fclose(fpi);
  fclose(fpo);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe98(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a3 <main+0x53>
cmpq   $0x0,-0x18(%rbp)
jne    11bb <main+0x6b>
lea    0xe82(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1242 <main+0xf2>
mov    -0x18(%rbp),%rdi
lea    0xe6e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x50,%edx
call   1030 <fgetline@plt>
movsbl -0x70(%rbp),%eax
cmp    $0x0,%eax
jne    11f1 <main+0xa1>
jmp    120c <main+0xbc>
mov    -0x18(%rbp),%rdi
lea    -0x70(%rbp),%rdx
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    11cd <main+0x7d>
mov    -0x18(%rbp),%rdi
lea    0xe51(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe45(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0xe8e(%rip),%rdi
lea    0xe99(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
lea    0xe8d(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1070 <fopen@plt>
test   %r14,%r14
je     125c <main+0xfc>
mov    %rax,%r12
test   %rax,%rax
je     125c <main+0xfc>
lea    0xe7c(%rip),%rdi
mov    $0x2b,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1080 <fwrite@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x50,%edx
call   1030 <fgetline@plt>
cmpb   $0x0,(%rsp)
je     1216 <main+0xb6>
lea    0xe79(%rip),%r15
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x50,%edx
call   1030 <fgetline@plt>
cmpb   $0x0,(%rsp)
jne    11f0 <main+0x90>
lea    0xe43(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1080 <fwrite@plt>
lea    0xe30(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1080 <fwrite@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    126d <main+0x10d>
lea    0xe08(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"keywords_constant\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [20 x i8] c"keywords_constant.h\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.4 = [8 x i8] c"egads!\0A\00"
@.str.5 = [44 x i8] c"static const char *keywords_constant[] = {\0A\00"
@.str.6 = [8 x i8] c"\09\22%s\22,\0A\00"
@.str.7 = [6 x i8] c"NULL\0A\00"
@.str.8 = [5 x i8] c"};\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca [80 x i8]
store i32 0, i32* %1
%5 = 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* %5, i32** %2
%6 = call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 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* %6, i32** %3
%7 = load i32*, i32** %2
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32*, i32** %3
%11 = icmp ne i32* %10, null
br i1 %11, label %14, label %12
12: ; preds = %9, %0
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %1
br label %39
14: ; preds = %9
%15 = load i32*, i32** %3
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
br label %17
17: ; preds = %26, %14
%18 = load i32*, i32** %2
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%20 = call i32 @fgetline(i32* %18, i8* %19, i32 80)
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %17
br label %30
26: ; preds = %17
%27 = load i32*, i32** %3
%28 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* %28)
br label %17
30: ; preds = %25
%31 = load i32*, i32** %3
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%33 = load i32*, i32** %3
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%35 = load i32*, i32** %2
%36 = call i32 @fclose(i32* %35)
%37 = load i32*, i32** %3
%38 = call i32 @fclose(i32* %37)
br label %39
39: ; preds = %30, %12
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str = [18 x i8] c"keywords_constant\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [20 x i8] c"keywords_constant.h\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.5 = [44 x i8] c"static const char *keywords_constant[] = {\0A\00"
@.str.6 = [8 x i8] c"\09\22%s\22,\0A\00"
@.str.7 = [6 x i8] c"NULL\0A\00"
@.str.8 = [5 x i8] c"};\0A\0A\00"
@str = [7 x i8] c"egads!\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = 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))
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%5 = icmp ne i32* %3, null
%6 = icmp ne i32* %4, null
%7 = and i1 %5, %6
br i1 %7, label %10, label %8
8: ; preds = %0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %25
10: ; preds = %0
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i64 43, i64 1, i32* %4)
%12 = call i32 @fgetline(i32* %3, i8* %2, i32 80)
%13 = load i8, i8* %2
%14 = icmp eq i8 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %10, %15
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* %2)
%17 = call i32 @fgetline(i32* %3, i8* %2, i32 80)
%18 = load i8, i8* %2
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %15
20: ; preds = %15, %10
%21 = call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i64 5, i64 1, i32* %4)
%22 = call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i64 4, i64 1, i32* %4)
%23 = call i32 @fclose(i32* %3)
%24 = call i32 @fclose(i32* %4)
br label %25
25: ; preds = %20, %8
%26 = phi i32 [ 0, %20 ], [ 1, %8 ]
ret i32 %26
}