#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 */
typedef int /*<<< orphan*/ fillp;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int ncx_putn_text(void **, size_t, char *);
int NC_fill_char(void **xpp, size_t nelems) {
  char fillp[16 * sizeof(double) / 1];
  assert(nelems <= sizeof(fillp) / sizeof(fillp[0]));
  {
    char *vp = fillp;
    const char *const end = vp + nelems;
    while (vp < end) {
      *vp++ = ((char)0);
    }
  }
  return ncx_putn_text(xpp, nelems, fillp);
}


x86 assembly (clang, -O0):
<NC_fill_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x80,-0x10(%rbp)
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x98(%rbp),%rax
cmp    -0xa0(%rbp),%rax
jae    1199 <NC_fill_char+0x79>
mov    -0x98(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x98(%rbp)
movb   $0x0,(%rax)
jmp    1168 <NC_fill_char+0x48>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   1030 <ncx_putn_text@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NC_fill_char>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
cmp    $0x81,%rsi
setb   %dil
call   1050 <assert@plt>
test   %rbx,%rbx
jle    1174 <NC_fill_char+0x44>
lea    (%rsp,%rbx,1),%rax
lea    0x1(%rsp),%rdx
cmp    %rdx,%rax
cmova  %rax,%rdx
mov    %rsp,%rdi
sub    %rdi,%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    %rsp,%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <ncx_putn_text@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @NC_fill_char(i8** %0, i64 %1) {
%3 = alloca i8**
%4 = alloca i64
%5 = alloca [128 x i8]
%6 = alloca i8*
%7 = alloca i8*
store i8** %0, i8*** %3
store i64 %1, i64* %4
%8 = load i64, i64* %4
%9 = icmp ule i64 %8, 128
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
store i8* %12, i8** %6
%13 = load i8*, i8** %6
%14 = load i64, i64* %4
%15 = getelementptr inbounds i8, i8* %13, i64 %14
store i8* %15, i8** %7
br label %16
16: ; preds = %20, %2
%17 = load i8*, i8** %6
%18 = load i8*, i8** %7
%19 = icmp ult i8* %17, %18
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i8*, i8** %6
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %6
store i8 0, i8* %21
br label %16
23: ; preds = %16
%24 = load i8**, i8*** %3
%25 = load i64, i64* %4
%26 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%27 = call i32 @ncx_putn_text(i8** %24, i64 %25, i8* %26)
ret i32 %27
}

LLVM IR (-O2):
define i32 @NC_fill_char(i8** %0, i64 %1) {
%3 = alloca [128 x i8]
%4 = ptrtoint [128 x i8]* %3 to i64
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = icmp ult i64 %1, 129
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = icmp sgt i64 %1, 0
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%12 = add i64 %4, %1
%13 = or i64 %4, 1
%14 = call i64 @llvm.umax.i64(i64 %12, i64 %13)
%15 = sub i64 %14, %4
br label %16
16: ; preds = %10, %2
%17 = call i32 @ncx_putn_text(i8** %0, i64 %1, i8* %5)
ret i32 %17
}