#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*/ printf(char *, ...);
int /*<<< orphan*/ psdes(unsigned long *, unsigned long *);
int main(void) {
  static unsigned long lword[5] = {0, 1, 1, 99, 99};
  static unsigned long irword[5] = {0, 1, 99, 1, 99};
  static char *ans[5] = {"", "0x604d1dce 0x509c0c23", "0xd97f8571 0xa66cb41a",
                         "0x7822309d 0x64300984", "0xd7f376f0 0x59ba89eb"};
  int i;
  for (i = 1; i <= 4; i++) {
    psdes(&lword[i], &irword[i]);
    printf("PSDES now calculates:       0x%x 0x%x\n", lword[i], irword[i]);
    printf("Known correct answers are:  %s\n", ans[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jg     11c0 <main+0xa0>
movslq -0x8(%rbp),%rax
lea    0x2ef5(%rip),%rdi
shl    $0x3,%rax
add    %rax,%rdi
movslq -0x8(%rbp),%rax
lea    0x2f13(%rip),%rsi
shl    $0x3,%rax
add    %rax,%rsi
call   1040 <psdes@plt>
movslq -0x8(%rbp),%rcx
lea    0x2ecc(%rip),%rax
mov    (%rax,%rcx,8),%rsi
movslq -0x8(%rbp),%rcx
lea    0x2eed(%rip),%rax
mov    (%rax,%rcx,8),%rdx
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x8(%rbp),%rcx
lea    0x2f00(%rip),%rax
mov    (%rax,%rcx,8),%rsi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0x2f1d(%rip),%rdi
lea    0x2f46(%rip),%rsi
call   1040 <psdes@plt>
mov    0x2f0a(%rip),%rsi
mov    0x2f33(%rip),%rdx
lea    0xf0c(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf22(%rip),%rbx
lea    0xe9c(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x2edb(%rip),%rdi
lea    0x2f04(%rip),%rsi
call   1040 <psdes@plt>
mov    0x2ec8(%rip),%rsi
mov    0x2ef1(%rip),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe76(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x2ea7(%rip),%rdi
lea    0x2ed0(%rip),%rsi
call   1040 <psdes@plt>
mov    0x2e94(%rip),%rsi
mov    0x2ebd(%rip),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe50(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x2e73(%rip),%rdi
lea    0x2e9c(%rip),%rsi
call   1040 <psdes@plt>
mov    0x2e60(%rip),%rsi
mov    0x2e89(%rip),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe2a(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@main.lword = internal global [5 x i64] [i64 0, i64 1, i64 1, i64 99, i64 99]
@main.irword = internal global [5 x i64] [i64 0, i64 1, i64 99, i64 1, i64 99]
@main.ans = internal global [5 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i32 0, i32 0)]
@.str = [1 x i8] zeroinitializer
@.str.1 = [22 x i8] c"0x604d1dce 0x509c0c23\00"
@.str.2 = [22 x i8] c"0xd97f8571 0xa66cb41a\00"
@.str.3 = [22 x i8] c"0x7822309d 0x64300984\00"
@.str.4 = [22 x i8] c"0xd7f376f0 0x59ba89eb\00"
@.str.5 = [39 x i8] c"PSDES now calculates: 0x%x 0x%x\0A\00"
@.str.6 = [32 x i8] c"Known correct answers are: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %3
3: ; preds = %28, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 4
br i1 %5, label %6, label %31
6: ; preds = %3
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [5 x i64], [5 x i64]* @main.lword, i64 0, i64 %8
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [5 x i64], [5 x i64]* @main.irword, i64 0, i64 %11
%13 = call i32 @psdes(i64* %9, i64* %12)
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [5 x i64], [5 x i64]* @main.lword, i64 0, i64 %15
%17 = load i64, i64* %16
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [5 x i64], [5 x i64]* @main.irword, i64 0, i64 %19
%21 = load i64, i64* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i64 %17, i64 %21)
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [5 x i8*], [5 x i8*]* @main.ans, i64 0, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %6
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %3
31: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@main.lword = internal global [5 x i64] [i64 0, i64 1, i64 1, i64 99, i64 99]
@main.irword = internal global [5 x i64] [i64 0, i64 1, i64 99, i64 1, i64 99]
@.str.1 = [22 x i8] c"0x604d1dce 0x509c0c23\00"
@.str.2 = [22 x i8] c"0xd97f8571 0xa66cb41a\00"
@.str.3 = [22 x i8] c"0x7822309d 0x64300984\00"
@.str.4 = [22 x i8] c"0xd7f376f0 0x59ba89eb\00"
@.str.5 = [39 x i8] c"PSDES now calculates: 0x%x 0x%x\0A\00"
@.str.6 = [32 x i8] c"Known correct answers are: %s\0A\00"
define i32 @main() {
%1 = tail call i32 @psdes(i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.lword, i64 0, i64 1), i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.irword, i64 0, i64 1))
%2 = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.lword, i64 0, i64 1)
%3 = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.irword, i64 0, i64 1)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i64 %2, i64 %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @psdes(i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.lword, i64 0, i64 2), i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.irword, i64 0, i64 2))
%7 = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.lword, i64 0, i64 2)
%8 = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.irword, i64 0, i64 2)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i64 %7, i64 %8)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @psdes(i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.lword, i64 0, i64 3), i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.irword, i64 0, i64 3))
%12 = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.lword, i64 0, i64 3)
%13 = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.irword, i64 0, i64 3)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i64 %12, i64 %13)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%16 = tail call i32 @psdes(i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.lword, i64 0, i64 4), i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.irword, i64 0, i64 4))
%17 = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.lword, i64 0, i64 4)
%18 = load i64, i64* getelementptr inbounds ([5 x i64], [5 x i64]* @main.irword, i64 0, i64 4)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i64 %17, i64 %18)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}