#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*/ c_nnsetc(char *, char *);
void fnnsetc_(char *pnam, char *cval, int *clen) {
  char cdum[256];
  int i;
  for (i = 0; i < *clen; i++) {
    cdum[i] = cval[i];
  }
  i = *clen;
  cdum[i] = '\0';
  c_nnsetc(pnam, cdum);
}


x86 assembly (clang, -O0):
<fnnsetc_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x124(%rbp)
mov    -0x124(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1173 <fnnsetc_+0x63>
mov    -0x10(%rbp),%rax
movslq -0x124(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x124(%rbp),%rax
mov    %cl,-0x120(%rbp,%rax,1)
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
jmp    1131 <fnnsetc_+0x21>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x124(%rbp)
movslq -0x124(%rbp),%rax
movb   $0x0,-0x120(%rbp,%rax,1)
mov    -0x8(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1030 <c_nnsetc@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnnsetc_>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%r14
mov    (%rdx),%ebx
test   %ebx,%ebx
jle    113e <fnnsetc_+0x1e>
mov    %rsp,%rdi
mov    %rbx,%rdx
call   1040 <memcpy@plt>
movslq %ebx,%rax
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rsi
mov    %r14,%rdi
call   1030 <c_nnsetc@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @fnnsetc_(i8* %0, i8* nocapture %1, i32* nocapture %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%10 = zext i32 %6 to i64
br label %11
11: ; preds = %8, %3
%12 = sext i32 %6 to i64
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %12
store i8 0, i8* %13
%14 = call i32 @c_nnsetc(i8* %0, i8* %5)
ret void
}