#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*/ exit(int);
int /*<<< orphan*/ printf(char *, char);
char *get_name_from_opt(char *opt) {
  if (opt[0] != '-') {
    printf("Illegal option character %c. Expected -. Exiting.\n", opt[0]);
    exit(1);
  } else if (opt[1] == '-') {
    return opt + 2;
  } else {
    return opt + 1;
  }
}


x86 assembly (clang, -O0):
<get_name_from_opt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     1159 <get_name_from_opt+0x39>
mov    -0x10(%rbp),%rax
lea    0xeb9(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2d,%eax
jne    117b <get_name_from_opt+0x5b>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
jmp    1187 <get_name_from_opt+0x67>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_name_from_opt>:
push   %rax
mov    (%rdi),%al
cmp    $0x2d,%al
jne    1139 <get_name_from_opt+0x19>
lea    0x1(%rdi),%rax
lea    0x2(%rdi),%rcx
cmpb   $0x2d,0x1(%rdi)
cmove  %rcx,%rax
pop    %rcx
ret
movsbl %al,%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"Illegal option character %c. Expected -. Exiting.\0A\00"
define i8* @get_name_from_opt(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 45
br i1 %8, label %9, label %15
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8 signext %12)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %1
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 45
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 2
store i8* %23, i8** %2
br label %27
24: ; preds = %15
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 1
store i8* %26, i8** %2
br label %27
27: ; preds = %24, %21
%28 = load i8*, i8** %2
ret i8* %28
}

LLVM IR (-O2):
@.str = [51 x i8] c"Illegal option character %c. Expected -. Exiting.\0A\00"
define i8* @get_name_from_opt(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 45
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8 signext %2)
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 45
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = select i1 %10, i8* %11, i8* %8
ret i8* %12
}