#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 scanto(char const *, int *, char);
int scan_DA(const char *str, int *pos) {
  int save = *pos;
  int value = scanto(str, pos, ';');
  if (value == 0) {
    *pos = save;
    value = scanto(str, pos, 'c');
    if (str[*pos] != '\0')
      value = 0;
  }
  return value;
}


x86 assembly (clang, -O0):
<scan_DA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x3b,%edx
call   1030 <scanto@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    118a <scan_DA+0x7a>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x63,%edx
call   1030 <scanto@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1185 <scan_DA+0x75>
movl   $0x0,-0x18(%rbp)
jmp    118a <scan_DA+0x7a>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_DA>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%ebp
mov    $0x3b,%edx
call   1030 <scanto@plt>
test   %eax,%eax
jne    114b <scan_DA+0x3b>
mov    %ebp,(%rbx)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x63,%edx
call   1030 <scanto@plt>
mov    %eax,%ecx
movslq (%rbx),%rdx
xor    %eax,%eax
cmpb   $0x0,(%r14,%rdx,1)
cmove  %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @scan_DA(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
store i32 %8, i32* %5
%9 = load i8*, i8** %3
%10 = load i32*, i32** %4
%11 = call i32 @scanto(i8* %9, i32* %10, i8 signext 59)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %30
14: ; preds = %2
%15 = load i32, i32* %5
%16 = load i32*, i32** %4
store i32 %15, i32* %16
%17 = load i8*, i8** %3
%18 = load i32*, i32** %4
%19 = call i32 @scanto(i8* %17, i32* %18, i8 signext 99)
store i32 %19, i32* %6
%20 = load i8*, i8** %3
%21 = load i32*, i32** %4
%22 = load i32, i32* %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %14
store i32 0, i32* %6
br label %29
29: ; preds = %28, %14
br label %30
30: ; preds = %29, %2
%31 = load i32, i32* %6
ret i32 %31
}

LLVM IR (-O2):
define i32 @scan_DA(i8* %0, i32* %1) {
%3 = load i32, i32* %1
%4 = tail call i32 @scanto(i8* %0, i32* %1, i8 signext 59)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %2
store i32 %3, i32* %1
%7 = tail call i32 @scanto(i8* %0, i32* %1, i8 signext 99)
%8 = load i32, i32* %1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
%13 = select i1 %12, i32 %7, i32 0
br label %14
14: ; preds = %6, %2
%15 = phi i32 [ %4, %2 ], [ %13, %6 ]
ret i32 %15
}