#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 */

/* Variables and functions */
int /*<<< orphan*/ DoAdjust(int *, int *, int, int, int, int);
int /*<<< orphan*/ fb_Locate(int, int, int, int /*<<< orphan*/,
                             int /*<<< orphan*/);
int /*<<< orphan*/ fb_PrintBufferEx(char *, int, int /*<<< orphan*/);
void DoMove(int *x, int *y, int dx, int dy, int cols, int rows) {
  DoAdjust(x, y, dx, dy, cols, rows);
  if (*y == (rows + 1) && *x == 1) {
    fb_Locate(rows, cols, -1, 0, 0);
    fb_PrintBufferEx("\n", sizeof("\n") - 1, 0);
  } else {
    fb_Locate(*y, *x, -1, 0, 0);
  }
}


x86 assembly (clang, -O0):
<DoMove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
call   1030 <DoAdjust@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    11b8 <DoMove+0x88>
mov    -0x8(%rbp),%rax
cmpl   $0x1,(%rax)
jne    11b8 <DoMove+0x88>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1040 <fb_Locate@plt>
lea    0xe59(%rip),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1050 <fb_PrintBufferEx@plt>
jmp    11d4 <DoMove+0xa4>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1040 <fb_Locate@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoMove>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r9d,%r15d
mov    %r8d,%r14d
mov    %rsi,%rbp
mov    %rdi,%rbx
call   1030 <DoAdjust@plt>
mov    0x0(%rbp),%edi
lea    0x1(%r15),%eax
mov    (%rbx),%esi
cmp    %eax,%edi
jne    118c <DoMove+0x5c>
cmp    $0x1,%esi
jne    118c <DoMove+0x5c>
mov    %r15d,%edi
mov    %r14d,%esi
mov    $0xffffffff,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <fb_Locate@plt>
lea    0xe8a(%rip),%rdi
mov    $0x1,%esi
xor    %edx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fb_PrintBufferEx@plt>
mov    $0xffffffff,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fb_Locate@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @DoMove(i32* %0, i32* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @DoAdjust(i32* %0, i32* %1, i32 %2, i32 %3, i32 %4, i32 %5)
%8 = load i32, i32* %1
%9 = add nsw i32 %5, 1
%10 = icmp eq i32 %8, %9
%11 = load i32, i32* %0
%12 = icmp eq i32 %11, 1
%13 = select i1 %10, i1 %12, i1 false
br i1 %13, label %14, label %17
14: ; preds = %6
%15 = tail call i32 @fb_Locate(i32 %5, i32 %4, i32 -1, i32 0, i32 0)
%16 = tail call i32 @fb_PrintBufferEx(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1, i32 0)
br label %19
17: ; preds = %6
%18 = tail call i32 @fb_Locate(i32 %8, i32 %11, i32 -1, i32 0, i32 0)
br label %19
19: ; preds = %17, %14
ret void
}