#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 */
struct cstr_t {
  int dummy;
};

/* Variables and functions */
int cstr_count(struct cstr_t const *);
char cstr_get(struct cstr_t const *, int);
int cstr_skiptill_chr(const struct cstr_t *str, int i, char tillchar) {
  ;
  int l = cstr_count(str);
  int j;
  for (j = i; j < l; j++) {
    char c = cstr_get(str, j);
    if (c == tillchar) {
      return (j);
    };
  }
  { return (j); };
}


x86 assembly (clang, -O0):
<cstr_skiptill_chr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %al,-0x15(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <cstr_count@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    118f <cstr_skiptill_chr+0x6f>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1040 <cstr_get@plt>
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%eax
movsbl -0x15(%rbp),%ecx
cmp    %ecx,%eax
jne    117c <cstr_skiptill_chr+0x5c>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1195 <cstr_skiptill_chr+0x75>
jmp    1181 <cstr_skiptill_chr+0x61>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1146 <cstr_skiptill_chr+0x26>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cstr_skiptill_chr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%r15
call   1030 <cstr_count@plt>
cmp    %ebx,%eax
jle    1158 <cstr_skiptill_chr+0x38>
mov    %eax,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebx,%esi
call   1040 <cstr_get@plt>
cmp    %r14b,%al
je     1158 <cstr_skiptill_chr+0x38>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1140 <cstr_skiptill_chr+0x20>
mov    %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.cstr_t = type { i32 }
define i32 @cstr_skiptill_chr(%struct.cstr_t* %0, i32 %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca %struct.cstr_t*
%6 = alloca i32
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
store %struct.cstr_t* %0, %struct.cstr_t** %5
store i32 %1, i32* %6
store i8 %2, i8* %7
%11 = load %struct.cstr_t*, %struct.cstr_t** %5
%12 = call i32 @cstr_count(%struct.cstr_t* %11)
store i32 %12, i32* %8
%13 = load i32, i32* %6
store i32 %13, i32* %9
br label %14
14: ; preds = %30, %3
%15 = load i32, i32* %9
%16 = load i32, i32* %8
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %33
18: ; preds = %14
%19 = load %struct.cstr_t*, %struct.cstr_t** %5
%20 = load i32, i32* %9
%21 = call signext i8 @cstr_get(%struct.cstr_t* %19, i32 %20)
store i8 %21, i8* %10
%22 = load i8, i8* %10
%23 = sext i8 %22 to i32
%24 = load i8, i8* %7
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %23, %25
br i1 %26, label %27, label %29
27: ; preds = %18
%28 = load i32, i32* %9
store i32 %28, i32* %4
br label %35
29: ; preds = %18
br label %30
30: ; preds = %29
%31 = load i32, i32* %9
%32 = add nsw i32 %31, 1
store i32 %32, i32* %9
br label %14
33: ; preds = %14
%34 = load i32, i32* %9
store i32 %34, i32* %4
br label %35
35: ; preds = %33, %27
%36 = load i32, i32* %4
ret i32 %36
}

LLVM IR (-O2):
%struct.cstr_t = type { i32 }
define i32 @cstr_skiptill_chr(%struct.cstr_t* %0, i32 %1, i8 signext %2) {
%4 = tail call i32 @cstr_count(%struct.cstr_t* %0)
%5 = icmp sgt i32 %4, %1
br i1 %5, label %6, label %13
6: ; preds = %3, %10
%7 = phi i32 [ %11, %10 ], [ %1, %3 ]
%8 = tail call signext i8 @cstr_get(%struct.cstr_t* %0, i32 %7)
%9 = icmp eq i8 %8, %2
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = add i32 %7, 1
%12 = icmp eq i32 %11, %4
br i1 %12, label %13, label %6
13: ; preds = %6, %10, %3
%14 = phi i32 [ %1, %3 ], [ %4, %10 ], [ %7, %6 ]
ret i32 %14
}