#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 */
typedef int /*<<< orphan*/ line;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *my_strchr(char *, char);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  char line[80];
  char *first_ptr;
  char *last_ptr;
  fgets(line, sizeof(line), stdin);
  line[strlen(line) - 1] = '\0';
  last_ptr = line;
  first_ptr = my_strchr(line, '/');
  if (first_ptr == NULL) {
    fprintf(stderr, "Error: Unable to find slash in %s\n", line);
    exit(8);
  }
  *first_ptr = '\0';
  ++first_ptr;
  printf("First:%s Last:%s\n", first_ptr, last_ptr);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
mov    0x2e6e(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1050 <fgets@plt>
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x60(%rbp,%rax,1)
lea    -0x60(%rbp),%rax
mov    %rax,-0x70(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0x2f,%esi
call   1070 <my_strchr@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    11e1 <main+0x81>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
lea    -0x60(%rbp),%rdx
lea    0xe2e(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x8,%edi
call   1080 <exit@plt>
mov    -0x68(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rsi
mov    -0x70(%rbp),%rdx
lea    0xe20(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
mov    0x2e7c(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1070 <my_strchr@plt>
test   %rax,%rax
je     11c0 <main+0x60>
movb   $0x0,(%rax)
add    $0x1,%rax
lea    0xe76(%rip),%rdi
mov    %rsp,%rdx
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
lea    0xe30(%rip),%rsi
mov    %rsp,%rdx
call   1060 <fprintf@plt>
mov    $0x8,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stdin = global i32 0
@stderr = global i32 0
@.str = [35 x i8] c"Error: Unable to find slash in %s\0A\00"
@.str.1 = [18 x i8] c"First:%s Last:%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %5, i32 80, i32 %6)
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
%10 = sub nsw i32 %9, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %11
store i8 0, i8* %12
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
store i8* %13, i8** %4
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%15 = call i8* @my_strchr(i8* %14, i8 signext 47)
store i8* %15, i8** %3
%16 = load i8*, i8** %3
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %23
18: ; preds = %0
%19 = load i32, i32* @stderr
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%21 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 8)
unreachable
23: ; preds = %0
%24 = load i8*, i8** %3
store i8 0, i8* %24
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %3
%27 = load i8*, i8** %3
%28 = load i8*, i8** %4
%29 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %27, i8* %28)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@stderr = global i32 0
@.str = [35 x i8] c"Error: Unable to find slash in %s\0A\00"
@.str.1 = [18 x i8] c"First:%s Last:%s\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 80, i32 %3)
%5 = call i32 @strlen(i8* %2)
%6 = add nsw i32 %5, -1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %7
store i8 0, i8* %8
%9 = call i8* @my_strchr(i8* %2, i8 signext 47)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %0
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %2)
%14 = call i32 @exit(i32 8)
unreachable
15: ; preds = %0
store i8 0, i8* %9
%16 = getelementptr inbounds i8, i8* %9, i64 1
%17 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %16, i8* %2)
ret i32 0
}