#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*/ putchar(char);
void dorefname(char *name) {
  char *dp = name, *ep;
again:
  while (*dp && *dp != '.')
    (void)putchar(*dp++);
  if (*dp)
    for (ep = dp + 1; *ep; ep++)
      if (*ep == '.') {
        (void)putchar(*dp++);
        goto again;
      }
  (void)putchar('.');
  if (*dp)
    dp++;
  while (*dp)
    (void)putchar(*dp++);
}


x86 assembly (clang, -O0):
<dorefname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1129 <dorefname+0x19>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     114e <dorefname+0x3e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    115e <dorefname+0x4e>
jmp    117a <dorefname+0x6a>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    1129 <dorefname+0x19>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11e7 <dorefname+0xd7>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11e2 <dorefname+0xd2>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11cc <dorefname+0xbc>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    1124 <dorefname+0x14>
jmp    11d1 <dorefname+0xc1>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1193 <dorefname+0x83>
jmp    11e7 <dorefname+0xd7>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     120a <dorefname+0xfa>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    120f <dorefname+0xff>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1238 <dorefname+0x128>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    120f <dorefname+0xff>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dorefname>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0x1(%rdi),%rbx
mov    (%r14),%cl
mov    %rbx,%rax
cmp    $0x2e,%cl
je     1130 <dorefname+0x20>
test   %cl,%cl
je     1154 <dorefname+0x44>
movsbl %cl,%edi
jmp    1145 <dorefname+0x35>
nop
movzbl (%rax),%ecx
test   %cl,%cl
je     1154 <dorefname+0x44>
add    $0x1,%rax
cmp    $0x2e,%cl
jne    1130 <dorefname+0x20>
mov    $0x2e,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
add    $0x1,%rbx
jmp    111b <dorefname+0xb>
mov    $0x2e,%edi
call   1030 <putchar@plt>
xor    %ecx,%ecx
cmpb   $0x0,(%r14)
setne  %cl
mov    (%r14,%rcx,1),%al
test   %al,%al
je     1193 <dorefname+0x83>
add    %rcx,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1180 <dorefname+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @dorefname(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
br label %6
6: ; preds = %40, %1
br label %7
7: ; preds = %19, %6
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 46
br label %17
17: ; preds = %12, %7
%18 = phi i1 [ false, %7 ], [ %16, %12 ]
br i1 %18, label %19, label %24
19: ; preds = %17
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
%22 = load i8, i8* %20
%23 = call i32 @putchar(i8 signext %22)
br label %7
24: ; preds = %17
%25 = load i8*, i8** %3
%26 = load i8, i8* %25
%27 = icmp ne i8 %26, 0
br i1 %27, label %28, label %50
28: ; preds = %24
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i64 1
store i8* %30, i8** %4
br label %31
31: ; preds = %46, %28
%32 = load i8*, i8** %4
%33 = load i8, i8* %32
%34 = icmp ne i8 %33, 0
br i1 %34, label %35, label %49
35: ; preds = %31
%36 = load i8*, i8** %4
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 46
br i1 %39, label %40, label %45
40: ; preds = %35
%41 = load i8*, i8** %3
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %3
%43 = load i8, i8* %41
%44 = call i32 @putchar(i8 signext %43)
br label %6
45: ; preds = %35
br label %46
46: ; preds = %45
%47 = load i8*, i8** %4
%48 = getelementptr inbounds i8, i8* %47, i32 1
store i8* %48, i8** %4
br label %31
49: ; preds = %31
br label %50
50: ; preds = %49, %24
%51 = call i32 @putchar(i8 signext 46)
%52 = load i8*, i8** %3
%53 = load i8, i8* %52
%54 = icmp ne i8 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = load i8*, i8** %3
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %3
br label %58
58: ; preds = %55, %50
br label %59
59: ; preds = %63, %58
%60 = load i8*, i8** %3
%61 = load i8, i8* %60
%62 = icmp ne i8 %61, 0
br i1 %62, label %63, label %68
63: ; preds = %59
%64 = load i8*, i8** %3
%65 = getelementptr inbounds i8, i8* %64, i32 1
store i8* %65, i8** %3
%66 = load i8, i8* %64
%67 = call i32 @putchar(i8 signext %66)
br label %59
68: ; preds = %59
ret void
}

LLVM IR (-O2):
define void @dorefname(i8* nocapture %0) {
br label %2
2: ; preds = %7, %1
%3 = phi i8* [ %0, %1 ], [ %8, %7 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %15
i8 46, label %9
]
5: ; preds = %2
%6 = tail call i32 @putchar(i8 signext %4)
br label %7
7: ; preds = %5, %13
%8 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
9: ; preds = %2, %9
%10 = phi i8* [ %11, %9 ], [ %3, %2 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
switch i8 %12, label %9 [
i8 0, label %15
i8 46, label %13
]
13: ; preds = %9
%14 = tail call i32 @putchar(i8 signext 46)
br label %7
15: ; preds = %2, %9
%16 = tail call i32 @putchar(i8 signext 46)
%17 = load i8, i8* %3
%18 = icmp ne i8 %17, 0
%19 = zext i1 %18 to i64
%20 = getelementptr i8, i8* %3, i64 %19
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %30, label %23
23: ; preds = %15, %23
%24 = phi i8 [ %28, %23 ], [ %21, %15 ]
%25 = phi i8* [ %26, %23 ], [ %20, %15 ]
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = tail call i32 @putchar(i8 signext %24)
%28 = load i8, i8* %26
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %23
30: ; preds = %23, %15
ret void
}