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

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
char const *spx_php_ini_get_string(char *);
size_t const strlen(char const *);
char tolower(char);
const char *source_handler_ini_http(const char *parameter) {
  const size_t prefix_len = strlen("SPX_");
  if (strlen(parameter) <= prefix_len) {
    return NULL;
  }
  char name[128];
  snprintf(name, sizeof(name), "spx.http_profiling_%s", parameter + prefix_len);
  char *p = name;
  while (*p) {
    *p = tolower(*p);
    p++;
  }
  return spx_php_ini_get_string(name);
}


x86 assembly (clang, -O0):
<source_handler_ini_http>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    -0x18(%rbp),%rax
ja     117f <source_handler_ini_http+0x3f>
movq   $0x0,-0x8(%rbp)
jmp    11fe <source_handler_ini_http+0xbe>
lea    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%rcx
add    -0x18(%rbp),%rcx
mov    $0x80,%esi
lea    0xe6b(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0xa0(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11ee <source_handler_ini_http+0xae>
mov    -0xa8(%rbp),%rax
movsbl (%rax),%edi
call   1060 <tolower@plt>
mov    %al,%cl
mov    -0xa8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xa8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xa8(%rbp)
jmp    11ad <source_handler_ini_http+0x6d>
lea    -0xa0(%rbp),%rdi
call   1030 <spx_php_ini_get_string@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<source_handler_ini_http>:
push   %rbx
sub    $0x80,%rsp
mov    %rdi,%rbx
call   1040 <strlen@plt>
cmp    $0x5,%rax
jae    115a <source_handler_ini_http+0x1a>
xor    %eax,%eax
jmp    11ae <source_handler_ini_http+0x6e>
add    $0x4,%rbx
lea    0xe9b(%rip),%rdx
mov    %rsp,%rdi
mov    $0x80,%esi
mov    %rbx,%rcx
call   1050 <snprintf@plt>
mov    (%rsp),%al
test   %al,%al
je     11a6 <source_handler_ini_http+0x66>
lea    0x1(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1060 <tolower@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1190 <source_handler_ini_http+0x50>
mov    %rsp,%rdi
call   1030 <spx_php_ini_get_string@plt>
add    $0x80,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [22 x i8] c"spx.http_profiling_%s\00"
define i8* @source_handler_ini_http(i8* %0) {
%2 = alloca [128 x i8]
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = icmp ult i64 %3, 5
br i1 %4, label %20, label %5
5: ; preds = %1
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds i8, i8* %0, i64 4
%8 = call i32 @snprintf(i8* %6, i32 128, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i8, i8* %6
%10 = icmp eq i8 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %5, %11
%12 = phi i8 [ %16, %11 ], [ %9, %5 ]
%13 = phi i8* [ %15, %11 ], [ %6, %5 ]
%14 = call signext i8 @tolower(i8 signext %12)
store i8 %14, i8* %13
%15 = getelementptr inbounds i8, i8* %13, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %11
18: ; preds = %11, %5
%19 = call i8* @spx_php_ini_get_string(i8* %6)
br label %20
20: ; preds = %1, %18
%21 = phi i8* [ %19, %18 ], [ null, %1 ]
ret i8* %21
}