#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 int32_t;

/* Variables and functions */
int /*<<< orphan*/ vt_write_str(char *);
int /*<<< orphan*/ vt_write_uint16(int);
void vt_pos_move_columns(int32_t columns) {
  if (columns == 0) {
    return;
  }
  vt_write_str("\x1B"
               "[");
  if (columns < 0) {
    vt_write_uint16(columns * -1);
    vt_write_str("D");
  } else {
    vt_write_uint16(columns);
    vt_write_str("C");
  }
}


x86 assembly (clang, -O0):
<vt_pos_move_columns>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113a <vt_pos_move_columns+0x1a>
jmp    117e <vt_pos_move_columns+0x5e>
lea    0xebf(%rip),%rdi
call   1040 <vt_write_str@plt>
cmpl   $0x0,-0x4(%rbp)
jge    116a <vt_pos_move_columns+0x4a>
imul   $0xffffffff,-0x4(%rbp),%edi
call   1030 <vt_write_uint16@plt>
lea    0xea3(%rip),%rdi
call   1040 <vt_write_str@plt>
jmp    117e <vt_pos_move_columns+0x5e>
mov    -0x4(%rbp),%edi
call   1030 <vt_write_uint16@plt>
lea    0xe8c(%rip),%rdi
call   1040 <vt_write_str@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vt_pos_move_columns>:
test   %edi,%edi
je     115c <vt_pos_move_columns+0x3c>
push   %rbx
mov    %edi,%ebx
lea    0xed2(%rip),%rdi
call   1040 <vt_write_str@plt>
mov    %ebx,%edi
neg    %edi
cmovs  %ebx,%edi
test   %ebx,%ebx
lea    0xec0(%rip),%rax
lea    0xebb(%rip),%rbx
cmovs  %rax,%rbx
call   1030 <vt_write_uint16@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <vt_write_str@plt>
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\1B[\00"
@.str.1 = [2 x i8] c"D\00"
@.str.2 = [2 x i8] c"C\00"
define void @vt_pos_move_columns(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %19
6: ; preds = %1
%7 = call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i32, i32* %2
%12 = mul nsw i32 %11, -1
%13 = call i32 @vt_write_uint16(i32 %12)
%14 = call i32 @vt_write_str(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %19
15: ; preds = %6
%16 = load i32, i32* %2
%17 = call i32 @vt_write_uint16(i32 %16)
%18 = call i32 @vt_write_str(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %5, %15, %10
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"\1B[\00"
@.str.1 = [2 x i8] c"D\00"
@.str.2 = [2 x i8] c"C\00"
define void @vt_pos_move_columns(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = tail call i32 @vt_write_str(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp slt i32 %0, 0
%6 = sub nsw i32 0, %0
%7 = select i1 %5, i32 %6, i32 %0
%8 = select i1 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%9 = tail call i32 @vt_write_uint16(i32 %7)
%10 = tail call i32 @vt_write_str(i8* %8)
br label %11
11: ; preds = %3, %1
ret void
}