#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*/ printf(char *);
int /*<<< orphan*/ putchar(char);
void print_func_name(char *call) {
  int i = 0;
  putchar('\n');
  while (call[i] != '(' && call[i] != '\0' && i < 20)
    putchar(call[i++]);
  printf(":\n");
}


x86 assembly (clang, -O0):
<print_func_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x28,%ecx
mov    %al,-0xd(%rbp)
je     117b <print_func_name+0x5b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
je     117b <print_func_name+0x5b>
cmpl   $0x14,-0xc(%rbp)
setl   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    118b <print_func_name+0x6b>
jmp    11ab <print_func_name+0x8b>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
jmp    113d <print_func_name+0x1d>
lea    0xe4e(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_func_name>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%r14),%al
cmp    $0x28,%al
je     1163 <print_func_name+0x43>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
test   %al,%al
je     1163 <print_func_name+0x43>
cmp    $0x13,%rbx
ja     1163 <print_func_name+0x43>
lea    0x1(%rbx),%r15
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl 0x1(%r14,%rbx,1),%eax
mov    %r15,%rbx
cmp    $0x28,%al
jne    1140 <print_func_name+0x20>
lea    0xe96(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c":\0A\00"
define void @print_func_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = call i32 @putchar(i8 signext 10)
br label %5
5: ; preds = %26, %1
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 40
br i1 %12, label %13, label %24
13: ; preds = %5
%14 = load i8*, i8** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %13
%22 = load i32, i32* %3
%23 = icmp slt i32 %22, 20
br label %24
24: ; preds = %21, %13, %5
%25 = phi i1 [ false, %13 ], [ false, %5 ], [ %23, %21 ]
br i1 %25, label %26, label %34
26: ; preds = %24
%27 = load i8*, i8** %2
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
%30 = sext i32 %28 to i64
%31 = getelementptr inbounds i8, i8* %27, i64 %30
%32 = load i8, i8* %31
%33 = call i32 @putchar(i8 signext %32)
br label %5
34: ; preds = %24
%35 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [2 x i8] c":\00"
define void @print_func_name(i8* nocapture %0) {
%2 = tail call i32 @putchar(i8 signext 10)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 40
br i1 %4, label %17, label %5
5: ; preds = %1, %11
%6 = phi i64 [ %12, %11 ], [ 0, %1 ]
%7 = phi i8 [ %15, %11 ], [ %3, %1 ]
%8 = icmp ne i8 %7, 0
%9 = icmp ult i64 %6, 20
%10 = select i1 %8, i1 %9, i1 false
br i1 %10, label %11, label %17
11: ; preds = %5
%12 = add nuw nsw i64 %6, 1
%13 = tail call i32 @putchar(i8 signext %7)
%14 = getelementptr inbounds i8, i8* %0, i64 %12
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 40
br i1 %16, label %17, label %5
17: ; preds = %5, %11, %1
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}