#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 */
scalar_t__ get_line(char *, int /*<<< orphan*/);
char *make_key(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  char buffer[2048];
  if (argc == 2) {
    printf("%s\n", make_key(argv[1]));
  } else
    while (get_line(buffer, stdin))
      printf("%s\n", make_key(buffer));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1174 <main+0x44>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <make_key@plt>
mov    %rax,%rsi
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
jmp    11bd <main+0x8d>
jmp    1179 <main+0x49>
lea    -0x810(%rbp),%rdi
mov    0x2e61(%rip),%rax
mov    (%rax),%esi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     11b8 <main+0x88>
lea    -0x810(%rbp),%rdi
call   1050 <make_key@plt>
mov    %rax,%rsi
lea    0xe52(%rip),%rdi
call   1040 <printf@plt>
jmp    1179 <main+0x49>
jmp    11bd <main+0x8d>
xor    %eax,%eax
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x800,%rsp
cmp    $0x2,%edi
jne    115b <main+0x2b>
mov    0x8(%rsi),%rdi
call   1050 <make_key@plt>
lea    0xeaf(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
jmp    11a3 <main+0x73>
mov    0x2e86(%rip),%r15
mov    (%r15),%esi
mov    %rsp,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
je     11a3 <main+0x73>
mov    %rsp,%rbx
lea    0xe84(%rip),%r14
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <make_key@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    (%r15),%esi
mov    %rbx,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2048 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i8* @make_key(i8* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %26
15: ; preds = %2
br label %16
16: ; preds = %21, %15
%17 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%18 = load i32, i32* @stdin
%19 = call i64 @get_line(i8* %17, i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%23 = call i8* @make_key(i8* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %16
25: ; preds = %16
br label %26
26: ; preds = %25, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2048 x i8]
%4 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @stdin
%8 = call i64 @get_line(i8* %4, i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %21, label %15
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i8* @make_key(i8* %12)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %21
15: ; preds = %6, %15
%16 = call i8* @make_key(i8* %4)
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @stdin
%19 = call i64 @get_line(i8* %4, i32 %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %15
21: ; preds = %15, %6, %10
ret i32 0
}