#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*/ mvwprintw(int /*<<< orphan*/ *, int, int, char *);
void drawmsg(WINDOW *w, int y, int x, int lines, char **msg) {
  int c;
  for (c = 0; c < lines; c++)
    mvwprintw(w, y + c, x, msg[c]);
}


x86 assembly (clang, -O0):
<drawmsg>:
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)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1168 <drawmsg+0x58>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    -0x24(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
call   1030 <mvwprintw@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1130 <drawmsg+0x20>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawmsg>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %ecx,%ecx
jle    114b <drawmsg+0x3b>
mov    %r8,%r14
mov    %edx,%r15d
mov    %rdi,%r12
mov    %ecx,%r13d
mov    %esi,%ebx
xor    %ebp,%ebp
nop
mov    (%r14,%rbp,8),%rcx
lea    (%rbx,%rbp,1),%esi
mov    %r12,%rdi
mov    %r15d,%edx
call   1030 <mvwprintw@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1130 <drawmsg+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @drawmsg(i32* %0, i32 %1, i32 %2, i32 %3, i8** nocapture %4) {
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %18
7: ; preds = %5
%8 = zext i32 %3 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %16, %9 ]
%11 = getelementptr inbounds i8*, i8** %4, i64 %10
%12 = load i8*, i8** %11
%13 = trunc i64 %10 to i32
%14 = add i32 %13, %1
%15 = tail call i32 @mvwprintw(i32* %0, i32 %14, i32 %2, i8* %12)
%16 = add nuw nsw i64 %10, 1
%17 = icmp eq i64 %16, %8
br i1 %17, label %18, label %9
18: ; preds = %9, %5
ret void
}