#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 strlen(char *);
int c_jfc_majmin(char *arg) {
  int lng;
  lng = strlen(arg) - 1;
  if (*(arg + lng) == '.') {
    *(arg + lng) = '\0';
    return (2);
  }
  if (*(arg + lng) == '_') {
    *(arg + lng) = '\0';
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<c_jfc_majmin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    1158 <c_jfc_majmin+0x48>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x2,-0x4(%rbp)
jmp    118c <c_jfc_majmin+0x7c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5f,%eax
jne    1185 <c_jfc_majmin+0x75>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x1,-0x4(%rbp)
jmp    118c <c_jfc_majmin+0x7c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_jfc_majmin>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
movslq %eax,%rcx
mov    -0x1(%rcx,%rbx,1),%dl
cmp    $0x2e,%dl
je     1133 <c_jfc_majmin+0x23>
xor    %eax,%eax
cmp    $0x5f,%dl
jne    113d <c_jfc_majmin+0x2d>
mov    $0x1,%eax
jmp    1138 <c_jfc_majmin+0x28>
mov    $0x2,%eax
movb   $0x0,-0x1(%rbx,%rcx,1)
pop    %rbx
ret

LLVM IR (-O0):
define i32 @c_jfc_majmin(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
%7 = sub nsw i32 %6, 1
store i32 %7, i32* %4
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 46
br i1 %14, label %15, label %20
15: ; preds = %1
%16 = load i8*, i8** %3
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 0, i8* %19
store i32 2, i32* %2
br label %34
20: ; preds = %1
%21 = load i8*, i8** %3
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 95
br i1 %27, label %28, label %33
28: ; preds = %20
%29 = load i8*, i8** %3
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
store i8 0, i8* %32
store i32 1, i32* %2
br label %34
33: ; preds = %20
store i32 0, i32* %2
br label %34
34: ; preds = %33, %28, %15
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @c_jfc_majmin(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
switch i8 %6, label %10 [
i8 46, label %8
i8 95, label %7
]
7: ; preds = %1
br label %8
8: ; preds = %1, %7
%9 = phi i32 [ 1, %7 ], [ 2, %1 ]
store i8 0, i8* %5
br label %10
10: ; preds = %8, %1
%11 = phi i32 [ 0, %1 ], [ %9, %8 ]
ret i32 %11
}