#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*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int tigetnum(char *);
void show_tabs(void) {
  int i, co = tigetnum("cols");
  if (co > 0) {
    printf("\r         ");
    for (i = 10; i < co - 2; i += 10)
      printf("%-10d", i);
    putchar('\n');
    for (i = 1; i <= co; i++)
      putchar(i % 10 + '0');
    putchar('\n');
    for (i = 1; i < co; i++)
      printf("\tT\b");
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<show_tabs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1050 <tigetnum@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    121c <show_tabs+0xec>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    1196 <show_tabs+0x66>
mov    -0x4(%rbp),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    1166 <show_tabs+0x36>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11d9 <show_tabs+0xa9>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11a7 <show_tabs+0x77>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1212 <show_tabs+0xe2>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11ea <show_tabs+0xba>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_tabs>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
call   1050 <tigetnum@plt>
test   %eax,%eax
jle    11a1 <show_tabs+0x71>
mov    %eax,%r15d
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0xd,%r15d
jb     11ac <show_tabs+0x7c>
lea    -0x2(%r15),%ebx
mov    $0xa,%ebp
lea    0xea2(%rip),%r14
xchg   %ax,%ax
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xa,%ebp
cmp    %ebx,%ebp
jl     1170 <show_tabs+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r15d,%r15d
jg     11b6 <show_tabs+0x86>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1230 <show_tabs+0x100>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebp
mov    $0xcccccccd,%r14d
mov    %r15d,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebp,%eax
imul   %r14,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
mov    %ebp,%ecx
sub    %al,%cl
or     $0x30,%cl
movsbl %cl,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
add    $0xffffffff,%ebx
jne    11d0 <show_tabs+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x2,%r15d
jl     1230 <show_tabs+0x100>
add    $0xffffffff,%r15d
lea    0xe05(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%r15d
jne    1220 <show_tabs+0xf0>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"cols\00"
@.str.1 = [11 x i8] c"\0D \00"
@.str.2 = [6 x i8] c"%-10d\00"
@.str.3 = [4 x i8] c"\09T\08\00"
define void @show_tabs() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @tigetnum(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %47
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 10, i32* %1
br label %8
8: ; preds = %16, %6
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 2
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %19
13: ; preds = %8
%14 = load i32, i32* %1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %13
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 10
store i32 %18, i32* %1
br label %8
19: ; preds = %8
%20 = call i32 @putchar(i8 signext 10)
store i32 1, i32* %1
br label %21
21: ; preds = %31, %19
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %34
25: ; preds = %21
%26 = load i32, i32* %1
%27 = srem i32 %26, 10
%28 = add nsw i32 %27, 48
%29 = trunc i32 %28 to i8
%30 = call i32 @putchar(i8 signext %29)
br label %31
31: ; preds = %25
%32 = load i32, i32* %1
%33 = add nsw i32 %32, 1
store i32 %33, i32* %1
br label %21
34: ; preds = %21
%35 = call i32 @putchar(i8 signext 10)
store i32 1, i32* %1
br label %36
36: ; preds = %42, %34
%37 = load i32, i32* %1
%38 = load i32, i32* %2
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %45
40: ; preds = %36
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %42
42: ; preds = %40
%43 = load i32, i32* %1
%44 = add nsw i32 %43, 1
store i32 %44, i32* %1
br label %36
45: ; preds = %36
%46 = call i32 @putchar(i8 signext 10)
br label %47
47: ; preds = %45, %0
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"cols\00"
@.str.1 = [11 x i8] c"\0D \00"
@.str.2 = [6 x i8] c"%-10d\00"
@.str.3 = [4 x i8] c"\09T\08\00"
define void @show_tabs() {
%1 = tail call i32 @tigetnum(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = icmp sgt i32 %1, 0
br i1 %2, label %3, label %38
3: ; preds = %0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%5 = add nsw i32 %1, -2
%6 = icmp ugt i32 %1, 12
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @putchar(i8 signext 10)
br label %17
9: ; preds = %3, %9
%10 = phi i32 [ %12, %9 ], [ 10, %3 ]
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i32 %10, 10
%13 = icmp slt i32 %12, %5
br i1 %13, label %9, label %14
14: ; preds = %9
%15 = tail call i32 @putchar(i8 signext 10)
%16 = icmp slt i32 %1, 1
br i1 %16, label %18, label %17
17: ; preds = %7, %14
br label %20
18: ; preds = %14
%19 = tail call i32 @putchar(i8 signext 10)
br label %36
20: ; preds = %17, %20
%21 = phi i32 [ %26, %20 ], [ 1, %17 ]
%22 = urem i32 %21, 10
%23 = trunc i32 %22 to i8
%24 = or i8 %23, 48
%25 = tail call i32 @putchar(i8 signext %24)
%26 = add nuw i32 %21, 1
%27 = icmp eq i32 %21, %1
br i1 %27, label %28, label %20
28: ; preds = %20
%29 = tail call i32 @putchar(i8 signext 10)
%30 = icmp sgt i32 %1, 1
br i1 %30, label %31, label %36
31: ; preds = %28, %31
%32 = phi i32 [ %34, %31 ], [ 1, %28 ]
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%34 = add nuw nsw i32 %32, 1
%35 = icmp eq i32 %34, %1
br i1 %35, label %36, label %31
36: ; preds = %31, %18, %28
%37 = tail call i32 @putchar(i8 signext 10)
br label %38
38: ; preds = %36, %0
ret void
}