#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*/ free(char *);
char *malloc(int);
int plugin_config_set_internal(char *, char const *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char const *);
int /*<<< orphan*/ string_tolower(char *);
int strlen(char const *);
int plugin_config_set(const char *plugin_name, const char *option_name,
                      const char *value) {
  int length, rc;
  char *option_full_name;
  rc = 0;
  length = strlen(plugin_name) + 1 + strlen(option_name) + 1;
  option_full_name = malloc(length);
  if (option_full_name) {
    snprintf(option_full_name, length, "%s.%s", plugin_name, option_name);
    string_tolower(option_full_name);
    rc = plugin_config_set_internal(option_full_name, value);
    free(option_full_name);
  }
  return rc;
}


x86 assembly (clang, -O0):
<plugin_config_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11f4 <plugin_config_set+0x94>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe33(%rip),%rdx
call   1050 <snprintf@plt>
mov    -0x28(%rbp),%rdi
call   1060 <string_tolower@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <plugin_config_set_internal@plt>
mov    %eax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plugin_config_set>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1040 <strlen@plt>
lea    (%rbx,%rax,1),%ebp
add    $0x2,%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     11cd <plugin_config_set+0x6d>
mov    %rax,%rbx
lea    0xe64(%rip),%rdx
mov    %rax,%rdi
mov    %ebp,%esi
mov    %r12,%rcx
mov    %r15,%r8
call   1050 <snprintf@plt>
mov    %rbx,%rdi
call   1060 <string_tolower@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <plugin_config_set_internal@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
jmp    11cf <plugin_config_set+0x6f>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s.%s\00"
define i32 @plugin_config_set(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i32 0, i32* %8
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
%12 = add nsw i32 %11, 1
%13 = load i8*, i8** %5
%14 = call i32 @strlen(i8* %13)
%15 = add nsw i32 %12, %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = call i8* @malloc(i32 %17)
store i8* %18, i8** %9
%19 = load i8*, i8** %9
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %34
21: ; preds = %3
%22 = load i8*, i8** %9
%23 = load i32, i32* %7
%24 = load i8*, i8** %4
%25 = load i8*, i8** %5
%26 = call i32 @snprintf(i8* %22, i32 %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %24, i8* %25)
%27 = load i8*, i8** %9
%28 = call i32 @string_tolower(i8* %27)
%29 = load i8*, i8** %9
%30 = load i8*, i8** %6
%31 = call i32 @plugin_config_set_internal(i8* %29, i8* %30)
store i32 %31, i32* %8
%32 = load i8*, i8** %9
%33 = call i32 @free(i8* %32)
br label %34
34: ; preds = %21, %3
%35 = load i32, i32* %8
ret i32 %35
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s.%s\00"
define i32 @plugin_config_set(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @strlen(i8* %1)
%6 = add i32 %4, 2
%7 = add i32 %6, %5
%8 = tail call i8* @malloc(i32 %7)
%9 = icmp eq i8* %8, null
br i1 %9, label %15, label %10
10: ; preds = %3
%11 = tail call i32 @snprintf(i8* %8, i32 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%12 = tail call i32 @string_tolower(i8* %8)
%13 = tail call i32 @plugin_config_set_internal(i8* %8, i8* %2)
%14 = tail call i32 @free(i8* %8)
br label %15
15: ; preds = %10, %3
%16 = phi i32 [ %13, %10 ], [ 0, %3 ]
ret i32 %16
}