#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 doHash(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char *argv[]) {
  char temp[100];
  if (argc > 1) {
    strncpy(temp, argv[1], 100);
    temp[99] = '\0';
    if (strlen(temp) > 0)
      printf("Passcode for %s is %d\n", temp, doHash(temp));
  } else
    printf("Usage:callpass <callsign>\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11c0 <main+0x80>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x64,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x1d(%rbp)
lea    -0x80(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
jle    11bb <main+0x7b>
lea    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
lea    -0x80(%rbp),%rdi
call   1040 <doHash@plt>
mov    -0x88(%rbp),%rsi
mov    %eax,%edx
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    11ce <main+0x8e>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
cmp    $0x2,%edi
jl     11a0 <main+0x50>
mov    0x8(%rsi),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x63(%rsp)
mov    %rbx,%rdi
call   1060 <strlen@plt>
test   %rax,%rax
jle    11ac <main+0x5c>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <doHash@plt>
lea    0xe6e(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <printf@plt>
jmp    11ac <main+0x5c>
lea    0xe70(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Passcode for %s is %d\0A\00"
@.str.1 = [27 x i8] c"Usage:callpass <callsign>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %25
9: ; preds = %2
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strncpy(i8* %10, i8* %13, i32 100)
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 99
store i8 0, i8* %15
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%17 = call i64 @strlen(i8* %16)
%18 = icmp sgt i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %9
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%22 = call i32 @doHash(i8* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %20, i32 %22)
br label %24
24: ; preds = %19, %9
br label %27
25: ; preds = %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %25, %24
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Passcode for %s is %d\0A\00"
@str = [26 x i8] c"Usage:callpass <callsign>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %16
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @strncpy(i8* %4, i8* %8, i32 100)
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 99
store i8 0, i8* %10
%11 = call i64 @strlen(i8* %4)
%12 = icmp sgt i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %6
%14 = call i32 @doHash(i8* %4)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %14)
br label %18
16: ; preds = %2
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %18
18: ; preds = %6, %13, %16
ret i32 0
}