#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*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
char *malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(int argc, char **argv) {
  FILE *orig;
  FILE *dest;
  orig = fopen("../../dicts/mpos/mobyposi.i", "r+");
  dest = fopen("../../dicts/posDict.txt", "w");
  char *inputLine = malloc(sizeof(char) * 512);
  fgets(inputLine, 512, orig);
  while (!feof(orig)) {
    char *temp = malloc(sizeof(char) * 512);
    strcpy(temp, inputLine);
    char id = temp[strlen(temp) - 2];
    if (id != 'h') {
      fputs(temp, dest);
    }
    fgets(inputLine, 512, orig);
  }
  fclose(orig);
  fclose(dest);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe63(%rip),%rdi
lea    0xe78(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe6b(%rip),%rdi
lea    0xe7c(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    $0x200,%edi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x200,%esi
call   1070 <fgets@plt>
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1202 <main+0x82>
jmp    1271 <main+0xf1>
mov    $0x200,%edi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%rax
sub    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x31(%rbp)
movsbl -0x31(%rbp),%eax
cmp    $0x68,%eax
je     125a <main+0xda>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <fputs@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x200,%esi
call   1070 <fgets@plt>
jmp    11e4 <main+0x64>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xe71(%rip),%rdi
lea    0xe86(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r15
lea    0xe7a(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r14
mov    $0x200,%edi
call   1090 <malloc@plt>
mov    %rax,%r12
mov    %rax,%rdi
jmp    11d3 <main+0x53>
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    $0x200,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
mov    %r15,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    1222 <main+0xa2>
mov    $0x200,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
cmpb   $0x68,-0x2(%rax,%rbx,1)
je     11d0 <main+0x50>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <fputs@plt>
jmp    11d0 <main+0x50>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [28 x i8] c"../../dicts/mpos/mobyposi.i\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [24 x i8] c"../../dicts/posDict.txt\00"
@.str.3 = [2 x i8] c"w\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32* @fopen(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %6
%12 = call i32* @fopen(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %12, i32** %7
%13 = call i8* @malloc(i32 512)
store i8* %13, i8** %8
%14 = load i8*, i8** %8
%15 = load i32*, i32** %6
%16 = call i32 @fgets(i8* %14, i32 512, i32* %15)
br label %17
17: ; preds = %41, %2
%18 = load i32*, i32** %6
%19 = call i32 @feof(i32* %18)
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
br i1 %21, label %22, label %45
22: ; preds = %17
%23 = call i8* @malloc(i32 512)
store i8* %23, i8** %9
%24 = load i8*, i8** %9
%25 = load i8*, i8** %8
%26 = call i32 @strcpy(i8* %24, i8* %25)
%27 = load i8*, i8** %9
%28 = load i8*, i8** %9
%29 = call i32 @strlen(i8* %28)
%30 = sub nsw i32 %29, 2
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %27, i64 %31
%33 = load i8, i8* %32
store i8 %33, i8* %10
%34 = load i8, i8* %10
%35 = sext i8 %34 to i32
%36 = icmp ne i32 %35, 104
br i1 %36, label %37, label %41
37: ; preds = %22
%38 = load i8*, i8** %9
%39 = load i32*, i32** %7
%40 = call i32 @fputs(i8* %38, i32* %39)
br label %41
41: ; preds = %37, %22
%42 = load i8*, i8** %8
%43 = load i32*, i32** %6
%44 = call i32 @fgets(i8* %42, i32 512, i32* %43)
br label %17
45: ; preds = %17
%46 = load i32*, i32** %6
%47 = call i32 @fclose(i32* %46)
%48 = load i32*, i32** %7
%49 = call i32 @fclose(i32* %48)
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@.str = [28 x i8] c"../../dicts/mpos/mobyposi.i\00"
@.str.1 = [3 x i8] c"r+\00"
@.str.2 = [24 x i8] c"../../dicts/posDict.txt\00"
@.str.3 = [2 x i8] c"w\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([28 x i8], [28 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 ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call dereferenceable_or_null(512) i8* @malloc(i32 512)
%6 = tail call i32 @fgets(i8* %5, i32 512, i32* %3)
%7 = tail call i32 @feof(i32* %3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %2, %20
%10 = tail call dereferenceable_or_null(512) i8* @malloc(i32 512)
%11 = tail call i32 @strcpy(i8* %10, i8* %5)
%12 = tail call i32 @strlen(i8* %10)
%13 = add nsw i32 %12, -2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %10, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 104
br i1 %17, label %20, label %18
18: ; preds = %9
%19 = tail call i32 @fputs(i8* %10, i32* %4)
br label %20
20: ; preds = %18, %9
%21 = tail call i32 @fgets(i8* %5, i32 512, i32* %3)
%22 = tail call i32 @feof(i32* %3)
%23 = icmp eq i32 %22, 0
br i1 %23, label %9, label %24
24: ; preds = %20, %2
%25 = tail call i32 @fclose(i32* %3)
%26 = tail call i32 @fclose(i32* %4)
ret i32 0
}