#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 */
struct parsed_params {
  int dummy;
};

/* Variables and functions */
char *get_param_val(char *, struct parsed_params *);
int /*<<< orphan*/ printf(char *, ...);
void cmd1p2_handler(struct parsed_params *params) {
  printf("cmd1p2_handler \n");
  printf("p: %s \n", get_param_val("cmd1p1", params));
  printf("p: %s \n", get_param_val("cmd1p2", params));
  printf("p: %s \n", get_param_val("cmd1p3", params));
}


x86 assembly (clang, -O0):
<cmd1p2_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xed4(%rip),%rdi
call   1040 <get_param_val@plt>
mov    %rax,%rsi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeba(%rip),%rdi
call   1040 <get_param_val@plt>
mov    %rax,%rsi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1040 <get_param_val@plt>
mov    %rax,%rsi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd1p2_handler>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xedf(%rip),%rdi
call   1030 <puts@plt>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
call   1050 <get_param_val@plt>
lea    0xea7(%rip),%r14
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
mov    %rbx,%rsi
call   1050 <get_param_val@plt>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8d(%rip),%rdi
mov    %rbx,%rsi
call   1050 <get_param_val@plt>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
%struct.parsed_params = type { i32 }
@.str = [17 x i8] c"cmd1p2_handler \0A\00"
@.str.1 = [8 x i8] c"p: %s \0A\00"
@.str.2 = [7 x i8] c"cmd1p1\00"
@.str.3 = [7 x i8] c"cmd1p2\00"
@.str.4 = [7 x i8] c"cmd1p3\00"
define void @cmd1p2_handler(%struct.parsed_params* %0) {
%2 = alloca %struct.parsed_params*
store %struct.parsed_params* %0, %struct.parsed_params** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = load %struct.parsed_params*, %struct.parsed_params** %2
%5 = call i8* @get_param_val(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %struct.parsed_params* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = load %struct.parsed_params*, %struct.parsed_params** %2
%8 = call i8* @get_param_val(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %struct.parsed_params* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load %struct.parsed_params*, %struct.parsed_params** %2
%11 = call i8* @get_param_val(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), %struct.parsed_params* %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %11)
ret void
}

LLVM IR (-O2):
%struct.parsed_params = type { i32 }
@.str.1 = [8 x i8] c"p: %s \0A\00"
@.str.2 = [7 x i8] c"cmd1p1\00"
@.str.3 = [7 x i8] c"cmd1p2\00"
@.str.4 = [7 x i8] c"cmd1p3\00"
@str = [16 x i8] c"cmd1p2_handler \00"
define void @cmd1p2_handler(%struct.parsed_params* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%3 = tail call i8* @get_param_val(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %struct.parsed_params* %0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = tail call i8* @get_param_val(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %struct.parsed_params* %0)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = tail call i8* @get_param_val(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), %struct.parsed_params* %0)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret void
}