#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 */
char *strrchr(char const *, char);
const char *progname(const char *progname) {
  const char *basename;
  if (!progname || !*progname)
    progname = "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/LuaDist2/cqueues/refs/heads/"
               "master/util/tcp-urgent.c";
  if ((basename = strrchr(progname, '/')) && basename[1])
    return &basename[1];
  return progname;
}


x86 assembly (clang, -O0):
<progname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1134 <progname+0x24>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    113f <progname+0x2f>
lea    0xec5(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     117d <progname+0x6d>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     117d <progname+0x6d>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1185 <progname+0x75>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<progname>:
push   %rbx
test   %rdi,%rdi
je     111e <progname+0xe>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
jne    1125 <progname+0x15>
lea    0xedb(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1144 <progname+0x34>
cmpb   $0x0,0x1(%rax)
je     1144 <progname+0x34>
add    $0x1,%rax
mov    %rax,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [143 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/LuaDist2/cqueues/refs/heads/master/util/tcp-urgent.c\00"
define i8* @progname(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7, %1
store i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i8** %3
br label %12
12: ; preds = %11, %7
%13 = load i8*, i8** %3
%14 = call i8* @strrchr(i8* %13, i8 signext 47)
store i8* %14, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %16
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 1
store i8* %24, i8** %2
br label %27
25: ; preds = %16, %12
%26 = load i8*, i8** %3
store i8* %26, i8** %2
br label %27
27: ; preds = %25, %22
%28 = load i8*, i8** %2
ret i8* %28
}

LLVM IR (-O2):
@.str = [143 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/LuaDist2/cqueues/refs/heads/master/util/tcp-urgent.c\00"
define i8* @progname(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %3, %1
br label %7
7: ; preds = %6, %3
%8 = phi i8* [ %0, %3 ], [ getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), %6 ]
%9 = tail call i8* @strrchr(i8* dereferenceable(1) %8, i8 signext 47)
%10 = icmp eq i8* %9, null
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11, %7
br label %16
16: ; preds = %11, %15
%17 = phi i8* [ %8, %15 ], [ %12, %11 ]
ret i8* %17
}