#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 */
char *detab(char *);
int /*<<< orphan*/ free(char *);
int getline(char **, int *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int main() {
  char *line = NULL;
  char *newline;
  int len;
  while (getline(&line, &len, stdin) != -1) {
    newline = detab(line);
    printf("%s", newline);
    free(newline);
  }
  free(line);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1060 <getline@plt>
cmp    $0xffffffff,%eax
je     11a1 <main+0x61>
mov    -0x10(%rbp),%rdi
call   1040 <detab@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe72(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    1157 <main+0x17>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
movq   $0x0,(%rsp)
mov    0x2e8c(%rip),%r13
mov    0x0(%r13),%edx
mov    %rsp,%rdi
lea    0xc(%rsp),%rsi
call   1060 <getline@plt>
cmp    $0xffffffff,%eax
je     11c3 <main+0x83>
lea    0xe87(%rip),%r14
mov    %rsp,%r15
lea    0xc(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rsp),%rdi
call   1040 <detab@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x0(%r13),%edx
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <getline@plt>
cmp    $0xffffffff,%eax
jne    1190 <main+0x50>
mov    (%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
store i8* null, i8** %2
br label %5
5: ; preds = %9, %0
%6 = load i32, i32* @stdin
%7 = call i32 @getline(i8** %2, i32* %4, i32 %6)
%8 = icmp ne i32 %7, -1
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = call i8* @detab(i8* %10)
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %3
%15 = call i32 @free(i8* %14)
br label %5
16: ; preds = %5
%17 = load i8*, i8** %2
%18 = call i32 @free(i8* %17)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i32
%3 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%4 = bitcast i32* %2 to i8*
%5 = load i32, i32* @stdin
%6 = call i32 @getline(i8** %1, i32* %2, i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %16, label %8
8: ; preds = %0, %8
%9 = load i8*, i8** %1
%10 = call i8* @detab(i8* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = call i32 @free(i8* %10)
%13 = load i32, i32* @stdin
%14 = call i32 @getline(i8** %1, i32* %2, i32 %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %8
16: ; preds = %8, %0
%17 = load i8*, i8** %1
%18 = call i32 @free(i8* %17)
ret i32 0
}