#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 */

/* Variables and functions */
int /*<<< orphan*/ estripa(char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
scalar_t__ getpid();
int /*<<< orphan*/ liane_compila(char *);
int /*<<< orphan*/ liane_inicia_compilador(char *, char *);
int /*<<< orphan*/ liane_termina_compilador();
int /*<<< orphan*/ saiArquivo(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ unlink(char *);
int /*<<< orphan*/ utfToISO(char *);
int main() {
  char str_buf[256 + 2];
  char temp[20];
  char pid[6];
  sprintf(pid, "%05d", (int)getpid());
  strcpy(temp, "/tmp/");
  strcat(temp, pid);
  strcat(temp, ".pho");
  liane_inicia_compilador("liane", temp);
  while (fgets(str_buf, 256 + 1, stdin) != NULL) {
    estripa(str_buf);
    utfToISO(str_buf);
    liane_compila(str_buf);
    saiArquivo(temp);
  }
  liane_termina_compilador();
  unlink(temp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x136(%rbp),%rax
mov    %rax,-0x140(%rbp)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    -0x140(%rbp),%rdi
mov    %eax,%edx
lea    0xe09(%rip),%rsi
call   10e0 <sprintf@plt>
lea    -0x130(%rbp),%rdi
lea    0xdfb(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x130(%rbp),%rdi
lea    -0x136(%rbp),%rsi
call   10d0 <strcat@plt>
lea    -0x130(%rbp),%rdi
lea    0xddb(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x130(%rbp),%rsi
lea    0xdcd(%rip),%rdi
call   10c0 <liane_inicia_compilador@plt>
lea    -0x110(%rbp),%rdi
mov    0x2d92(%rip),%rax
mov    (%rax),%edx
mov    $0x101,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     12a1 <main+0xe1>
lea    -0x110(%rbp),%rdi
call   1060 <estripa@plt>
lea    -0x110(%rbp),%rdi
call   10a0 <utfToISO@plt>
lea    -0x110(%rbp),%rdi
call   10b0 <liane_compila@plt>
lea    -0x130(%rbp),%rdi
call   1080 <saiArquivo@plt>
jmp    1248 <main+0x88>
mov    $0x0,%al
call   1070 <liane_termina_compilador@plt>
lea    -0x130(%rbp),%rdi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x140,%rsp
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xe26(%rip),%rsi
lea    0xa(%rsp),%r14
mov    %r14,%rdi
mov    %eax,%edx
call   10e0 <sprintf@plt>
lea    0xe15(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10d0 <strcat@plt>
lea    0xdfc(%rip),%rsi
mov    %rbx,%rdi
call   10d0 <strcat@plt>
lea    0xdf2(%rip),%rdi
mov    %rbx,%rsi
call   10c0 <liane_inicia_compilador@plt>
mov    0x2dbb(%rip),%r15
mov    (%r15),%edx
lea    0x30(%rsp),%rdi
mov    $0x101,%esi
call   1090 <fgets@plt>
test   %rax,%rax
je     1285 <main+0xc5>
lea    0x30(%rsp),%rbx
lea    0x10(%rsp),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1060 <estripa@plt>
mov    %rbx,%rdi
call   10a0 <utfToISO@plt>
mov    %rbx,%rdi
call   10b0 <liane_compila@plt>
mov    %r14,%rdi
call   1080 <saiArquivo@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x101,%esi
call   1090 <fgets@plt>
test   %rax,%rax
jne    1250 <main+0x90>
xor    %eax,%eax
call   1070 <liane_termina_compilador@plt>
lea    0x10(%rsp),%rdi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%05d\00"
@.str.1 = [6 x i8] c"/tmp/\00"
@.str.2 = [5 x i8] c".pho\00"
@.str.3 = [6 x i8] c"liane\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [258 x i8]
%3 = alloca [20 x i8]
%4 = alloca [6 x i8]
store i32 0, i32* %1
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%6 = call i64 (...) @getpid()
%7 = trunc i64 %6 to i32
%8 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%13 = call i32 @strcat(i8* %11, i8* %12)
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%15 = call i32 @strcat(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%17 = call i32 @liane_inicia_compilador(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %23, %0
%19 = getelementptr inbounds [258 x i8], [258 x i8]* %2, i64 0, i64 0
%20 = load i32, i32* @stdin
%21 = call i32* @fgets(i8* %19, i32 257, i32 %20)
%22 = icmp ne i32* %21, null
br i1 %22, label %23, label %32
23: ; preds = %18
%24 = getelementptr inbounds [258 x i8], [258 x i8]* %2, i64 0, i64 0
%25 = call i32 @estripa(i8* %24)
%26 = getelementptr inbounds [258 x i8], [258 x i8]* %2, i64 0, i64 0
%27 = call i32 @utfToISO(i8* %26)
%28 = getelementptr inbounds [258 x i8], [258 x i8]* %2, i64 0, i64 0
%29 = call i32 @liane_compila(i8* %28)
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%31 = call i32 @saiArquivo(i8* %30)
br label %18
32: ; preds = %18
%33 = call i32 (...) @liane_termina_compilador()
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%35 = call i32 @unlink(i8* %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%05d\00"
@.str.1 = [6 x i8] c"/tmp/\00"
@.str.2 = [5 x i8] c".pho\00"
@.str.3 = [6 x i8] c"liane\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca [258 x i8]
%2 = alloca [20 x i8]
%3 = alloca [6 x i8]
%4 = getelementptr inbounds [258 x i8], [258 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%7 = tail call i64 (...) @getpid()
%8 = trunc i64 %7 to i32
%9 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @strcat(i8* %5, i8* %6)
%12 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @liane_inicia_compilador(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %5)
%14 = load i32, i32* @stdin
%15 = call i32* @fgets(i8* %4, i32 257, i32 %14)
%16 = icmp eq i32* %15, null
br i1 %16, label %25, label %17
17: ; preds = %0, %17
%18 = call i32 @estripa(i8* %4)
%19 = call i32 @utfToISO(i8* %4)
%20 = call i32 @liane_compila(i8* %4)
%21 = call i32 @saiArquivo(i8* %5)
%22 = load i32, i32* @stdin
%23 = call i32* @fgets(i8* %4, i32 257, i32 %22)
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %17
25: ; preds = %17, %0
%26 = call i32 (...) @liane_termina_compilador()
%27 = call i32 @unlink(i8* %5)
ret i32 0
}