#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 *, int);
int /*<<< orphan*/ entab(char *, int);
int getline(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ printline(char *);
int /*<<< orphan*/ settab(int, char **);
int strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  char line[1024];
  char before[1024];
  settab(argc, argv);
  int len;
  printf("testing for detab and entab, first detab, then entab\n"
         "input a line with tabs:\n");
  len = getline(line, 1024);
  printf("the string you input just now is:\n'%s'\n", line);
  printline(line);
  strcpy(before, line);
  detab(line, len);
  printf("after detabing is:\n'%s'\n", line);
  printline(line);
  entab(line, len);
  printf("after converting, the string is:\n'%s'\n", line);
  printline(line);
  printf("testing result is: %d\n", strcmp(before, line));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <settab@plt>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   1090 <getline@plt>
mov    %eax,-0x814(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x410(%rbp),%rdi
call   1080 <printline@plt>
lea    -0x810(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x410(%rbp),%rdi
mov    -0x814(%rbp),%esi
call   1050 <detab@plt>
lea    -0x410(%rbp),%rsi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x410(%rbp),%rdi
call   1080 <printline@plt>
lea    -0x410(%rbp),%rdi
mov    -0x814(%rbp),%esi
call   10a0 <entab@plt>
lea    -0x410(%rbp),%rsi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x410(%rbp),%rdi
call   1080 <printline@plt>
lea    -0x810(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1070 <strcmp@plt>
mov    %eax,%esi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x800,%rsp
call   1030 <settab@plt>
lea    0xed8(%rip),%rdi
call   1050 <puts@plt>
lea    0x400(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   10a0 <getline@plt>
mov    %eax,%ebp
lea    0xe36(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1090 <printline@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <detab@plt>
lea    0xe2d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1090 <printline@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   10b0 <entab@plt>
lea    0xe23(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1090 <printline@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <strcmp@plt>
lea    0xe26(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [78 x i8] c"testing for detab and entab, first detab, then entab\0Ainput a line with tabs:\0A\00"
@.str.1 = [40 x i8] c"the string you input just now is:\0A'%s'\0A\00"
@.str.2 = [25 x i8] c"after detabing is:\0A'%s'\0A\00"
@.str.3 = [39 x i8] c"after converting, the string is:\0A'%s'\0A\00"
@.str.4 = [23 x i8] c"testing result is: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @settab(i32 %9, i8** %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%14 = call i32 @getline(i8* %13, i32 1024)
store i32 %14, i32* %8
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%18 = call i32 @printline(i8* %17)
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%21 = call i32 @strcpy(i8* %19, i8* %20)
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%23 = load i32, i32* %8
%24 = call i32 @detab(i8* %22, i32 %23)
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%28 = call i32 @printline(i8* %27)
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%30 = load i32, i32* %8
%31 = call i32 @entab(i8* %29, i32 %30)
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %32)
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%35 = call i32 @printline(i8* %34)
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%38 = call i32 @strcmp(i8* %36, i8* %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %38)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [40 x i8] c"the string you input just now is:\0A'%s'\0A\00"
@.str.2 = [25 x i8] c"after detabing is:\0A'%s'\0A\00"
@.str.3 = [39 x i8] c"after converting, the string is:\0A'%s'\0A\00"
@.str.4 = [23 x i8] c"testing result is: %d\0A\00"
@str = [77 x i8] c"testing for detab and entab, first detab, then entab\0Ainput a line with tabs:\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @settab(i32 %0, i8** %1)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str, i64 0, i64 0))
%9 = call i32 @getline(i8* %5, i32 1024)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%11 = call i32 @printline(i8* %5)
%12 = call i32 @strcpy(i8* %6, i8* %5)
%13 = call i32 @detab(i8* %5, i32 %9)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%15 = call i32 @printline(i8* %5)
%16 = call i32 @entab(i8* %5, i32 %9)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %5)
%18 = call i32 @printline(i8* %5)
%19 = call i32 @strcmp(i8* %6, i8* %5)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %19)
ret i32 0
}