#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 Getc();
int /*<<< orphan*/ pdump(int);
int /*<<< orphan*/ printf(char *, ...);
extern void reason_for_revocation(int len) {
  int c = Getc();
  printf("\t\tReason - ");
  switch (c) {
  case 0:
    printf("No reason specified");
    break;
  case 1:
    printf("Key is superceded");
    break;
  case 2:
    printf("Key material has been compromised");
    break;
  case 3:
    printf("Key is retired and no longer used");
    break;
  case 32:
    printf("User ID information is no longer valid");
    break;
  default:
    printf("Unknown reason(%2d)", c);
    break;
  }
  printf("\n");
  printf("\t\tComment - ");
  pdump(len - 1);
  printf("\n");
}


x86 assembly (clang, -O0):
<reason_for_revocation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    %al,-0x11(%rbp)
call   1040 <Getc@plt>
mov    %eax,%ecx
mov    -0x11(%rbp),%al
mov    %ecx,-0x8(%rbp)
lea    0xf30(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x20,%rax
ja     11dd <reason_for_revocation+0xad>
mov    -0x10(%rbp),%rax
lea    0xe8b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ee <reason_for_revocation+0xbe>
lea    0xf0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ee <reason_for_revocation+0xbe>
lea    0xf0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ee <reason_for_revocation+0xbe>
lea    0xf1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ee <reason_for_revocation+0xbe>
lea    0xf29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ee <reason_for_revocation+0xbe>
mov    -0x8(%rbp),%esi
lea    0xf3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1050 <pdump@plt>
lea    0xf19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reason_for_revocation>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <Getc@plt>
mov    %eax,%ebp
lea    0xf2f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x20,%ebp
ja     1197 <reason_for_revocation+0x57>
mov    %ebp,%eax
lea    0xe96(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf16(%rip),%rdi
jmp    11b0 <reason_for_revocation+0x70>
lea    0xf21(%rip),%rdi
jmp    11b0 <reason_for_revocation+0x70>
lea    0xf2a(%rip),%rdi
jmp    11b0 <reason_for_revocation+0x70>
lea    0xf43(%rip),%rdi
jmp    11b0 <reason_for_revocation+0x70>
lea    0xf83(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11b7 <reason_for_revocation+0x77>
lea    0xf4a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf6d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebx
mov    %ebx,%edi
call   1060 <pdump@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"\09\09Reason - \00"
@.str.1 = [20 x i8] c"No reason specified\00"
@.str.2 = [18 x i8] c"Key is superceded\00"
@.str.3 = [34 x i8] c"Key material has been compromised\00"
@.str.4 = [34 x i8] c"Key is retired and no longer used\00"
@.str.5 = [39 x i8] c"User ID information is no longer valid\00"
@.str.6 = [20 x i8] c"Unknown reason(%2d)\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [13 x i8] c"\09\09Comment - \00"
define void @reason_for_revocation(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @Getc()
store i32 %4, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* %3
switch i32 %6, label %17 [
i32 0, label %7
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 32, label %15
]
7: ; preds = %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %20
9: ; preds = %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %20
11: ; preds = %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %20
13: ; preds = %1
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
br label %20
15: ; preds = %1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
br label %20
17: ; preds = %1
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %17, %15, %13, %11, %9, %7
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%23 = load i32, i32* %2
%24 = sub nsw i32 %23, 1
%25 = call i32 @pdump(i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"\09\09Reason - \00"
@.str.1 = [20 x i8] c"No reason specified\00"
@.str.2 = [18 x i8] c"Key is superceded\00"
@.str.3 = [34 x i8] c"Key material has been compromised\00"
@.str.4 = [34 x i8] c"Key is retired and no longer used\00"
@.str.5 = [39 x i8] c"User ID information is no longer valid\00"
@.str.6 = [20 x i8] c"Unknown reason(%2d)\00"
@.str.8 = [13 x i8] c"\09\09Comment - \00"
define void @reason_for_revocation(i32 %0) {
%2 = tail call i32 (...) @Getc()
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
switch i32 %2, label %14 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 32, label %12
]
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %16
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %16
8: ; preds = %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %16
10: ; preds = %1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
br label %16
12: ; preds = %1
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
br label %16
14: ; preds = %1
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %2)
br label %16
16: ; preds = %14, %12, %10, %8, %6, %4
%17 = tail call i32 @putchar(i32 10)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%19 = add nsw i32 %0, -1
%20 = tail call i32 @pdump(i32 %19)
%21 = tail call i32 @putchar(i32 10)
ret void
}