#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 */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ mvwaddch(int /*<<< orphan*/ *, int, int, char);
int /*<<< orphan*/ whline(int /*<<< orphan*/ *, unsigned long, int);
void draw_hbar(WINDOW *win, int y, int start, int len, unsigned long ptn,
               bool end) {
  mvwaddch(win, y, start, ptn);
  whline(win, ptn, len);
  if (end) {
    mvwaddch(win, y, 125 + 16, ']');
  }
}


x86 assembly (clang, -O0):
<draw_hbar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x20(%rbp),%rax
movsbl %al,%ecx
call   1040 <mvwaddch@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <whline@plt>
cmpl   $0x0,-0x24(%rbp)
je     1183 <draw_hbar+0x63>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x8d,%edx
mov    $0x5d,%ecx
call   1040 <mvwaddch@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_hbar>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r9d,%r14d
mov    %r8,%rbp
mov    %ecx,%r12d
mov    %esi,%r15d
mov    %rdi,%rbx
movsbl %bpl,%ecx
call   1040 <mvwaddch@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12d,%edx
call   1030 <whline@plt>
test   %r14d,%r14d
je     1170 <draw_hbar+0x50>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    $0x8d,%edx
mov    $0x5d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <mvwaddch@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @draw_hbar(i32* %0, i32 %1, i32 %2, i32 %3, i64 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i32
store i32* %0, i32** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i64 %4, i64* %11
store i32 %5, i32* %12
%13 = load i32*, i32** %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = load i64, i64* %11
%17 = trunc i64 %16 to i8
%18 = call i32 @mvwaddch(i32* %13, i32 %14, i32 %15, i8 signext %17)
%19 = load i32*, i32** %7
%20 = load i64, i64* %11
%21 = load i32, i32* %10
%22 = call i32 @whline(i32* %19, i64 %20, i32 %21)
%23 = load i32, i32* %12
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %6
%26 = load i32*, i32** %7
%27 = load i32, i32* %8
%28 = call i32 @mvwaddch(i32* %26, i32 %27, i32 141, i8 signext 93)
br label %29
29: ; preds = %25, %6
ret void
}

LLVM IR (-O2):
define void @draw_hbar(i32* %0, i32 %1, i32 %2, i32 %3, i64 %4, i32 %5) {
%7 = trunc i64 %4 to i8
%8 = tail call i32 @mvwaddch(i32* %0, i32 %1, i32 %2, i8 signext %7)
%9 = tail call i32 @whline(i32* %0, i64 %4, i32 %3)
%10 = icmp eq i32 %5, 0
br i1 %10, label %13, label %11
11: ; preds = %6
%12 = tail call i32 @mvwaddch(i32* %0, i32 %1, i32 141, i8 signext 93)
br label %13
13: ; preds = %11, %6
ret void
}