char *pr_conversion(str)
char *str;
{
  char *start, *ptr, *match_bracket(), *find();
  start = find('(', str + 1);
  *start++ = '\0';
  ptr = match_bracket(start);
  *ptr = '\0';
  if (*(str + 1) == '$')
    printf("eval( %s);", start);
  else if (strncmp(str + 1, "dist", 4) == 0)
    printf("dist( %s);", start);
  else
    printf("fprint( outfile, \"%%%s\", %s);", str + 1, start);
  return (ptr + 1);
}


x86 assembly (clang, -O0):
<pr_conversion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
add    $0x1,%rsi
mov    $0x28,%edi
mov    $0x0,%al
call   1050 <find@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1060 <match_bracket@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x24,%eax
jne    11b4 <pr_conversion+0x74>
mov    -0x10(%rbp),%rsi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    120c <pr_conversion+0xcc>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
lea    0xe48(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11ed <pr_conversion+0xad>
mov    -0x10(%rbp),%rsi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1207 <pr_conversion+0xc7>
mov    -0x8(%rbp),%rsi
add    $0x1,%rsi
mov    -0x10(%rbp),%rdx
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    120c <pr_conversion+0xcc>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_conversion>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
lea    0x1(%rdi),%r15
mov    $0x28,%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <find@plt>
mov    %rax,%rbx
movb   $0x0,(%rax)
add    $0x1,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <match_bracket@plt>
mov    %rax,%r14
movb   $0x0,(%rax)
cmpb   $0x24,0x1(%r12)
jne    1189 <pr_conversion+0x49>
lea    0xe79(%rip),%rdi
jmp    11be <pr_conversion+0x7e>
lea    0xe7b(%rip),%rsi
mov    $0x4,%edx
mov    %r15,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     11b7 <pr_conversion+0x77>
lea    0xe73(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11c8 <pr_conversion+0x88>
lea    0xe52(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"eval( %s);\00"
@.str.1 = [5 x i8] c"dist\00"
@.str.2 = [11 x i8] c"dist( %s);\00"
@.str.3 = [30 x i8] c"fprint( outfile, \22%%%s\22, %s);\00"
define i8* @pr_conversion(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = call i8* (i32, i8*, ...) bitcast (i8* (...)* @find to i8* (i32, i8*, ...)*)(i32 40, i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %3
store i8 0, i8* %8
%10 = load i8*, i8** %3
%11 = call i8* (i8*, ...) bitcast (i8* (...)* @match_bracket to i8* (i8*, ...)*)(i8* %10)
store i8* %11, i8** %4
%12 = load i8*, i8** %4
store i8 0, i8* %12
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 36
br i1 %17, label %18, label %21
18: ; preds = %1
%19 = load i8*, i8** %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %19)
br label %35
21: ; preds = %1
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = call i32 @strncmp(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 4)
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = load i8*, i8** %3
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %27)
br label %34
29: ; preds = %21
%30 = load i8*, i8** %2
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = load i8*, i8** %3
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %31, i8* %32)
br label %34
34: ; preds = %29, %26
br label %35
35: ; preds = %34, %18
%36 = load i8*, i8** %4
%37 = getelementptr inbounds i8, i8* %36, i64 1
ret i8* %37
}

LLVM IR (-O2):
@.str = [11 x i8] c"eval( %s);\00"
@.str.1 = [5 x i8] c"dist\00"
@.str.2 = [11 x i8] c"dist( %s);\00"
@.str.3 = [30 x i8] c"fprint( outfile, \22%%%s\22, %s);\00"
define i8* @pr_conversion(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = tail call i8* (i32, i8*, ...) bitcast (i8* (...)* @find to i8* (i32, i8*, ...)*)(i32 40, i8* %2)
%4 = getelementptr inbounds i8, i8* %3, i64 1
store i8 0, i8* %3
%5 = tail call i8* (i8*, ...) bitcast (i8* (...)* @match_bracket to i8* (i8*, ...)*)(i8* %4)
store i8 0, i8* %5
%6 = load i8, i8* %2
%7 = icmp eq i8 %6, 36
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %17
10: ; preds = %1
%11 = tail call i32 @strncmp(i8* %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 4)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %4)
br label %17
15: ; preds = %10
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %2, i8* %4)
br label %17
17: ; preds = %13, %15, %8
%18 = getelementptr inbounds i8, i8* %5, i64 1
ret i8* %18
}