#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*/ memcpy(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strresize(char *, int);
void put_lkey(char *outrec, int keynum, char *f_key, char *f_val,
              char *f_comm) {
  int offset;
  char linebfr[81];
  linebfr[0] = 0;
  strcpy(linebfr, f_key);
  strresize(linebfr, 29);
  linebfr[8] = '=';
  strcat(linebfr, f_val);
  strcat(linebfr, " ");
  strcat(linebfr, f_comm);
  strresize(linebfr, 80);
  offset = keynum * 80;
  memcpy(outrec + offset, linebfr, 80);
}


x86 assembly (clang, -O0):
<put_lkey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movb   $0x0,-0x80(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
mov    $0x1d,%esi
call   1040 <strresize@plt>
movb   $0x3d,-0x78(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x80(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1060 <strcat@plt>
lea    -0x80(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x80(%rbp),%rdi
mov    $0x50,%esi
call   1040 <strresize@plt>
imul   $0x50,-0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
lea    -0x80(%rbp),%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_lkey>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x60,%rsp
mov    %r8,%r12
mov    %rcx,%r13
mov    %esi,%ebx
mov    %rdi,%r14
movb   $0x0,(%rsp)
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rdx,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    $0x1d,%esi
call   1040 <strresize@plt>
movb   $0x3d,0x8(%rsp)
mov    %r15,%rdi
mov    %r13,%rsi
call   1060 <strcat@plt>
lea    0xe72(%rip),%rsi
mov    %r15,%rdi
call   1060 <strcat@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <strcat@plt>
mov    %r15,%rdi
mov    $0x50,%esi
call   1040 <strresize@plt>
shl    $0x4,%ebx
lea    (%rbx,%rbx,4),%eax
movslq %eax,%rdi
add    %r14,%rdi
mov    %r15,%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define void @put_lkey(i8* %0, i32 %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca [81 x i8]
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%13 = getelementptr inbounds [81 x i8], [81 x i8]* %12, i64 0, i64 0
store i8 0, i8* %13
%14 = getelementptr inbounds [81 x i8], [81 x i8]* %12, i64 0, i64 0
%15 = load i8*, i8** %8
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = getelementptr inbounds [81 x i8], [81 x i8]* %12, i64 0, i64 0
%18 = call i32 @strresize(i8* %17, i32 29)
%19 = getelementptr inbounds [81 x i8], [81 x i8]* %12, i64 0, i64 8
store i8 61, i8* %19
%20 = getelementptr inbounds [81 x i8], [81 x i8]* %12, i64 0, i64 0
%21 = load i8*, i8** %9
%22 = call i32 @strcat(i8* %20, i8* %21)
%23 = getelementptr inbounds [81 x i8], [81 x i8]* %12, i64 0, i64 0
%24 = call i32 @strcat(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = getelementptr inbounds [81 x i8], [81 x i8]* %12, i64 0, i64 0
%26 = load i8*, i8** %10
%27 = call i32 @strcat(i8* %25, i8* %26)
%28 = getelementptr inbounds [81 x i8], [81 x i8]* %12, i64 0, i64 0
%29 = call i32 @strresize(i8* %28, i32 80)
%30 = load i32, i32* %7
%31 = mul nsw i32 %30, 80
store i32 %31, i32* %11
%32 = load i8*, i8** %6
%33 = load i32, i32* %11
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = getelementptr inbounds [81 x i8], [81 x i8]* %12, i64 0, i64 0
%37 = call i32 @memcpy(i8* %35, i8* %36, i32 80)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define void @put_lkey(i8* %0, i32 %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca [81 x i8]
%7 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
store i8 0, i8* %7
%8 = call i32 @strcpy(i8* %7, i8* %2)
%9 = call i32 @strresize(i8* %7, i32 29)
%10 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 8
store i8 61, i8* %10
%11 = call i32 @strcat(i8* %7, i8* %3)
%12 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @strcat(i8* %7, i8* %4)
%14 = call i32 @strresize(i8* %7, i32 80)
%15 = mul nsw i32 %1, 80
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = call i32 @memcpy(i8* %17, i8* %7, i32 80)
ret void
}