void CheckBaseUnderscore(ok, name) int *ok;
char *name;
{
  int i = 0;
  *ok = 1;
  while (*ok && name[i] != '\0') {
    if (name[i] == '_') {
      *ok = 0;
    }
    i++;
  }
  if (!*ok) {
    Popup_Err(0, "Base names may not contain the underscore character!");
  }
}


x86 assembly (clang, -O0):
<CheckBaseUnderscore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x0,(%rcx)
mov    %al,-0x15(%rbp)
je     1158 <CheckBaseUnderscore+0x48>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1168 <CheckBaseUnderscore+0x58>
jmp    1195 <CheckBaseUnderscore+0x85>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5f,%eax
jne    1187 <CheckBaseUnderscore+0x77>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1131 <CheckBaseUnderscore+0x21>
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11b2 <CheckBaseUnderscore+0xa2>
xor    %edi,%edi
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1030 <Popup_Err@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckBaseUnderscore>:
movl   $0x1,(%rdi)
cs nopw 0x0(%rax,%rax,1)
movzbl (%rsi),%eax
test   %al,%al
je     1131 <CheckBaseUnderscore+0x21>
cmp    $0x5f,%al
je     1132 <CheckBaseUnderscore+0x22>
add    $0x1,%rsi
jmp    1120 <CheckBaseUnderscore+0x10>
ret
movl   $0x0,(%rdi)
lea    0xec1(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <Popup_Err@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"Base names may not contain the underscore character!\00"
define void @CheckBaseUnderscore(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
store i32 0, i32* %5
%6 = load i32*, i32** %3
store i32 1, i32* %6
br label %7
7: ; preds = %31, %2
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br label %19
19: ; preds = %11, %7
%20 = phi i1 [ false, %7 ], [ %18, %11 ]
br i1 %20, label %21, label %34
21: ; preds = %19
%22 = load i8*, i8** %4
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 95
br i1 %28, label %29, label %31
29: ; preds = %21
%30 = load i32*, i32** %3
store i32 0, i32* %30
br label %31
31: ; preds = %29, %21
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %7
34: ; preds = %19
%35 = load i32*, i32** %3
%36 = load i32, i32* %35
%37 = icmp ne i32 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %34
%39 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @Popup_Err to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
br label %40
40: ; preds = %38, %34
ret void
}

LLVM IR (-O2):
@.str = [53 x i8] c"Base names may not contain the underscore character!\00"
define void @CheckBaseUnderscore(i32* nocapture %0, i8* nocapture %1) {
store i32 1, i32* %0
br label %3
3: ; preds = %7, %2
%4 = phi i64 [ 0, %2 ], [ %8, %7 ]
%5 = getelementptr inbounds i8, i8* %1, i64 %4
%6 = load i8, i8* %5
switch i8 %6, label %7 [
i8 0, label %11
i8 95, label %9
]
7: ; preds = %3
%8 = add nuw i64 %4, 1
br label %3
9: ; preds = %3
store i32 0, i32* %0
%10 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @Popup_Err to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %3, %9
ret void
}