#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*/ printf(char *, ...);
void move_right(int *pos, int *cur_col, int colonnes, int count) {
  if (*pos < count) {
    (*pos)++;
    if (*cur_col < colonnes - 1) {
      printf("\033[C");
      (*cur_col)++;
    } else {
      printf("\033[B\033[%dD", colonnes - 1);
      *cur_col = 0;
    }
  }
}


x86 assembly (clang, -O0):
<move_right>:
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    -0x8(%rbp),%rax
mov    (%rax),%eax
cmp    -0x18(%rbp),%eax
jge    1195 <move_right+0x85>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1172 <move_right+0x62>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1190 <move_right+0x80>
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    1195 <move_right+0x85>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_right>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%eax
cmp    %ecx,%eax
jge    1151 <move_right+0x41>
mov    %rsi,%rbx
add    $0x1,%eax
mov    %eax,(%rdi)
add    $0xffffffff,%edx
cmp    %edx,(%rsi)
jge    113d <move_right+0x2d>
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%ebp
add    $0x1,%ebp
jmp    114f <move_right+0x3f>
lea    0xec0(%rip),%rdi
xor    %ebp,%ebp
mov    %edx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[C\00"
@.str.1 = [9 x i8] c"\1B[B\1B[%dD\00"
define void @move_right(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = load i32, i32* %8
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %33
13: ; preds = %4
%14 = load i32*, i32** %5
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %14
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = load i32, i32* %7
%20 = sub nsw i32 %19, 1
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %27
22: ; preds = %13
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%24 = load i32*, i32** %6
%25 = load i32, i32* %24
%26 = add nsw i32 %25, 1
store i32 %26, i32* %24
br label %32
27: ; preds = %13
%28 = load i32, i32* %7
%29 = sub nsw i32 %28, 1
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = load i32*, i32** %6
store i32 0, i32* %31
br label %32
32: ; preds = %27, %22
br label %33
33: ; preds = %32, %4
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[C\00"
@.str.1 = [9 x i8] c"\1B[B\1B[%dD\00"
define void @move_right(i32* nocapture %0, i32* nocapture %1, i32 %2, i32 %3) {
%5 = load i32, i32* %0
%6 = icmp slt i32 %5, %3
br i1 %6, label %7, label %20
7: ; preds = %4
%8 = add nsw i32 %5, 1
store i32 %8, i32* %0
%9 = load i32, i32* %1
%10 = add nsw i32 %2, -1
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* %1
%15 = add nsw i32 %14, 1
br label %18
16: ; preds = %7
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %18
18: ; preds = %16, %12
%19 = phi i32 [ %15, %12 ], [ 0, %16 ]
store i32 %19, i32* %1
br label %20
20: ; preds = %18, %4
ret void
}