#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*/ bfwrite(char *);
int /*<<< orphan*/ cmdMoveLeft(int const);
int /*<<< orphan*/ cmdMoveRight(int);
void cmdGet(const int iCount) {
  int iPos;
  for (iPos = 0; iPos < iCount; iPos++) {
    if (iPos)
      cmdMoveRight(1);
    bfwrite(",");
  }
  if (iCount > 1)
    cmdMoveLeft(iCount - 1);
}


x86 assembly (clang, -O0):
<cmdGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    117c <cmdGet+0x4c>
cmpl   $0x0,-0x8(%rbp)
je     1162 <cmdGet+0x32>
mov    $0x1,%edi
call   1030 <cmdMoveRight@plt>
lea    0xe97(%rip),%rdi
call   1050 <bfwrite@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <cmdGet+0x12>
cmpl   $0x1,-0x4(%rbp)
jle    1191 <cmdGet+0x61>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1040 <cmdMoveLeft@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdGet>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    118c <cmdGet+0x5c>
mov    %edi,%ebx
lea    0xebf(%rip),%rdi
call   1050 <bfwrite@plt>
cmp    $0x1,%ebx
je     118c <cmdGet+0x5c>
mov    $0x1,%ebp
lea    0xea9(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <cmdMoveRight@plt>
mov    %r14,%rdi
call   1050 <bfwrite@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1160 <cmdGet+0x30>
cmp    $0x2,%ebx
jl     118c <cmdGet+0x5c>
add    $0xffffffff,%ebx
mov    %ebx,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <cmdMoveLeft@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c",\00"
define void @cmdGet(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %17
3: ; preds = %1
%4 = tail call i32 @bfwrite(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %0, 1
br i1 %5, label %17, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %10, %6 ], [ 1, %3 ]
%8 = tail call i32 @cmdMoveRight(i32 1)
%9 = tail call i32 @bfwrite(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = add nuw nsw i32 %7, 1
%11 = icmp eq i32 %10, %0
br i1 %11, label %12, label %6
12: ; preds = %6
%13 = icmp sgt i32 %0, 1
br i1 %13, label %14, label %17
14: ; preds = %12
%15 = add nsw i32 %0, -1
%16 = tail call i32 @cmdMoveLeft(i32 %15)
br label %17
17: ; preds = %1, %3, %14, %12
ret void
}