#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_left(int *pos, int *cur_col, int colonnes) {
  if (*pos > 0) {
    (*pos)--;
    if (*cur_col > 0) {
      printf("\033[D");
      (*cur_col)--;
    } else {
      printf("\033[A\033[%dC", colonnes - 1);
      *cur_col = colonnes - 1;
    }
  }
}


x86 assembly (clang, -O0):
<move_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jle    118b <move_left+0x7b>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jle    1166 <move_left+0x56>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
jmp    1186 <move_left+0x76>
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    118b <move_left+0x7b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_left>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%eax
test   %eax,%eax
jle    1152 <move_left+0x42>
mov    %rsi,%rbx
add    $0xffffffff,%eax
mov    %eax,(%rdi)
cmpl   $0x0,(%rsi)
jle    113b <move_left+0x2b>
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%ebp
add    $0xffffffff,%ebp
jmp    1150 <move_left+0x40>
mov    %edx,%ebp
add    $0xffffffff,%ebp
lea    0xebd(%rip),%rdi
mov    %ebp,%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[D\00"
@.str.1 = [9 x i8] c"\1B[A\1B[%dC\00"
define void @move_left(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %30
10: ; preds = %3
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = add nsw i32 %12, -1
store i32 %13, i32* %11
%14 = load i32*, i32** %5
%15 = load i32, i32* %14
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %10
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%19 = load i32*, i32** %5
%20 = load i32, i32* %19
%21 = add nsw i32 %20, -1
store i32 %21, i32* %19
br label %29
22: ; preds = %10
%23 = load i32, i32* %6
%24 = sub nsw i32 %23, 1
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %6
%27 = sub nsw i32 %26, 1
%28 = load i32*, i32** %5
store i32 %27, i32* %28
br label %29
29: ; preds = %22, %17
br label %30
30: ; preds = %29, %3
ret void
}

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