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

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/ *);
int /*<<< orphan*/ print_cell(int /*<<< orphan*/ *, struct game_2048 *, size_t,
                              int);
int /*<<< orphan*/ waddch(int /*<<< orphan*/ *, char);
void print_board_row(WINDOW *w, struct game_2048 *g, size_t row) {
  assert(w);
  waddch(w, '|');
  for (int col = 0; col < 4; ++col) {
    print_cell(w, g, row, col);
    waddch(w, '|');
  }
}


x86 assembly (clang, -O0):
<print_board_row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    $0x7c,%esi
call   1030 <waddch@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    119c <print_board_row+0x6c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1050 <print_cell@plt>
mov    -0x8(%rbp),%rdi
mov    $0x7c,%esi
call   1030 <waddch@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1162 <print_board_row+0x32>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_board_row>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    $0x7c,%esi
call   1030 <waddch@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %ecx,%ecx
call   1050 <print_cell@plt>
mov    %rbx,%rdi
mov    $0x7c,%esi
call   1030 <waddch@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    $0x1,%ecx
call   1050 <print_cell@plt>
mov    %rbx,%rdi
mov    $0x7c,%esi
call   1030 <waddch@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    $0x2,%ecx
call   1050 <print_cell@plt>
mov    %rbx,%rdi
mov    $0x7c,%esi
call   1030 <waddch@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    $0x3,%ecx
call   1050 <print_cell@plt>
mov    %rbx,%rdi
mov    $0x7c,%esi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <waddch@plt>

LLVM IR (-O0):
%struct.game_2048 = type { i32 }
define void @print_board_row(i32* %0, %struct.game_2048* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca %struct.game_2048*
%6 = alloca i64
%7 = alloca i32
store i32* %0, i32** %4
store %struct.game_2048* %1, %struct.game_2048** %5
store i64 %2, i64* %6
%8 = load i32*, i32** %4
%9 = call i32 @assert(i32* %8)
%10 = load i32*, i32** %4
%11 = call i32 @waddch(i32* %10, i8 signext 124)
store i32 0, i32* %7
br label %12
12: ; preds = %23, %3
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 4
br i1 %14, label %15, label %26
15: ; preds = %12
%16 = load i32*, i32** %4
%17 = load %struct.game_2048*, %struct.game_2048** %5
%18 = load i64, i64* %6
%19 = load i32, i32* %7
%20 = call i32 @print_cell(i32* %16, %struct.game_2048* %17, i64 %18, i32 %19)
%21 = load i32*, i32** %4
%22 = call i32 @waddch(i32* %21, i8 signext 124)
br label %23
23: ; preds = %15
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %12
26: ; preds = %12
ret void
}

LLVM IR (-O2):
%struct.game_2048 = type { i32 }
define void @print_board_row(i32* %0, %struct.game_2048* %1, i64 %2) {
%4 = tail call i32 @assert(i32* %0)
%5 = tail call i32 @waddch(i32* %0, i8 signext 124)
%6 = tail call i32 @print_cell(i32* %0, %struct.game_2048* %1, i64 %2, i32 0)
%7 = tail call i32 @waddch(i32* %0, i8 signext 124)
%8 = tail call i32 @print_cell(i32* %0, %struct.game_2048* %1, i64 %2, i32 1)
%9 = tail call i32 @waddch(i32* %0, i8 signext 124)
%10 = tail call i32 @print_cell(i32* %0, %struct.game_2048* %1, i64 %2, i32 2)
%11 = tail call i32 @waddch(i32* %0, i8 signext 124)
%12 = tail call i32 @print_cell(i32* %0, %struct.game_2048* %1, i64 %2, i32 3)
%13 = tail call i32 @waddch(i32* %0, i8 signext 124)
ret void
}