#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*/ detab(char *, char *);
int getline_my(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int len = 0;
  char line[100];
  char newline[100];
  int i = 0;
  printf("Input, please, lines to detab:\n");
  while ((len = getline_my(line, 100)) > 0) {
    detab(newline, line);
    printf("%s;\n", newline);
    i = 0;
    while (newline[i] != '\0') {
      printf("newline [ %d ] = '%c' and %d;\n", i, newline[i], newline[i]);
      i++;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xe4(%rbp)
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    $0x64,%esi
call   1050 <getline_my@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    120d <main+0xdd>
lea    -0xe0(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1030 <detab@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xe4(%rbp)
movslq -0xe4(%rbp),%rax
movsbl -0xe0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     1208 <main+0xd8>
mov    -0xe4(%rbp),%esi
movslq -0xe4(%rbp),%rax
movsbl -0xe0(%rbp,%rax,1),%edx
ff
movslq -0xe4(%rbp),%rax
movsbl -0xe0(%rbp,%rax,1),%ecx
ff
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    11aa <main+0x7a>
jmp    1161 <main+0x31>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe0,%rsp
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
lea    0x70(%rsp),%rdi
mov    $0x64,%esi
call   1060 <getline_my@plt>
test   %eax,%eax
jle    11f0 <main+0xb0>
mov    %rsp,%r14
lea    0x70(%rsp),%r12
lea    0xe7e(%rip),%r15
lea    0xe7c(%rip),%r13
jmp    11a1 <main+0x61>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    $0x64,%esi
call   1060 <getline_my@plt>
test   %eax,%eax
jle    11f0 <main+0xb0>
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <detab@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%al
test   %al,%al
je     1190 <main+0x50>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%ecx
mov    %r13,%rdi
mov    %ebx,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x1(%rsp,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    11d0 <main+0x90>
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Input, please, lines to detab:\0A\00"
@.str.1 = [5 x i8] c"%s;\0A\00"
@.str.2 = [31 x i8] c"newline [ %d ] = '%c' and %d;\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %39, %0
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%9 = call i32 @getline_my(i8* %8, i32 100)
store i32 %9, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %40
11: ; preds = %7
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%14 = call i32 @detab(i8* %12, i8* %13)
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %15)
store i32 0, i32* %5
br label %17
17: ; preds = %24, %11
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %39
24: ; preds = %17
%25 = load i32, i32* %5
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 %30, i32 %35)
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %17
39: ; preds = %17
br label %7
40: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%s;\0A\00"
@.str.2 = [31 x i8] c"newline [ %d ] = '%c' and %d;\0A\00"
@str = [31 x i8] c"Input, please, lines to detab:\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%6 = call i32 @getline_my(i8* %3, i32 100)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %11, label %26
8: ; preds = %16, %11
%9 = call i32 @getline_my(i8* %3, i32 100)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %26
11: ; preds = %0, %8
%12 = call i32 @detab(i8* %4, i8* %3)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%14 = load i8, i8* %4
%15 = icmp eq i8 %14, 0
br i1 %15, label %8, label %16
16: ; preds = %11, %16
%17 = phi i64 [ %22, %16 ], [ 0, %11 ]
%18 = phi i8 [ %24, %16 ], [ %14, %11 ]
%19 = sext i8 %18 to i32
%20 = trunc i64 %17 to i32
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %20, i32 %19, i32 %19)
%22 = add nuw i64 %17, 1
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %8, label %16
26: ; preds = %8, %0
ret i32 0
}