#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*/ Padded(char *, int, int);
int /*<<< orphan*/ encrytion(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int strlen(char *);
int main() {
  int c, m, k;
  char *n, *e;
  char to_encryted[20] = "SIX";
  char key[20] = "DR";
  char temp[20];
  k = strlen(to_encryted);
  c = strlen(key);
  m = k % c;
  if (m != 0) {
    Padded(to_encryted, k, c);
    printf(" padded output: %s\n", to_encryted);
  }
  encrytion(to_encryted, key);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xea2(%rip),%eax
mov    %eax,-0x30(%rbp)
mov    0xea8(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xea5(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xea3(%rip),%eax
mov    %eax,-0x50(%rbp)
lea    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11db <main+0x9b>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1050 <Padded@plt>
lea    -0x40(%rbp),%rsi
lea    0xe5e(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1060 <encrytion@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movaps 0xeb2(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
movaps 0xebf(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x30(%rsp)
mov    %rsp,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
lea    0x20(%rsp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     11ab <main+0x6b>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ecx,%edx
call   1050 <Padded@plt>
lea    0xe91(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    %rsp,%rdi
lea    0x20(%rsp),%rsi
call   1060 <encrytion@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.to_encryted = [20 x i8] c"SIX\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.key = [20 x i8] c"DR\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [20 x i8] c" padded output: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [20 x i8]
%8 = alloca [20 x i8]
%9 = alloca [20 x i8]
store i32 0, i32* %1
%10 = bitcast [20 x i8]* %7 to i8*
%11 = bitcast [20 x i8]* %8 to i8*
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %4
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %2
%16 = load i32, i32* %4
%17 = load i32, i32* %2
%18 = srem i32 %16, %17
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %0
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%23 = load i32, i32* %4
%24 = load i32, i32* %2
%25 = call i32 @Padded(i8* %22, i32 %23, i32 %24)
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%27 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %21, %0
%29 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%31 = call i32 @encrytion(i8* %29, i8* %30)
ret i32 0
}

LLVM IR (-O2):
@__const.main.to_encryted = [20 x i8] c"SIX\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.key = [20 x i8] c"DR\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [20 x i8] c" padded output: %s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 @strlen(i8* %3)
%6 = call i32 @strlen(i8* %4)
%7 = srem i32 %5, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %0
%10 = call i32 @Padded(i8* %3, i32 %5, i32 %6)
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %12
12: ; preds = %9, %0
%13 = call i32 @encrytion(i8* %3, i8* %4)
ret i32 0
}