void hputs(hstring, keyword, cval) char *hstring;
char *keyword;
char *cval;
{
  char squot = 39;
  char value[70];
  int lcval;
  lcval = strlen(cval);
  if (lcval > 67)
    lcval = 67;
  value[0] = squot;
  strncpy(&value[1], cval, lcval);
  value[lcval + 1] = squot;
  value[lcval + 2] = 0;
  hputc(hstring, keyword, value);
  return;
}


x86 assembly (clang, -O0):
<hputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movb   $0x27,-0x19(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0x43,-0x64(%rbp)
jle    1165 <hputs+0x35>
movl   $0x43,-0x64(%rbp)
mov    -0x19(%rbp),%al
mov    %al,-0x60(%rbp)
lea    -0x60(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
movslq -0x64(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x19(%rbp),%cl
mov    -0x64(%rbp),%eax
add    $0x1,%eax
cltq
mov    %cl,-0x60(%rbp,%rax,1)
mov    -0x64(%rbp),%eax
add    $0x2,%eax
cltq
movb   $0x0,-0x60(%rbp,%rax,1)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x60(%rbp),%rdx
mov    $0x0,%al
call   1050 <hputc@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hputs>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
call   1040 <strlen@plt>
cmp    $0x43,%eax
mov    $0x43,%ecx
cmovl  %eax,%ecx
movb   $0x27,(%rsp)
lea    0x1(%rsp),%rdi
movslq %ecx,%rbx
mov    %r12,%rsi
mov    %rbx,%rdx
call   1030 <strncpy@plt>
mov    %rsp,%rdx
movw   $0x27,0x1(%rbx,%rdx,1)
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <hputc@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @hputs(i8* %0, i8* %1, i8* nocapture %2) {
%4 = alloca [70 x i8]
%5 = getelementptr inbounds [70 x i8], [70 x i8]* %4, i64 0, i64 0
%6 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%7 = trunc i64 %6 to i32
%8 = icmp slt i32 %7, 67
%9 = select i1 %8, i32 %7, i32 67
store i8 39, i8* %5
%10 = getelementptr inbounds [70 x i8], [70 x i8]* %4, i64 0, i64 1
%11 = sext i32 %9 to i64
%12 = call i8* @strncpy(i8* %10, i8* %2, i64 %11)
%13 = add nsw i32 %9, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [70 x i8], [70 x i8]* %4, i64 0, i64 %14
store i8 39, i8* %15
%16 = add nsw i32 %9, 2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [70 x i8], [70 x i8]* %4, i64 0, i64 %17
store i8 0, i8* %18
%19 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @hputc to i32 (i8*, i8*, i8*, ...)*)(i8* %0, i8* %1, i8* %5)
ret void
}