#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 /*<<< orphan*/ abort();
char *get_filename(char *);
char *strrchr(char *, char);
void target_info(char *argv[], char **triple, char **compiler) {
  char *p = get_filename(argv[0]);
  char *x = strrchr(p, '-');
  if (!x)
    abort();
  *compiler = &x[1];
  *x = '\0';
  *triple = p;
}


x86 assembly (clang, -O0):
<target_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <get_filename@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x2d,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1178 <target_info+0x48>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x28(%rbp),%rcx
add    $0x1,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<target_info>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    (%rdi),%rdi
call   1040 <get_filename@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x2d,%esi
call   1050 <strrchr@plt>
test   %rax,%rax
je     116e <target_info+0x3e>
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,(%r15)
movb   $0x0,(%rax)
mov    %rbx,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @target_info(i8** %0, i8** %1, i8** %2) {
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i8*
store i8** %0, i8*** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i8* @get_filename(i8* %11)
store i8* %12, i8** %7
%13 = load i8*, i8** %7
%14 = call i8* @strrchr(i8* %13, i8 signext 45)
store i8* %14, i8** %8
%15 = load i8*, i8** %8
%16 = icmp ne i8* %15, null
br i1 %16, label %19, label %17
17: ; preds = %3
%18 = call i32 (...) @abort()
unreachable
19: ; preds = %3
%20 = load i8*, i8** %8
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8**, i8*** %6
store i8* %21, i8** %22
%23 = load i8*, i8** %8
store i8 0, i8* %23
%24 = load i8*, i8** %7
%25 = load i8**, i8*** %5
store i8* %24, i8** %25
ret void
}

LLVM IR (-O2):
define void @target_info(i8** nocapture %0, i8** nocapture writeonly %1, i8** nocapture writeonly %2) {
%4 = load i8*, i8** %0
%5 = tail call i8* @get_filename(i8* %4)
%6 = tail call i8* @strrchr(i8* dereferenceable(1) %5, i8 signext 45)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %3
%11 = getelementptr inbounds i8, i8* %6, i64 1
store i8* %11, i8** %2
store i8 0, i8* %6
store i8* %5, i8** %1
ret void
}