#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*/ entab(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: entab -n x (wheres x - count of blanks to replace by "
             "tabs)\n");
    }
  }
  if (exit != 1) {
    *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);
      entab(offset_size, tmp_line);
      printf("entabbed 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    11c6 <main+0x66>
cmpl   $0x3,-0x8(%rbp)
je     11c1 <main+0x61>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c6 <main+0x66>
movsbl -0x19(%rbp),%eax
cmp    $0x1,%eax
je     1273 <main+0x113>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe56(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1259 <main+0xf9>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <isnumber@plt>
cmp    $0x1,%eax
jne    1246 <main+0xe6>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
movb   $0x0,-0x19(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1254 <main+0xf4>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126e <main+0x10e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1273 <main+0x113>
jmp    1278 <main+0x118>
movsbl -0x19(%rbp),%eax
cmp    $0x1,%eax
je     1325 <main+0x1c5>
lea    -0x80(%rbp),%rdi
call   1060 <getline_my@plt>
mov    %al,-0x1a(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
jne    131c <main+0x1bc>
lea    -0x80(%rbp),%rsi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%edi
lea    -0x80(%rbp),%rsi
call   1080 <entab@plt>
lea    -0x80(%rbp),%rsi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1317 <main+0x1b7>
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    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12d4 <main+0x174>
jmp    1320 <main+0x1c0>
movb   $0x1,-0x19(%rbp)
jmp    1278 <main+0x118>
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     119a <main+0x2a>
cmp    $0x3,%edi
je     1210 <main+0xa0>
lea    0xf51(%rip),%rdi
call   1030 <puts@plt>
jmp    1210 <main+0xa0>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe58(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11c6 <main+0x56>
mov    0x8(%rbx),%rsi
lea    0xe7d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11fe <main+0x8e>
mov    0x10(%rbx),%rdi
call   1060 <isnumber@plt>
cmp    $0x1,%eax
jne    11f2 <main+0x82>
mov    0x10(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%r12d
lea    0xe1c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1204 <main+0x94>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
mov    $0x4,%r12d
mov    %rsp,%rdi
call   1070 <getline_my@plt>
test   %al,%al
je     1221 <main+0xb1>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe3d(%rip),%r14
mov    %rsp,%r13
lea    0xe4a(%rip),%r15
lea    0xe5a(%rip),%rbp
jmp    124c <main+0xdc>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1070 <getline_my@plt>
test   %al,%al
jne    1210 <main+0xa0>
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12d,%edi
mov    %r13,%rsi
call   1090 <entab@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%al
test   %al,%al
je     1240 <main+0xd0>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsbl %al,%ecx
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x1(%rsp,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1280 <main+0x110>
jmp    1240 <main+0xd0>

LLVM IR (-O0):
@.str = [67 x i8] c"Usage: entab -n x (wheres x - count of blanks to replace by 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"entabbed 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 %20
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 ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
br label %20
20: ; preds = %19, %13
%21 = load i8, i8* %8
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 1
br i1 %23, label %24, label %54
24: ; preds = %20
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i32 1
store i8** %26, i8*** %5
%27 = load i8*, i8** %25
%28 = load i8**, i8*** %5
%29 = load i8*, i8** %28
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %49
32: ; preds = %24
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i32 1
store i8** %34, i8*** %5
%35 = load i8*, i8** %33
%36 = load i8**, i8*** %5
%37 = load i8*, i8** %36
%38 = call i32 @isnumber(i8* %37)
%39 = icmp eq i32 %38, 1
br i1 %39, label %40, label %46
40: ; preds = %32
%41 = load i8**, i8*** %5
%42 = load i8*, i8** %41
%43 = call i32 @atoi(i8* %42)
store i32 %43, i32* %7
store i8 0, i8* %8
%44 = load i32, i32* %7
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 %44)
br label %48
46: ; preds = %32
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %48
48: ; preds = %46, %40
br label %53
49: ; preds = %24
%50 = load i8**, i8*** %5
%51 = load i8*, i8** %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %51)
br label %53
53: ; preds = %49, %48
br label %54
54: ; preds = %53, %20
br label %55
55: ; preds = %97, %54
%56 = load i8, i8* %8
%57 = sext i8 %56 to i32
%58 = icmp ne i32 %57, 1
br i1 %58, label %59, label %98
59: ; preds = %55
%60 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%61 = call signext i8 @getline_my(i8* %60)
store i8 %61, i8* %9
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %96
64: ; preds = %59
%65 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %65)
%67 = load i32, i32* %7
%68 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%69 = call i32 @entab(i32 %67, i8* %68)
%70 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %70)
store i32 0, i32* %6
br label %72
72: ; preds = %92, %64
%73 = load i32, i32* %6
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 %74
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %95
79: ; preds = %72
%80 = load i32, i32* %6
%81 = load i32, i32* %6
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 %82
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = load i32, i32* %6
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 %87
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i32 %80, i32 %85, i32 %90)
br label %92
92: ; preds = %79
%93 = load i32, i32* %6
%94 = add nsw i32 %93, 1
store i32 %94, i32* %6
br label %72
95: ; preds = %72
br label %97
96: ; preds = %59
store i8 1, i8* %8
br label %97
97: ; preds = %96, %95
br label %55
98: ; preds = %55
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"entabbed 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 = [66 x i8] c"Usage: entab -n x (wheres x - count of blanks to replace by 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 %7
i32 3, label %49
]
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 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 %26
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 %26
26: ; preds = %17, %21, %23
%27 = phi i32 [ 4, %23 ], [ 4, %21 ], [ %19, %17 ]
%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 @entab(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, %5, %2
ret i32 0
}