int parseclef(s, word, gotclef, clefstr, gotoctave, octave)
char **s;
char *word;
int *gotclef;
char *clefstr;
int *gotoctave, *octave;
{
  int successful;
  skipspace(s);
  *s = readword(word, *s);
  successful = 0;
  if (strcasecmp(word, "clef") == 0) {
    skipspace(s);
    if (**s != '=') {
      event_error("clef must be followed by '='");
    } else {
      *s = *s + 1;
      skipspace(s);
      *s = readword(clefstr, *s);
      if (isclef(clefstr, gotoctave, octave, 0)) {
        *gotclef = 1;
      };
    };
    successful = 1;
  } else if (isclef(word, gotoctave, octave, 1)) {
    *gotclef = 1;
    strcpy(clefstr, word);
    successful = 1;
  };
  return successful;
}


x86 assembly (clang, -O0):
<parseclef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1070 <skipspace@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    $0x0,%al
call   1080 <readword@plt>
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe47(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    126a <parseclef+0x10a>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1070 <skipspace@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
je     11f8 <parseclef+0x98>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1050 <event_error@plt>
jmp    125e <parseclef+0xfe>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1070 <skipspace@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    $0x0,%al
call   1080 <readword@plt>
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
xor    %ecx,%ecx
mov    $0x0,%al
call   1060 <isclef@plt>
cmp    $0x0,%eax
je     1259 <parseclef+0xf9>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
jmp    125e <parseclef+0xfe>
movl   $0x1,-0x34(%rbp)
jmp    12ae <parseclef+0x14e>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    $0x1,%ecx
mov    $0x0,%al
call   1060 <isclef@plt>
cmp    $0x0,%eax
je     12a9 <parseclef+0x149>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
movl   $0x1,-0x34(%rbp)
jmp    12ae <parseclef+0x14e>
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseclef>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r12
mov    %r8,%r13
mov    %rcx,%r15
mov    %rdx,(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1070 <skipspace@plt>
mov    (%rbx),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <readword@plt>
cltq
mov    %rax,(%rbx)
lea    0xe60(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     11e0 <parseclef+0x80>
mov    %r14,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
mov    $0x1,%ecx
xor    %eax,%eax
call   1060 <isclef@plt>
test   %eax,%eax
je     124f <parseclef+0xef>
mov    (%rsp),%rax
movl   $0x1,(%rax)
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
jmp    124a <parseclef+0xea>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <skipspace@plt>
mov    (%rbx),%rax
cmpb   $0x3d,(%rax)
jne    123c <parseclef+0xdc>
add    $0x1,%rax
mov    %rax,(%rbx)
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <skipspace@plt>
mov    (%rbx),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1080 <readword@plt>
cltq
mov    %rax,(%rbx)
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
xor    %ecx,%ecx
xor    %eax,%eax
call   1060 <isclef@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     124f <parseclef+0xef>
mov    (%rsp),%rax
movl   $0x1,(%rax)
jmp    124f <parseclef+0xef>
lea    0xdc2(%rip),%rdi
xor    %eax,%eax
call   1050 <event_error@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"clef\00"
@.str.1 = [29 x i8] c"clef must be followed by '='\00"
define i32 @parseclef(i8** %0, i8* %1, i32* %2, i8* %3, i32* %4, i32* %5) {
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
store i8** %0, i8*** %7
store i8* %1, i8** %8
store i32* %2, i32** %9
store i8* %3, i8** %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%14 = load i8**, i8*** %7
%15 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %14)
%16 = load i8*, i8** %8
%17 = load i8**, i8*** %7
%18 = load i8*, i8** %17
%19 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @readword to i32 (i8*, i8*, ...)*)(i8* %16, i8* %18)
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i8*
%22 = load i8**, i8*** %7
store i8* %21, i8** %22
store i32 0, i32* %13
%23 = load i8*, i8** %8
%24 = call i32 @strcasecmp(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %59
26: ; preds = %6
%27 = load i8**, i8*** %7
%28 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %27)
%29 = load i8**, i8*** %7
%30 = load i8*, i8** %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 61
br i1 %33, label %34, label %36
34: ; preds = %26
%35 = call i32 (i8*, ...) bitcast (i32 (...)* @event_error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %58
36: ; preds = %26
%37 = load i8**, i8*** %7
%38 = load i8*, i8** %37
%39 = getelementptr inbounds i8, i8* %38, i64 1
%40 = load i8**, i8*** %7
store i8* %39, i8** %40
%41 = load i8**, i8*** %7
%42 = call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %41)
%43 = load i8*, i8** %10
%44 = load i8**, i8*** %7
%45 = load i8*, i8** %44
%46 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @readword to i32 (i8*, i8*, ...)*)(i8* %43, i8* %45)
%47 = sext i32 %46 to i64
%48 = inttoptr i64 %47 to i8*
%49 = load i8**, i8*** %7
store i8* %48, i8** %49
%50 = load i8*, i8** %10
%51 = load i32*, i32** %11
%52 = load i32*, i32** %12
%53 = call i32 (i8*, i32*, i32*, i32, ...) bitcast (i32 (...)* @isclef to i32 (i8*, i32*, i32*, i32, ...)*)(i8* %50, i32* %51, i32* %52, i32 0)
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %36
%56 = load i32*, i32** %9
store i32 1, i32* %56
br label %57
57: ; preds = %55, %36
br label %58
58: ; preds = %57, %34
store i32 1, i32* %13
br label %71
59: ; preds = %6
%60 = load i8*, i8** %8
%61 = load i32*, i32** %11
%62 = load i32*, i32** %12
%63 = call i32 (i8*, i32*, i32*, i32, ...) bitcast (i32 (...)* @isclef to i32 (i8*, i32*, i32*, i32, ...)*)(i8* %60, i32* %61, i32* %62, i32 1)
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %70
65: ; preds = %59
%66 = load i32*, i32** %9
store i32 1, i32* %66
%67 = load i8*, i8** %10
%68 = load i8*, i8** %8
%69 = call i8* @strcpy(i8* %67, i8* %68)
store i32 1, i32* %13
br label %70
70: ; preds = %65, %59
br label %71
71: ; preds = %70, %58
%72 = load i32, i32* %13
ret i32 %72
}

LLVM IR (-O2):
@.str = [5 x i8] c"clef\00"
@.str.1 = [29 x i8] c"clef must be followed by '='\00"
define i32 @parseclef(i8** %0, i8* %1, i32* nocapture writeonly %2, i8* %3, i32* %4, i32* %5) {
%7 = tail call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %0)
%8 = load i8*, i8** %0
%9 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @readword to i32 (i8*, i8*, ...)*)(i8* %1, i8* %8)
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %0
%12 = tail call i32 @strcasecmp(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %31
14: ; preds = %6
%15 = tail call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %0)
%16 = load i8*, i8** %0
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 61
br i1 %18, label %21, label %19
19: ; preds = %14
%20 = tail call i32 (i8*, ...) bitcast (i32 (...)* @event_error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %36
21: ; preds = %14
%22 = getelementptr inbounds i8, i8* %16, i64 1
store i8* %22, i8** %0
%23 = tail call i32 (i8**, ...) bitcast (i32 (...)* @skipspace to i32 (i8**, ...)*)(i8** %0)
%24 = load i8*, i8** %0
%25 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @readword to i32 (i8*, i8*, ...)*)(i8* %3, i8* %24)
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to i8*
store i8* %27, i8** %0
%28 = tail call i32 (i8*, i32*, i32*, i32, ...) bitcast (i32 (...)* @isclef to i32 (i8*, i32*, i32*, i32, ...)*)(i8* %3, i32* %4, i32* %5, i32 0)
%29 = icmp eq i32 %28, 0
br i1 %29, label %36, label %30
30: ; preds = %21
store i32 1, i32* %2
br label %36
31: ; preds = %6
%32 = tail call i32 (i8*, i32*, i32*, i32, ...) bitcast (i32 (...)* @isclef to i32 (i8*, i32*, i32*, i32, ...)*)(i8* %1, i32* %4, i32* %5, i32 1)
%33 = icmp eq i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %31
store i32 1, i32* %2
%35 = tail call i8* @strcpy(i8* dereferenceable(1) %3, i8* dereferenceable(1) %1)
br label %36
36: ; preds = %19, %30, %21, %31, %34
%37 = phi i32 [ 1, %34 ], [ 0, %31 ], [ 1, %21 ], [ 1, %30 ], [ 1, %19 ]
ret i32 %37
}