#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 atoi(char *);
int /*<<< orphan*/ detab(int, char *);
char getline_my(char *);
int isnumber(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  int i = 0;
  int offset_size = 0;
  char exit = 1;
  char rez = 0;
  char tmp_line[100];
  if (argc == 1) {
    offset_size = 4;
    exit = 0;
  } else {
    if (argc != 3) {
      printf(
          "Usage: detab -n x (wheres x - count of blanks to replace tabs)\n");
    } else {
      *argv++;
      if (strcmp(*argv, "-n") == 0) {
        *argv++;
        if (isnumber(*argv) == 1) {
          offset_size = atoi(*argv);
          exit = 0;
          printf("in rezult getted offset_size of tab replacing is: %d.\n",
                 offset_size);
        } else {
          printf("Entered argument is not number.\n");
        }
      } else {
        printf("Wrong argument name. Needs -n instead %s.\n", *argv);
      }
    }
  }
  while (exit != 1) {
    if ((rez = getline_my(tmp_line)) == 0) {
      printf("getted line   = '%s';\n", tmp_line);
      detab(offset_size, tmp_line);
      printf("detabbed line = '%s';\n", tmp_line);
      for (i = 0; tmp_line[i] != '\0'; i++) {
        printf("tmp_line [ %d ] = '%c' as char and %d as digit.\n", i,
               tmp_line[i], tmp_line[i]);
      }
    } else {
      exit = 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movb   $0x1,-0x19(%rbp)
movb   $0x0,-0x1a(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11a9 <main+0x49>
movl   $0x4,-0x18(%rbp)
movb   $0x0,-0x19(%rbp)
jmp    126b <main+0x10b>
cmpl   $0x3,-0x8(%rbp)
je     11c6 <main+0x66>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1266 <main+0x106>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe60(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    124c <main+0xec>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <isnumber@plt>
cmp    $0x1,%eax
jne    1239 <main+0xd9>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x18(%rbp)
movb   $0x0,-0x19(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1247 <main+0xe7>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1261 <main+0x101>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1266 <main+0x106>
jmp    126b <main+0x10b>
jmp    1270 <main+0x110>
movsbl -0x19(%rbp),%eax
cmp    $0x1,%eax
je     131d <main+0x1bd>
lea    -0x80(%rbp),%rdi
call   1070 <getline_my@plt>
mov    %al,-0x1a(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
jne    1314 <main+0x1b4>
lea    -0x80(%rbp),%rsi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%edi
lea    -0x80(%rbp),%rsi
call   1030 <detab@plt>
lea    -0x80(%rbp),%rsi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     130f <main+0x1af>
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%edx
movslq -0x14(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%ecx
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12cc <main+0x16c>
jmp    1318 <main+0x1b8>
movb   $0x1,-0x19(%rbp)
jmp    1270 <main+0x110>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
cmp    $0x1,%edi
je     11bf <main+0x4f>
cmp    $0x3,%edi
jne    1250 <main+0xe0>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe66(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     126d <main+0xfd>
mov    0x8(%rbx),%rsi
lea    0xe87(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    125c <main+0xec>
mov    $0x4,%r12d
mov    %rsp,%rdi
call   1080 <getline_my@plt>
test   %al,%al
jne    125c <main+0xec>
lea    0xe89(%rip),%r14
mov    %rsp,%r13
lea    0xe96(%rip),%r15
lea    0xea6(%rip),%rbp
jmp    11fc <main+0x8c>
nop
mov    %r13,%rdi
call   1080 <getline_my@plt>
test   %al,%al
jne    125c <main+0xec>
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12d,%edi
mov    %r13,%rsi
call   1040 <detab@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%al
test   %al,%al
je     11f0 <main+0x80>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsbl %al,%ecx
mov    %rbp,%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    1230 <main+0xc0>
jmp    11f0 <main+0x80>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%rbx),%rdi
call   1070 <isnumber@plt>
cmp    $0x1,%eax
jne    129c <main+0x12c>
mov    0x10(%rbx),%rdi
call   1090 <atoi@plt>
mov    %eax,%r12d
lea    0xd75(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11c5 <main+0x55>
lea    0xe21(%rip),%rdi
jmp    1257 <main+0xe7>

LLVM IR (-O0):
@.str = [64 x i8] c"Usage: detab -n x (wheres x - count of blanks to replace tabs)\0A\00"
@.str.1 = [3 x i8] c"-n\00"
@.str.2 = [55 x i8] c"in rezult getted offset_size of tab replacing is: %d.\0A\00"
@.str.3 = [33 x i8] c"Entered argument is not number.\0A\00"
@.str.4 = [43 x i8] c"Wrong argument name. Needs -n instead %s.\0A\00"
@.str.5 = [23 x i8] c"getted line = '%s';\0A\00"
@.str.6 = [23 x i8] c"detabbed line = '%s';\0A\00"
@.str.7 = [49 x i8] c"tmp_line [ %d ] = '%c' as char and %d as digit.\0A\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 [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i8 1, i8* %8
store i8 0, i8* %9
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 4, i32* %7
store i8 0, i8* %8
br label %50
14: ; preds = %2
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 3
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
br label %49
19: ; preds = %14
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i32 1
store i8** %21, i8*** %5
%22 = load i8*, i8** %20
%23 = load i8**, i8*** %5
%24 = load i8*, i8** %23
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %44
27: ; preds = %19
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i32 1
store i8** %29, i8*** %5
%30 = load i8*, i8** %28
%31 = load i8**, i8*** %5
%32 = load i8*, i8** %31
%33 = call i32 @isnumber(i8* %32)
%34 = icmp eq i32 %33, 1
br i1 %34, label %35, label %41
35: ; preds = %27
%36 = load i8**, i8*** %5
%37 = load i8*, i8** %36
%38 = call i32 @atoi(i8* %37)
store i32 %38, i32* %7
store i8 0, i8* %8
%39 = load i32, i32* %7
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 %39)
br label %43
41: ; preds = %27
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %41, %35
br label %48
44: ; preds = %19
%45 = load i8**, i8*** %5
%46 = load i8*, i8** %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %46)
br label %48
48: ; preds = %44, %43
br label %49
49: ; preds = %48, %17
br label %50
50: ; preds = %49, %13
br label %51
51: ; preds = %93, %50
%52 = load i8, i8* %8
%53 = sext i8 %52 to i32
%54 = icmp ne i32 %53, 1
br i1 %54, label %55, label %94
55: ; preds = %51
%56 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%57 = call signext i8 @getline_my(i8* %56)
store i8 %57, i8* %9
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %92
60: ; preds = %55
%61 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %61)
%63 = load i32, i32* %7
%64 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%65 = call i32 @detab(i32 %63, i8* %64)
%66 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %66)
store i32 0, i32* %6
br label %68
68: ; preds = %88, %60
%69 = load i32, i32* %6
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %91
75: ; preds = %68
%76 = load i32, i32* %6
%77 = load i32, i32* %6
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 %78
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = load i32, i32* %6
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 %83
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i32 %76, i32 %81, i32 %86)
br label %88
88: ; preds = %75
%89 = load i32, i32* %6
%90 = add nsw i32 %89, 1
store i32 %90, i32* %6
br label %68
91: ; preds = %68
br label %93
92: ; preds = %55
store i8 1, i8* %8
br label %93
93: ; preds = %92, %91
br label %51
94: ; preds = %51
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"-n\00"
@.str.2 = [55 x i8] c"in rezult getted offset_size of tab replacing is: %d.\0A\00"
@.str.4 = [43 x i8] c"Wrong argument name. Needs -n instead %s.\0A\00"
@.str.5 = [23 x i8] c"getted line = '%s';\0A\00"
@.str.6 = [23 x i8] c"detabbed line = '%s';\0A\00"
@.str.7 = [49 x i8] c"tmp_line [ %d ] = '%c' as char and %d as digit.\0A\00"
@str = [32 x i8] c"Entered argument is not number.\00"
@str.8 = [63 x i8] c"Usage: detab -n x (wheres x - count of blanks to replace tabs)\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
switch i32 %0, label %5 [
i32 1, label %26
i32 3, label %7
]
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.8, i64 0, i64 0))
br label %49
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %23
12: ; preds = %7
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @isnumber(i8* %14)
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = load i8*, i8** %13
%19 = tail call i32 @atoi(i8* %18)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %26
21: ; preds = %12
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %49
23: ; preds = %7
%24 = load i8*, i8** %8
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %24)
br label %49
26: ; preds = %17, %2
%27 = phi i32 [ %19, %17 ], [ 4, %2 ]
%28 = call signext i8 @getline_my(i8* %4)
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %49
30: ; preds = %26, %46
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%32 = call i32 @detab(i32 %27, i8* %4)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%34 = load i8, i8* %4
%35 = icmp eq i8 %34, 0
br i1 %35, label %46, label %36
36: ; preds = %30, %36
%37 = phi i64 [ %42, %36 ], [ 0, %30 ]
%38 = phi i8 [ %44, %36 ], [ %34, %30 ]
%39 = sext i8 %38 to i32
%40 = trunc i64 %37 to i32
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i32 %40, i32 %39, i32 %39)
%42 = add nuw i64 %37, 1
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 0
br i1 %45, label %46, label %36
46: ; preds = %36, %30
%47 = call signext i8 @getline_my(i8* %4)
%48 = icmp eq i8 %47, 0
br i1 %48, label %30, label %49
49: ; preds = %46, %26, %23, %21, %5
ret i32 0
}