#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 */
typedef size_t uint8_t;

/* Variables and functions */
int /*<<< orphan*/ _do_function(char *, double, double);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ free(void *);
scalar_t__ isalpha(char);
scalar_t__ isdigit(char);
double read_gcode_real(char *);
scalar_t__ skip_gcode_digits(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
void evaluate_unary_expression(char *line) {
  bool seenWord = false;
  char fname[strlen("ROUND") + 1], *sptr, *buf, c;
  uint8_t fni;
  double arg, sar;
  while ((c = *line)) {
    if ((isdigit(c) || c == '-') && seenWord) {
      line = (char *)skip_gcode_digits(line);
      seenWord = false;
      continue;
    } else if (isalpha(c)) {
      if (seenWord) {
        fni = 0;
        sptr = line;
        do {
          fname[fni++] = *line;
        } while (isalpha(*(++line)));
        fname[fni] = '\0';
        arg = read_gcode_real(line);
        line = (char *)skip_gcode_digits(line);
        if (*line == '/') {
          sar = read_gcode_real(++line);
          line = (char *)skip_gcode_digits(line);
        }
        buf = (char *)calloc(1, strlen(line) + strlen("%4.4f") + 1);
        strcpy(buf, "%4.4f");
        strcat(buf, line);
        line = sptr;
        snprintf(line, strlen(line), buf, _do_function(fname, arg, sar));
        free((void *)buf);
        line = (char *)skip_gcode_digits(line);
        continue;
      } else
        seenWord = true;
    }
    line++;
  }
  return;
}


x86 assembly (clang, -O0):
<evaluate_unary_expression>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe33(%rip),%rdi
call   1060 <strlen@plt>
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x31(%rbp)
cmp    $0x0,%al
je     13e2 <evaluate_unary_expression+0x232>
movsbl -0x31(%rbp),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
jne    1229 <evaluate_unary_expression+0x79>
movsbl -0x31(%rbp),%eax
cmp    $0x2d,%eax
jne    124c <evaluate_unary_expression+0x9c>
cmpl   $0x0,-0xc(%rbp)
je     124c <evaluate_unary_expression+0x9c>
mov    -0x8(%rbp),%rdi
call   10d0 <skip_gcode_digits@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    11f8 <evaluate_unary_expression+0x48>
movsbl -0x31(%rbp),%edi
call   10a0 <isalpha@plt>
cmp    $0x0,%rax
je     13cc <evaluate_unary_expression+0x21c>
cmpl   $0x0,-0xc(%rbp)
je     13c0 <evaluate_unary_expression+0x210>
movq   $0x0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x58(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%dl
mov    -0x40(%rbp),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,-0x40(%rbp)
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl 0x1(%rax),%edi
call   10a0 <isalpha@plt>
cmp    $0x0,%rax
jne    1279 <evaluate_unary_expression+0xc9>
mov    -0x58(%rbp),%rax
mov    -0x40(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   10b0 <read_gcode_real@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
call   10d0 <skip_gcode_digits@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1311 <evaluate_unary_expression+0x161>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    %rdi,-0x8(%rbp)
call   10b0 <read_gcode_real@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rdi
call   10d0 <skip_gcode_digits@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x74(%rbp)
lea    0xce2(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x74(%rbp),%esi
add    %eax,%esi
add    $0x1,%esi
mov    $0x1,%edi
call   1080 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xcbc(%rip),%rsi
call   1050 <strcpy@plt>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   10c0 <strcat@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    %eax,-0x64(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
call   1090 <_do_function@plt>
mov    -0x70(%rbp),%rdi
mov    -0x64(%rbp),%esi
mov    -0x60(%rbp),%rdx
mov    %eax,%ecx
call   1070 <snprintf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
call   10d0 <skip_gcode_digits@plt>
mov    %rax,-0x8(%rbp)
jmp    11f8 <evaluate_unary_expression+0x48>
movl   $0x1,-0xc(%rbp)
jmp    13cc <evaluate_unary_expression+0x21c>
jmp    13d1 <evaluate_unary_expression+0x221>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11f8 <evaluate_unary_expression+0x48>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluate_unary_expression>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r15
lea    0xe35(%rip),%rdi
call   1060 <strlen@plt>
add    $0x1,%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    (%r15),%al
test   %al,%al
je     1367 <evaluate_unary_expression+0x1b7>
xor    %r12d,%r12d
mov    $0x1,%r13d
jmp    1216 <evaluate_unary_expression+0x66>
nopw   0x0(%rax,%rax,1)
test   %rax,%rax
cmovne %r13d,%r12d
add    $0x1,%r15
mov    (%r15),%al
test   %al,%al
je     1367 <evaluate_unary_expression+0x1b7>
movsbl %al,%ebx
mov    %ebx,%edi
call   1040 <isdigit@plt>
test   %rax,%rax
sete   %al
cmp    $0x2d,%bl
setne  %cl
test   %cl,%al
jne    1250 <evaluate_unary_expression+0xa0>
test   %r12d,%r12d
je     1250 <evaluate_unary_expression+0xa0>
mov    %r15,%rdi
call   10d0 <skip_gcode_digits@plt>
mov    %rax,%r15
xor    %r12d,%r12d
jmp    120b <evaluate_unary_expression+0x5b>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   10a0 <isalpha@plt>
test   %rax,%rax
je     1200 <evaluate_unary_expression+0x50>
test   %r12d,%r12d
je     1200 <evaluate_unary_expression+0x50>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%r15,%rbx,1),%eax
mov    %al,(%r14,%rbx,1)
movsbl 0x1(%r15,%rbx,1),%edi
add    $0x1,%rbx
call   10a0 <isalpha@plt>
test   %rax,%rax
jne    1270 <evaluate_unary_expression+0xc0>
movb   $0x0,(%r14,%rbx,1)
add    %r15,%rbx
mov    %rbx,%rdi
call   10b0 <read_gcode_real@plt>
movsd  %xmm0,-0x38(%rbp)
mov    %rbx,%rdi
call   10d0 <skip_gcode_digits@plt>
mov    %rax,%rbx
cmpb   $0x2f,(%rax)
jne    12ce <evaluate_unary_expression+0x11e>
add    $0x1,%rbx
mov    %rbx,%rdi
call   10b0 <read_gcode_real@plt>
movsd  %xmm0,-0x30(%rbp)
mov    %rbx,%rdi
call   10d0 <skip_gcode_digits@plt>
mov    %rax,%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %eax,%r12d
lea    0xd26(%rip),%rdi
call   1060 <strlen@plt>
lea    (%r12,%rax,1),%esi
add    $0x1,%esi
mov    $0x1,%r12d
mov    $0x1,%edi
call   1080 <calloc@plt>
mov    %rax,%r13
mov    %rax,%rdi
lea    0xcfd(%rip),%rsi
call   1050 <strcpy@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10c0 <strcat@plt>
mov    %r15,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
call   1090 <_do_function@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r13,%rdx
mov    %eax,%ecx
call   1070 <snprintf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   10d0 <skip_gcode_digits@plt>
mov    %rax,%r15
mov    (%rax),%al
test   %al,%al
mov    $0x1,%r13d
jne    1216 <evaluate_unary_expression+0x66>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"ROUND\00"
@.str.1 = [6 x i8] c"%4.4f\00"
define void @evaluate_unary_expression(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8
%9 = alloca i64
%10 = alloca double
%11 = alloca double
store i8* %0, i8** %2
store i32 0, i32* %3
%12 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%13 = add nsw i32 %12, 1
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %4
%16 = alloca i8, i64 %14
store i64 %14, i64* %5
br label %17
17: ; preds = %106, %76, %32, %1
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
store i8 %19, i8* %8
%20 = icmp ne i8 %19, 0
br i1 %20, label %21, label %109
21: ; preds = %17
%22 = load i8, i8* %8
%23 = call i64 @isdigit(i8 signext %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i8, i8* %8
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 45
br i1 %28, label %29, label %36
29: ; preds = %25, %21
%30 = load i32, i32* %3
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i8*, i8** %2
%34 = call i64 @skip_gcode_digits(i8* %33)
%35 = inttoptr i64 %34 to i8*
store i8* %35, i8** %2
store i32 0, i32* %3
br label %17
36: ; preds = %29, %25
%37 = load i8, i8* %8
%38 = call i64 @isalpha(i8 signext %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %105
40: ; preds = %36
%41 = load i32, i32* %3
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %103
43: ; preds = %40
store i64 0, i64* %9
%44 = load i8*, i8** %2
store i8* %44, i8** %6
br label %45
45: ; preds = %51, %43
%46 = load i8*, i8** %2
%47 = load i8, i8* %46
%48 = load i64, i64* %9
%49 = add i64 %48, 1
store i64 %49, i64* %9
%50 = getelementptr inbounds i8, i8* %16, i64 %48
store i8 %47, i8* %50
br label %51
51: ; preds = %45
%52 = load i8*, i8** %2
%53 = getelementptr inbounds i8, i8* %52, i32 1
store i8* %53, i8** %2
%54 = load i8, i8* %53
%55 = call i64 @isalpha(i8 signext %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %45, label %57
57: ; preds = %51
%58 = load i64, i64* %9
%59 = getelementptr inbounds i8, i8* %16, i64 %58
store i8 0, i8* %59
%60 = load i8*, i8** %2
%61 = call double @read_gcode_real(i8* %60)
store double %61, double* %10
%62 = load i8*, i8** %2
%63 = call i64 @skip_gcode_digits(i8* %62)
%64 = inttoptr i64 %63 to i8*
store i8* %64, i8** %2
%65 = load i8*, i8** %2
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp eq i32 %67, 47
br i1 %68, label %69, label %76
69: ; preds = %57
%70 = load i8*, i8** %2
%71 = getelementptr inbounds i8, i8* %70, i32 1
store i8* %71, i8** %2
%72 = call double @read_gcode_real(i8* %71)
store double %72, double* %11
%73 = load i8*, i8** %2
%74 = call i64 @skip_gcode_digits(i8* %73)
%75 = inttoptr i64 %74 to i8*
store i8* %75, i8** %2
br label %76
76: ; preds = %69, %57
%77 = load i8*, i8** %2
%78 = call i32 @strlen(i8* %77)
%79 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%80 = add nsw i32 %78, %79
%81 = add nsw i32 %80, 1
%82 = call i64 @calloc(i32 1, i32 %81)
%83 = inttoptr i64 %82 to i8*
store i8* %83, i8** %7
%84 = load i8*, i8** %7
%85 = call i32 @strcpy(i8* %84, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%86 = load i8*, i8** %7
%87 = load i8*, i8** %2
%88 = call i32 @strcat(i8* %86, i8* %87)
%89 = load i8*, i8** %6
store i8* %89, i8** %2
%90 = load i8*, i8** %2
%91 = load i8*, i8** %2
%92 = call i32 @strlen(i8* %91)
%93 = load i8*, i8** %7
%94 = load double, double* %10
%95 = load double, double* %11
%96 = call i32 @_do_function(i8* %16, double %94, double %95)
%97 = call i32 @snprintf(i8* %90, i32 %92, i8* %93, i32 %96)
%98 = load i8*, i8** %7
%99 = call i32 @free(i8* %98)
%100 = load i8*, i8** %2
%101 = call i64 @skip_gcode_digits(i8* %100)
%102 = inttoptr i64 %101 to i8*
store i8* %102, i8** %2
br label %17
103: ; preds = %40
store i32 1, i32* %3
br label %104
104: ; preds = %103
br label %105
105: ; preds = %104, %36
br label %106
106: ; preds = %105
%107 = load i8*, i8** %2
%108 = getelementptr inbounds i8, i8* %107, i32 1
store i8* %108, i8** %2
br label %17
109: ; preds = %17
%110 = load i8*, i8** %4
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"ROUND\00"
@.str.1 = [6 x i8] c"%4.4f\00"
define void @evaluate_unary_expression(i8* %0) {
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = add nsw i32 %2, 1
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %80, label %8
8: ; preds = %1, %58
%9 = phi i8 [ %75, %58 ], [ %6, %1 ]
%10 = phi double [ %60, %58 ], [ undef, %1 ]
%11 = phi i8* [ %74, %58 ], [ %0, %1 ]
%12 = phi i32 [ 1, %58 ], [ 0, %1 ]
br label %13
13: ; preds = %8, %26
%14 = phi i8 [ %9, %8 ], [ %29, %26 ]
%15 = phi i8* [ %11, %8 ], [ %28, %26 ]
%16 = phi i32 [ %12, %8 ], [ %27, %26 ]
%17 = call i64 @isdigit(i8 signext %14)
%18 = icmp ne i64 %17, 0
%19 = icmp eq i8 %14, 45
%20 = or i1 %18, %19
%21 = icmp ne i32 %16, 0
%22 = select i1 %20, i1 %21, i1 false
br i1 %22, label %23, label %31
23: ; preds = %13
%24 = call i64 @skip_gcode_digits(i8* %15)
%25 = inttoptr i64 %24 to i8*
br label %26
26: ; preds = %23, %77
%27 = phi i32 [ 0, %23 ], [ %78, %77 ]
%28 = phi i8* [ %25, %23 ], [ %79, %77 ]
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 0
br i1 %30, label %80, label %13
31: ; preds = %13
%32 = call i64 @isalpha(i8 signext %14)
%33 = icmp eq i64 %32, 0
%34 = xor i1 %21, true
%35 = select i1 %33, i1 true, i1 %34
br i1 %35, label %77, label %36
36: ; preds = %31, %36
%37 = phi i64 [ %40, %36 ], [ 0, %31 ]
%38 = phi i8* [ %42, %36 ], [ %15, %31 ]
%39 = load i8, i8* %38
%40 = add i64 %37, 1
%41 = getelementptr inbounds i8, i8* %5, i64 %37
store i8 %39, i8* %41
%42 = getelementptr inbounds i8, i8* %38, i64 1
%43 = load i8, i8* %42
%44 = call i64 @isalpha(i8 signext %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %36
46: ; preds = %36
%47 = getelementptr inbounds i8, i8* %5, i64 %40
store i8 0, i8* %47
%48 = call double @read_gcode_real(i8* %42)
%49 = call i64 @skip_gcode_digits(i8* %42)
%50 = inttoptr i64 %49 to i8*
%51 = load i8, i8* %50
%52 = icmp eq i8 %51, 47
br i1 %52, label %53, label %58
53: ; preds = %46
%54 = getelementptr inbounds i8, i8* %50, i64 1
%55 = call double @read_gcode_real(i8* %54)
%56 = call i64 @skip_gcode_digits(i8* %54)
%57 = inttoptr i64 %56 to i8*
br label %58
58: ; preds = %53, %46
%59 = phi i8* [ %57, %53 ], [ %50, %46 ]
%60 = phi double [ %55, %53 ], [ %10, %46 ]
%61 = call i32 @strlen(i8* %59)
%62 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%63 = add i32 %61, 1
%64 = add i32 %63, %62
%65 = call i64 @calloc(i32 1, i32 %64)
%66 = inttoptr i64 %65 to i8*
%67 = call i32 @strcpy(i8* %66, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%68 = call i32 @strcat(i8* %66, i8* %59)
%69 = call i32 @strlen(i8* %15)
%70 = call i32 @_do_function(i8* %5, double %48, double %60)
%71 = call i32 @snprintf(i8* %15, i32 %69, i8* %66, i32 %70)
%72 = call i32 @free(i8* %66)
%73 = call i64 @skip_gcode_digits(i8* %15)
%74 = inttoptr i64 %73 to i8*
%75 = load i8, i8* %74
%76 = icmp eq i8 %75, 0
br i1 %76, label %80, label %8
77: ; preds = %31
%78 = select i1 %33, i32 %16, i32 1
%79 = getelementptr inbounds i8, i8* %15, i64 1
br label %26
80: ; preds = %58, %26, %1
ret void
}