#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 */
struct winsize {
  int ws_col;
};

/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ TIOCGWINSZ;
int /*<<< orphan*/ ioctl(int /*<<< orphan*/, int /*<<< orphan*/,
                         struct winsize *);
int /*<<< orphan*/ printf(char *);
void line() {
  int i;
  struct winsize w;
  ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
  for (i = 0; i < w.ws_col; i++)
    printf("=");
  printf("\n");
}


x86 assembly (clang, -O0):
<line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
mov    0x2e98(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdx
call   1040 <ioctl@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1170 <line+0x50>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    114a <line+0x2a>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<line>:
push   %rbx
sub    $0x10,%rsp
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
call   1040 <ioctl@plt>
cmpl   $0x0,0x8(%rsp)
jle    1163 <line+0x43>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x3d,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0x8(%rsp),%ebx
jl     1150 <line+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.winsize = type { i32 }
@STDOUT_FILENO = global i32 0
@TIOCGWINSZ = global i32 0
@.str = [2 x i8] c"=\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @line() {
%1 = alloca i32
%2 = alloca %struct.winsize
%3 = load i32, i32* @STDOUT_FILENO
%4 = load i32, i32* @TIOCGWINSZ
%5 = call i32 @ioctl(i32 %3, i32 %4, %struct.winsize* %2)
store i32 0, i32* %1
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %1
%8 = getelementptr inbounds %struct.winsize, %struct.winsize* %2, i32 0, i32 0
%9 = load i32, i32* %8
%10 = icmp slt i32 %7, %9
br i1 %10, label %11, label %16
11: ; preds = %6
%12 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11
%14 = load i32, i32* %1
%15 = add nsw i32 %14, 1
store i32 %15, i32* %1
br label %6
16: ; preds = %6
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.winsize = type { i32 }
@STDOUT_FILENO = global i32 0
@TIOCGWINSZ = global i32 0
define void @line() {
%1 = alloca %struct.winsize
%2 = bitcast %struct.winsize* %1 to i8*
%3 = load i32, i32* @STDOUT_FILENO
%4 = load i32, i32* @TIOCGWINSZ
%5 = call i32 @ioctl(i32 %3, i32 %4, %struct.winsize* %1)
%6 = getelementptr inbounds %struct.winsize, %struct.winsize* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %0, %9
%10 = phi i32 [ %12, %9 ], [ 0, %0 ]
%11 = call i32 @putchar(i32 61)
%12 = add nuw nsw i32 %10, 1
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %9, label %15
15: ; preds = %9, %0
%16 = call i32 @putchar(i32 10)
ret void
}