#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*/ cli_send_feedback(int, char *);
int /*<<< orphan*/ sprintf(char *, char *, int, char *);
int cli_show_param(int client_fd, char **parameters, int numparameters) {
  int i = 0;
  char msg[1024] = {0};
  for (i = 0; i < numparameters; i++) {
    sprintf(msg, "[%d] %s\n", i, parameters[i]);
    cli_send_feedback(client_fd, msg);
  }
  return 0;
}


x86 assembly (clang, -O0):
<cli_show_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b1 <cli_show_param+0x81>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xe71(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x420(%rbp),%rsi
call   1030 <cli_send_feedback@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1166 <cli_show_param+0x36>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_show_param>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %edx,%ebx
mov    %rsi,%r14
mov    %edi,%r12d
mov    %rsp,%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1040 <memset@plt>
test   %ebx,%ebx
jle    1195 <cli_show_param+0x65>
mov    %ebx,%r13d
xor    %ebx,%ebx
lea    0xe98(%rip),%r15
mov    %rsp,%rbp
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rcx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1050 <sprintf@plt>
mov    %r12d,%edi
mov    %rbp,%rsi
call   1030 <cli_send_feedback@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1170 <cli_show_param+0x40>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"[%d] %s\0A\00"
define i32 @cli_show_param(i32 %0, i8** %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1024 x i8]
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
store i32 0, i32* %7
%9 = bitcast [1024 x i8]* %8 to i8*
store i32 0, i32* %7
br label %10
10: ; preds = %26, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %29
14: ; preds = %10
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%16 = load i32, i32* %7
%17 = load i8**, i8*** %5
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %16, i8* %21)
%23 = load i32, i32* %4
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%25 = call i32 @cli_send_feedback(i32 %23, i8* %24)
br label %26
26: ; preds = %14
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %10
29: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"[%d] %s\0A\00"
define i32 @cli_show_param(i32 %0, i8** nocapture %1, i32 %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %18
7: ; preds = %3
%8 = zext i32 %2 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %16, %9 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = trunc i64 %10 to i32
%14 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %13, i8* %12)
%15 = call i32 @cli_send_feedback(i32 %0, i8* %5)
%16 = add nuw nsw i64 %10, 1
%17 = icmp eq i64 %16, %8
br i1 %17, label %18, label %9
18: ; preds = %9, %3
ret i32 0
}