#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*/ *newwin(int, int, int, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ win_show(int /*<<< orphan*/ *, char *, int);
void init_wins(WINDOW **wins, int n) {
  int x, y, i;
  char label[80];
  y = 2;
  x = 10;
  for (i = 0; i < n; ++i) {
    wins[i] = newwin(10, 40, y, x);
    sprintf(label, "Window Number %d", i + 1);
    win_show(wins[i], label, i + 1);
    y += 3;
    x += 7;
  }
}


x86 assembly (clang, -O0):
<init_wins>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x2,-0x14(%rbp)
movl   $0xa,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d5 <init_wins+0xa5>
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    $0xa,%edi
mov    $0x28,%esi
call   1040 <newwin@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
lea    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%edx
add    $0x1,%edx
lea    0xe6b(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x70(%rbp),%rsi
mov    -0x18(%rbp),%edx
add    $0x1,%edx
call   1030 <win_show@plt>
mov    -0x14(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1154 <init_wins+0x24>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_wins>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
test   %esi,%esi
jle    11ac <init_wins+0x7c>
mov    %rdi,%r14
mov    %esi,%eax
mov    %rax,0x8(%rsp)
mov    $0xa,%r13d
mov    $0x2,%ebx
xor    %r15d,%r15d
lea    0x10(%rsp),%r12
nop
mov    $0xa,%edi
mov    $0x28,%esi
mov    %ebx,%edx
mov    %r13d,%ecx
call   1040 <newwin@plt>
mov    %rax,(%r14,%r15,8)
lea    0x1(%r15),%rbp
mov    %r12,%rdi
lea    0xe7a(%rip),%rsi
mov    %ebp,%edx
call   1050 <sprintf@plt>
mov    (%r14,%r15,8),%rdi
mov    %r12,%rsi
mov    %ebp,%edx
call   1030 <win_show@plt>
add    $0x3,%ebx
add    $0x7,%r13d
mov    %rbp,%r15
cmp    %rbp,0x8(%rsp)
jne    1160 <init_wins+0x30>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Window Number %d\00"
define void @init_wins(i32** %0, i32 %1) {
%3 = alloca i32**
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [80 x i8]
store i32** %0, i32*** %3
store i32 %1, i32* %4
store i32 2, i32* %6
store i32 10, i32* %5
store i32 0, i32* %7
br label %9
9: ; preds = %38, %2
%10 = load i32, i32* %7
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %41
13: ; preds = %9
%14 = load i32, i32* %6
%15 = load i32, i32* %5
%16 = call i32* @newwin(i32 10, i32 40, i32 %14, i32 %15)
%17 = load i32**, i32*** %3
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32*, i32** %17, i64 %19
store i32* %16, i32** %20
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
%24 = call i32 @sprintf(i8* %21, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = load i32**, i32*** %3
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32*, i32** %25, i64 %27
%29 = load i32*, i32** %28
%30 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
%33 = call i32 @win_show(i32* %29, i8* %30, i32 %32)
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 3
store i32 %35, i32* %6
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 7
store i32 %37, i32* %5
br label %38
38: ; preds = %13
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %9
41: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Window Number %d\00"
define void @init_wins(i32** nocapture %0, i32 %1) {
%3 = alloca [80 x i8]
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %22
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %14, %8 ]
%10 = phi i32 [ 2, %6 ], [ %19, %8 ]
%11 = phi i32 [ 10, %6 ], [ %20, %8 ]
%12 = call i32* @newwin(i32 10, i32 40, i32 %10, i32 %11)
%13 = getelementptr inbounds i32*, i32** %0, i64 %9
store i32* %12, i32** %13
%14 = add nuw nsw i64 %9, 1
%15 = trunc i64 %14 to i32
%16 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load i32*, i32** %13
%18 = call i32 @win_show(i32* %17, i8* %4, i32 %15)
%19 = add nuw nsw i32 %10, 3
%20 = add nuw nsw i32 %11, 7
%21 = icmp eq i64 %14, %7
br i1 %21, label %22, label %8
22: ; preds = %8, %2
ret void
}