#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*/ waddch(int /*<<< orphan*/ *, char const);
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
void curses_show_title(void *ui, const char *title) {
  WINDOW *win = ui;
  int i;
  wmove(win, 3, 0);
  for (i = 0; title[i] != 0; i++) {
    waddch(win, title[i]);
  }
}


x86 assembly (clang, -O0):
<curses_show_title>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x3,%esi
xor    %edx,%edx
call   1040 <wmove@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1187 <curses_show_title+0x67>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1030 <waddch@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114f <curses_show_title+0x2f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<curses_show_title>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    $0x3,%esi
xor    %edx,%edx
call   1040 <wmove@plt>
mov    (%rbx),%al
test   %al,%al
je     1156 <curses_show_title+0x36>
add    $0x1,%rbx
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <waddch@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <curses_show_title+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @curses_show_title(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = call i32 @wmove(i32* %9, i32 3, i32 0)
store i32 0, i32* %6
br label %11
11: ; preds = %27, %2
%12 = load i8*, i8** %4
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %11
%20 = load i32*, i32** %5
%21 = load i8*, i8** %4
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = call i32 @waddch(i32* %20, i8 signext %25)
br label %27
27: ; preds = %19
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %11
30: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @curses_show_title(i8* %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = tail call i32 @wmove(i32* %3, i32 3, i32 0)
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %2, %7
%8 = phi i64 [ %11, %7 ], [ 0, %2 ]
%9 = phi i8 [ %13, %7 ], [ %5, %2 ]
%10 = tail call i32 @waddch(i32* %3, i8 signext %9)
%11 = add nuw i64 %8, 1
%12 = getelementptr inbounds i8, i8* %1, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %7
15: ; preds = %7, %2
ret void
}