#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 */
scalar_t__ string_compare(char *, char *);
char *string_shrink(char *);
char *remove_prefix_from_printf_procedures(char *procedure) {
  if (string_compare(procedure, "selfie_printf"))
    return string_shrink("printf ");
  else if (string_compare(procedure, "selfie_sprintf"))
    return "sprintf";
  else if (string_compare(procedure, "selfie_dprintf"))
    return "dprintf";
  else
    return procedure;
}


x86 assembly (clang, -O0):
<remove_prefix_from_printf_procedures>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <string_compare@plt>
cmp    $0x0,%rax
je     115b <remove_prefix_from_printf_procedures+0x3b>
lea    0xec1(%rip),%rdi
call   1040 <string_shrink@plt>
mov    %rax,-0x8(%rbp)
jmp    11b7 <remove_prefix_from_printf_procedures+0x97>
mov    -0x10(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <string_compare@plt>
cmp    $0x0,%rax
je     1185 <remove_prefix_from_printf_procedures+0x65>
lea    0xea1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b7 <remove_prefix_from_printf_procedures+0x97>
mov    -0x10(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1030 <string_compare@plt>
cmp    $0x0,%rax
je     11af <remove_prefix_from_printf_procedures+0x8f>
lea    0xe86(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b7 <remove_prefix_from_printf_procedures+0x97>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_prefix_from_printf_procedures>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
call   1030 <string_compare@plt>
test   %rax,%rax
je     1142 <remove_prefix_from_printf_procedures+0x22>
lea    0xed2(%rip),%rdi
pop    %rbx
jmp    1040 <string_shrink@plt>
lea    0xecd(%rip),%rsi
mov    %rbx,%rdi
call   1030 <string_compare@plt>
test   %rax,%rax
je     115f <remove_prefix_from_printf_procedures+0x3f>
lea    0xec0(%rip),%rax
pop    %rbx
ret
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <string_compare@plt>
test   %rax,%rax
lea    0xeb4(%rip),%rax
cmove  %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"selfie_printf\00"
@.str.1 = [8 x i8] c"printf \00"
@.str.2 = [15 x i8] c"selfie_sprintf\00"
@.str.3 = [8 x i8] c"sprintf\00"
@.str.4 = [15 x i8] c"selfie_dprintf\00"
@.str.5 = [8 x i8] c"dprintf\00"
define i8* @remove_prefix_from_printf_procedures(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @string_compare(i8* %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i8* @string_shrink(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i8* %8, i8** %2
br label %21
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i64 @string_compare(i8* %10, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %21
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = call i64 @string_compare(i8* %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %14
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %21
19: ; preds = %14
%20 = load i8*, i8** %3
store i8* %20, i8** %2
br label %21
21: ; preds = %19, %18, %13, %7
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
@.str = [14 x i8] c"selfie_printf\00"
@.str.1 = [8 x i8] c"printf \00"
@.str.2 = [15 x i8] c"selfie_sprintf\00"
@.str.3 = [8 x i8] c"sprintf\00"
@.str.4 = [15 x i8] c"selfie_dprintf\00"
@.str.5 = [8 x i8] c"dprintf\00"
define i8* @remove_prefix_from_printf_procedures(i8* %0) {
%2 = tail call i64 @string_compare(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i8* @string_shrink(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %13
6: ; preds = %1
%7 = tail call i64 @string_compare(i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = tail call i64 @string_compare(i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0)
br label %13
13: ; preds = %9, %6, %4
%14 = phi i8* [ %5, %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %6 ], [ %12, %9 ]
ret i8* %14
}