#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*/ fprintf(int /*<<< orphan*/, char *);
char *get_cipher_name(unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int, char *);
int /*<<< orphan*/ sscanf(char *, char *, unsigned int *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  unsigned int x = 0;
  if (argc != 2) {
    fprintf(stderr, "Invalid arguments given.\n");
    exit(1);
  }
  sscanf(argv[1], "%x", &x);
  printf("Name of cipher %.04x is %s\n", x, get_cipher_name(x));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1196 <main+0x46>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
lea    0xe79(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe75(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1050 <sscanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <get_cipher_name@plt>
mov    -0x18(%rbp),%esi
mov    %rax,%rdx
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
cmp    $0x2,%edi
jne    119b <main+0x4b>
mov    0x8(%rsi),%rdi
lea    0xead(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1050 <sscanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1070 <get_cipher_name@plt>
lea    0xe94(%rip),%rdi
mov    %ebx,%esi
mov    %rax,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
lea    0xe55(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"Invalid arguments given.\0A\00"
@.str.1 = [3 x i8] c"%x\00"
@.str.2 = [28 x i8] c"Name of cipher %.04x is %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%18 = load i32, i32* %6
%19 = load i32, i32* %6
%20 = call i8* @get_cipher_name(i32 %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %18, i8* %20)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"Invalid arguments given.\0A\00"
@.str.1 = [3 x i8] c"%x\00"
@.str.2 = [28 x i8] c"Name of cipher %.04x is %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = icmp eq i32 %0, 2
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%14 = load i32, i32* %3
%15 = call i8* @get_cipher_name(i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %14, i8* %15)
ret i32 0
}