#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 */
scalar_t__ do_bug_on(int, char *, char *, int);
size_t strnlen(char *, size_t);
int make_label(char *s, const char *end) {
  size_t n, size;
  if (do_bug_on(!s, "!s",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/01org/processor-trace/refs/"
                "heads/master/pttc/src/yasm.c",
                379))
    return 0;
  if (do_bug_on(end <= s, "end <= s",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/01org/processor-trace/refs/"
                "heads/master/pttc/src/yasm.c",
                382))
    return 0;
  size = (size_t)((uintptr_t)end - (uintptr_t)s);
  n = strnlen(s, size);
  if (size <= n)
    return 0;
  if (n == 0 || s[n - 1] != ':')
    return 0;
  s[n - 1] = '\0';
  return 1;
}


x86 assembly (clang, -O0):
<make_label>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xeba(%rip),%rsi
lea    0xeb6(%rip),%rdx
mov    $0x17b,%ecx
call   1030 <do_bug_on@plt>
cmp    $0x0,%rax
je     116d <make_label+0x4d>
movl   $0x0,-0x4(%rbp)
jmp    122c <make_label+0x10c>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
setbe  %al
and    $0x1,%al
movzbl %al,%edi
lea    0xf11(%rip),%rsi
lea    0xe78(%rip),%rdx
mov    $0x17e,%ecx
call   1030 <do_bug_on@plt>
cmp    $0x0,%rax
je     11ab <make_label+0x8b>
movl   $0x0,-0x4(%rbp)
jmp    122c <make_label+0x10c>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <strnlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
ja     11e5 <make_label+0xc5>
movl   $0x0,-0x4(%rbp)
jmp    122c <make_label+0x10c>
cmpq   $0x0,-0x20(%rbp)
je     1209 <make_label+0xe9>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
je     1215 <make_label+0xf5>
movl   $0x0,-0x4(%rbp)
jmp    122c <make_label+0x10c>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_label>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbp
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
sete   %dil
lea    0xec6(%rip),%rsi
lea    0xec2(%rip),%rdx
mov    $0x17b,%ecx
call   1030 <do_bug_on@plt>
xor    %r14d,%r14d
test   %rax,%rax
jne    1179 <make_label+0x59>
xor    %edi,%edi
sub    %rbx,%rbp
setbe  %dil
lea    0xf32(%rip),%rsi
lea    0xe99(%rip),%rdx
mov    $0x17e,%ecx
call   1030 <do_bug_on@plt>
test   %rax,%rax
je     1181 <make_label+0x61>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <strnlen@plt>
cmp    %rax,%rbp
jbe    1179 <make_label+0x59>
test   %rax,%rax
je     1179 <make_label+0x59>
cmpb   $0x3a,-0x1(%rax,%rbx,1)
jne    1179 <make_label+0x59>
movb   $0x0,-0x1(%rbx,%rax,1)
mov    $0x1,%r14d
jmp    1179 <make_label+0x59>

LLVM IR (-O0):
@.str = [3 x i8] c"!s\00"
@.str.1 = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/01org/processor-trace/refs/heads/master/pttc/src/yasm.c\00"
@.str.2 = [9 x i8] c"end <= s\00"
define i32 @make_label(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
%10 = xor i1 %9, true
%11 = zext i1 %10 to i32
%12 = call i64 @do_bug_on(i32 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 379)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 0, i32* %3
br label %53
15: ; preds = %2
%16 = load i8*, i8** %5
%17 = load i8*, i8** %4
%18 = icmp ule i8* %16, %17
%19 = zext i1 %18 to i32
%20 = call i64 @do_bug_on(i32 %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 382)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %15
store i32 0, i32* %3
br label %53
23: ; preds = %15
%24 = load i8*, i8** %5
%25 = ptrtoint i8* %24 to i64
%26 = load i8*, i8** %4
%27 = ptrtoint i8* %26 to i64
%28 = sub i64 %25, %27
store i64 %28, i64* %7
%29 = load i8*, i8** %4
%30 = load i64, i64* %7
%31 = call i64 @strnlen(i8* %29, i64 %30)
store i64 %31, i64* %6
%32 = load i64, i64* %7
%33 = load i64, i64* %6
%34 = icmp ule i64 %32, %33
br i1 %34, label %35, label %36
35: ; preds = %23
store i32 0, i32* %3
br label %53
36: ; preds = %23
%37 = load i64, i64* %6
%38 = icmp eq i64 %37, 0
br i1 %38, label %47, label %39
39: ; preds = %36
%40 = load i8*, i8** %4
%41 = load i64, i64* %6
%42 = sub i64 %41, 1
%43 = getelementptr inbounds i8, i8* %40, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp ne i32 %45, 58
br i1 %46, label %47, label %48
47: ; preds = %39, %36
store i32 0, i32* %3
br label %53
48: ; preds = %39
%49 = load i8*, i8** %4
%50 = load i64, i64* %6
%51 = sub i64 %50, 1
%52 = getelementptr inbounds i8, i8* %49, i64 %51
store i8 0, i8* %52
store i32 1, i32* %3
br label %53
53: ; preds = %48, %47, %35, %22, %14
%54 = load i32, i32* %3
ret i32 %54
}

LLVM IR (-O2):
@.str = [3 x i8] c"!s\00"
@.str.1 = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/01org/processor-trace/refs/heads/master/pttc/src/yasm.c\00"
@.str.2 = [9 x i8] c"end <= s\00"
define i32 @make_label(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i64 @do_bug_on(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 379)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %26
7: ; preds = %2
%8 = icmp ule i8* %1, %0
%9 = zext i1 %8 to i32
%10 = tail call i64 @do_bug_on(i32 %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 382)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %26
12: ; preds = %7
%13 = ptrtoint i8* %1 to i64
%14 = ptrtoint i8* %0 to i64
%15 = sub i64 %13, %14
%16 = tail call i64 @strnlen(i8* %0, i64 %15)
%17 = icmp ule i64 %15, %16
%18 = icmp eq i64 %16, 0
%19 = or i1 %17, %18
br i1 %19, label %26, label %20
20: ; preds = %12
%21 = add i64 %16, -1
%22 = getelementptr inbounds i8, i8* %0, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 58
br i1 %24, label %25, label %26
25: ; preds = %20
store i8 0, i8* %22
br label %26
26: ; preds = %20, %12, %7, %2, %25
%27 = phi i32 [ 1, %25 ], [ 0, %2 ], [ 0, %7 ], [ 0, %12 ], [ 0, %20 ]
ret i32 %27
}