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

/* Variables and functions */
int /*<<< orphan*/ ochar(char);
int /*<<< orphan*/ snprintf(char *, int, char *, int, int);
void do_move(int col, int line) {
  char buf[16];
  snprintf(buf, sizeof(buf), "\033[%d;%dH", line + 1, col + 1);
  char *p;
  for (p = buf; *p != '\0'; p++)
    ochar(*p);
}


x86 assembly (clang, -O0):
<do_move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    -0x4(%rbp),%r8d
add    $0x1,%r8d
mov    $0x10,%esi
lea    0xeb4(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1186 <do_move+0x66>
mov    -0x28(%rbp),%rax
movsbl (%rax),%edi
call   1040 <ochar@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1159 <do_move+0x39>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_move>:
push   %rbx
sub    $0x10,%rsp
lea    0x1(%rsi),%ecx
lea    0x1(%rdi),%r8d
lea    0xecd(%rip),%rdx
mov    %rsp,%rdi
mov    $0x10,%esi
call   1030 <snprintf@plt>
mov    (%rsp),%al
test   %al,%al
je     1163 <do_move+0x43>
lea    0x1(%rsp),%rbx
nopl   0x0(%rax)
movsbl %al,%edi
call   1040 <ochar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1150 <do_move+0x30>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"\1B[%d;%dH\00"
define void @do_move(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [16 x i8]
%6 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 1
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
%12 = call i32 @snprintf(i8* %7, i32 16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11)
%13 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
store i8* %13, i8** %6
br label %14
14: ; preds = %23, %2
%15 = load i8*, i8** %6
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %14
%20 = load i8*, i8** %6
%21 = load i8, i8* %20
%22 = call i32 @ochar(i8 signext %21)
br label %23
23: ; preds = %19
%24 = load i8*, i8** %6
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %6
br label %14
26: ; preds = %14
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"\1B[%d;%dH\00"
define void @do_move(i32 %0, i32 %1) {
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = add nsw i32 %1, 1
%6 = add nsw i32 %0, 1
%7 = call i32 @snprintf(i8* %4, i32 16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i8, i8* %4
%9 = icmp eq i8 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %2, %10
%11 = phi i8 [ %15, %10 ], [ %8, %2 ]
%12 = phi i8* [ %14, %10 ], [ %4, %2 ]
%13 = call i32 @ochar(i8 signext %11)
%14 = getelementptr inbounds i8, i8* %12, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %10
17: ; preds = %10, %2
ret void
}