#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 */
char *par_gets_def(char *, char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void par_gets_def_f_(char *block, char *name, char *def, char *value, int len1,
                     int len2, int len3, int len4) {
  char *returnvalue;
  int i;
  returnvalue = par_gets_def(block, name, def);
  strncpy(value, returnvalue,
          len4 < strlen(returnvalue) ? len4 : strlen(returnvalue));
  for (i = strlen(returnvalue); i < len4; i++)
    value[i] = ' ';
}


x86 assembly (clang, -O0):
<par_gets_def_f_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <par_gets_def@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    0x18(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
cmp    %ecx,%eax
jge    11a2 <par_gets_def_f_+0x72>
mov    0x18(%rbp),%eax
mov    %eax,-0x4c(%rbp)
jmp    11ae <par_gets_def_f_+0x7e>
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdi
mov    -0x4c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    11f0 <par_gets_def_f_+0xc0>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ca <par_gets_def_f_+0x9a>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<par_gets_def_f_>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    0x28(%rsp),%ebp
call   1040 <par_gets_def@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edx
cmp    %ebp,%eax
jg     116b <par_gets_def_f_+0x2b>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strncpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    %ebp,%eax
jge    11a0 <par_gets_def_f_+0x60>
movslq %eax,%rcx
add    %rcx,%r14
not    %eax
add    %ebp,%eax
add    $0x1,%rax
mov    %r14,%rdi
mov    $0x20,%esi
mov    %rax,%rdx
call   1060 <memset@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @par_gets_def_f_(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i32
store i8* %0, i8** %9
store i8* %1, i8** %10
store i8* %2, i8** %11
store i8* %3, i8** %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%19 = load i8*, i8** %9
%20 = load i8*, i8** %10
%21 = load i8*, i8** %11
%22 = call i8* @par_gets_def(i8* %19, i8* %20, i8* %21)
store i8* %22, i8** %17
%23 = load i8*, i8** %12
%24 = load i8*, i8** %17
%25 = load i32, i32* %16
%26 = load i8*, i8** %17
%27 = call i32 @strlen(i8* %26)
%28 = icmp slt i32 %25, %27
br i1 %28, label %29, label %31
29: ; preds = %8
%30 = load i32, i32* %16
br label %34
31: ; preds = %8
%32 = load i8*, i8** %17
%33 = call i32 @strlen(i8* %32)
br label %34
34: ; preds = %31, %29
%35 = phi i32 [ %30, %29 ], [ %33, %31 ]
%36 = call i32 @strncpy(i8* %23, i8* %24, i32 %35)
%37 = load i8*, i8** %17
%38 = call i32 @strlen(i8* %37)
store i32 %38, i32* %18
br label %39
39: ; preds = %48, %34
%40 = load i32, i32* %18
%41 = load i32, i32* %16
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %51
43: ; preds = %39
%44 = load i8*, i8** %12
%45 = load i32, i32* %18
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
store i8 32, i8* %47
br label %48
48: ; preds = %43
%49 = load i32, i32* %18
%50 = add nsw i32 %49, 1
store i32 %50, i32* %18
br label %39
51: ; preds = %39
ret void
}

LLVM IR (-O2):
define void @par_gets_def_f_(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = tail call i8* @par_gets_def(i8* %0, i8* %1, i8* %2)
%10 = tail call i32 @strlen(i8* %9)
%11 = icmp sgt i32 %10, %7
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = tail call i32 @strlen(i8* %9)
br label %14
14: ; preds = %8, %12
%15 = phi i32 [ %13, %12 ], [ %7, %8 ]
%16 = tail call i32 @strncpy(i8* %3, i8* %9, i32 %15)
%17 = tail call i32 @strlen(i8* %9)
%18 = icmp slt i32 %17, %7
br i1 %18, label %19, label %26
19: ; preds = %14
%20 = sext i32 %17 to i64
%21 = getelementptr i8, i8* %3, i64 %20
%22 = xor i32 %17, -1
%23 = add i32 %22, %7
%24 = zext i32 %23 to i64
%25 = add nuw nsw i64 %24, 1
br label %26
26: ; preds = %19, %14
ret void
}