#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 atoi(char *);
int /*<<< orphan*/ cipher(int, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  if (argc != 3)
    printf("%s\n", "Ya done goofed, Usage is ./program key plaintext");
  int key = atoi(argv[1]);
  if (key < 0) {
    key = key % 26;
    key += 26;
  }
  cipher(key, argv[2]);
  printf("%s", argv[2]);
  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)
cmpl   $0x3,-0x8(%rbp)
je     1163 <main+0x33>
lea    0xea9(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1194 <main+0x64>
mov    -0x14(%rbp),%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1a,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1040 <cipher@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x3,%edi
je     114c <main+0x1c>
lea    0xec0(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1030 <printf@plt>
mov    0x8(%rbx),%rdi
call   1050 <atoi@plt>
test   %eax,%eax
jns    1175 <main+0x45>
mov    %eax,%ecx
neg    %ecx
imul   $0x4ec4ec4f,%rcx,%rcx
shr    $0x23,%rcx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
add    %edx,%eax
add    $0x1a,%eax
mov    0x10(%rbx),%rsi
mov    %eax,%edi
call   1040 <cipher@plt>
mov    0x10(%rbx),%rsi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [49 x i8] c"Ya done goofed, Usage is ./program key plaintext\00"
@.str.2 = [3 x i8] c"%s\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
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %11
%19 = load i32, i32* %6
%20 = srem i32 %19, 26
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 26
store i32 %22, i32* %6
br label %23
23: ; preds = %18, %11
%24 = load i32, i32* %6
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @cipher(i32 %24, i8* %27)
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [49 x i8] c"Ya done goofed, Usage is ./program key plaintext\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = sub i32 0, %9
%13 = urem i32 %12, 26
%14 = sub nuw nsw i32 26, %13
br label %15
15: ; preds = %11, %6
%16 = phi i32 [ %14, %11 ], [ %9, %6 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = tail call i32 @cipher(i32 %16, i8* %18)
%20 = load i8*, i8** %17
%21 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %20)
ret i32 0
}