#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 IsValidGencode(int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ puts(char *);
scalar_t__ strcmp(char const *, char *);
int GetGeneticCode(const char *gencode_str) {
  int gencode;
  assert(NULL != gencode_str);
  if (strcmp(gencode_str, "universal") == 0) {
    gencode = 0;
  } else if (strcmp(gencode_str, "mammalian") == 0) {
    gencode = 1;
  } else {
    puts("Unrecognised genetic code - defaulting to universal");
    puts("Recognised codes are Universal \"universal\" or");
    puts("Mammalian mitochondrial \"mammalian\"");
    gencode = 0;
  }
  assert(IsValidGencode(gencode));
  return gencode;
}


x86 assembly (clang, -O0):
<GetGeneticCode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    0xeca(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1185 <GetGeneticCode+0x45>
movl   $0x0,-0xc(%rbp)
jmp    11db <GetGeneticCode+0x9b>
mov    -0x8(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ab <GetGeneticCode+0x6b>
movl   $0x1,-0xc(%rbp)
jmp    11d6 <GetGeneticCode+0x96>
lea    0xe58(%rip),%rdi
call   1030 <puts@plt>
lea    0xe80(%rip),%rdi
call   1030 <puts@plt>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0xc(%rbp)
jmp    11db <GetGeneticCode+0x9b>
mov    -0xc(%rbp),%edi
call   1060 <IsValidGencode@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetGeneticCode>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1050 <assert@plt>
lea    0xed9(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     11a9 <GetGeneticCode+0x69>
lea    0xe8f(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11a4 <GetGeneticCode+0x64>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
jmp    11a9 <GetGeneticCode+0x69>
mov    $0x1,%ebp
mov    %ebp,%edi
call   1060 <IsValidGencode@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"universal\00"
@.str.1 = [10 x i8] c"mammalian\00"
@.str.2 = [52 x i8] c"Unrecognised genetic code - defaulting to universal\00"
@.str.3 = [46 x i8] c"Recognised codes are Universal \22universal\22 or\00"
@.str.4 = [36 x i8] c"Mammalian mitochondrial \22mammalian\22\00"
define i32 @GetGeneticCode(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* null, %4
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i8*, i8** %2
%9 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 0, i32* %3
br label %22
12: ; preds = %1
%13 = load i8*, i8** %2
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 1, i32* %3
br label %21
17: ; preds = %12
%18 = call i32 @puts(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @puts(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %21
21: ; preds = %17, %16
br label %22
22: ; preds = %21, %11
%23 = load i32, i32* %3
%24 = call i32 @IsValidGencode(i32 %23)
%25 = call i32 @assert(i32 %24)
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [10 x i8] c"universal\00"
@.str.1 = [10 x i8] c"mammalian\00"
@.str.2 = [52 x i8] c"Unrecognised genetic code - defaulting to universal\00"
@.str.3 = [46 x i8] c"Recognised codes are Universal \22universal\22 or\00"
@.str.4 = [36 x i8] c"Mammalian mitochondrial \22mammalian\22\00"
define i32 @GetGeneticCode(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1
%8 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %7, %1, %10
%15 = phi i32 [ 0, %10 ], [ 0, %1 ], [ 1, %7 ]
%16 = tail call i32 @IsValidGencode(i32 %15)
%17 = tail call i32 @assert(i32 %16)
ret i32 %15
}