#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, ...);
scalar_t__ strlen(char *);
void LogStringParam(FILE *fp, char *key, char *value) {
  if (strlen(value)) {
    fprintf(fp, "%s  %s\n", key, value);
    fflush(fp);
  } else {
    fprintf(fp, "# Empty value for parameter %s\n", key);
  }
}


x86 assembly (clang, -O0):
<LogStringParam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
je     117f <LogStringParam+0x4f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <fflush@plt>
jmp    1195 <LogStringParam+0x65>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe7a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LogStringParam>:
push   %rbx
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rbx
cmpb   $0x0,(%rcx)
je     1149 <LogStringParam+0x29>
lea    0xeca(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fflush@plt>
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%s %s\0A\00"
@.str.1 = [32 x i8] c"# Empty value for parameter %s\0A\00"
define void @LogStringParam(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = call i64 @strlen(i8* %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %3
%11 = load i32*, i32** %4
%12 = load i8*, i8** %5
%13 = load i8*, i8** %6
%14 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13)
%15 = load i32*, i32** %4
%16 = call i32 @fflush(i32* %15)
br label %21
17: ; preds = %3
%18 = load i32*, i32** %4
%19 = load i8*, i8** %5
%20 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %17, %10
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s %s\0A\00"
@.str.1 = [32 x i8] c"# Empty value for parameter %s\0A\00"
define void @LogStringParam(i32* nocapture %0, i8* %1, i8* %2) {
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
%8 = tail call i32 @fflush(i32* %0)
br label %11
9: ; preds = %3
%10 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %11
11: ; preds = %9, %6
ret void
}