#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 */
char *gettext(char *);
int /*<<< orphan*/ printf(char *);
void chk_key_version(unsigned char vrsn) {
  if (vrsn == (unsigned char)0x04) {
    return;
  } else if ((vrsn == (unsigned char)0x03) || (vrsn == (unsigned char)0x02)) {
    printf("<hr size=\"1\" width=\"100%%\">\n");
    printf(gettext("<font color=\"red\">Warning</font>\n"));
    printf("<br></br>\n");
    printf(gettext(
        "<p>You have uploaded a PGP key which is of a version less than 4.\n"));
    printf(gettext("PGP keys before version 4 have a number of serious "
                   "weaknesses in them\n"));
    printf(gettext("which could allow your key, your digitial signatures, or "
                   "your encrypted\n"));
    printf(gettext("communications, to be more easily compromised.  CryptNET "
                   "recommends that\n"));
    printf(gettext(
        "you revoke all keys which are of a version less than 4.</p>\n"));
    printf("<hr size=\"1\" width=\"100%%\">\n");
  }
}


x86 assembly (clang, -O0):
<chk_key_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x4,%eax
jne    1140 <chk_key_version+0x20>
jmp    11fb <chk_key_version+0xdb>
movzbl -0x1(%rbp),%eax
cmp    $0x3,%eax
je     115a <chk_key_version+0x3a>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jne    11f6 <chk_key_version+0xd6>
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
lea    0xeec(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
lea    0xf1f(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
lea    0xf54(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
lea    0xf8a(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
lea    0xe0f(%rip),%rdi
call   1040 <printf@plt>
jmp    11fb <chk_key_version+0xdb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chk_key_version>:
cmp    $0x4,%dil
je     11e5 <chk_key_version+0xb5>
and    $0xfe,%dil
cmp    $0x2,%dil
jne    11e5 <chk_key_version+0xb5>
push   %rbx
lea    0xeb0(%rip),%rbx
mov    %rbx,%rdi
call   1050 <printf@plt>
lea    0xebe(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%rdi
call   1050 <printf@plt>
lea    0x1026(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%rdi
call   1050 <printf@plt>
lea    0xeef(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%rdi
call   1050 <printf@plt>
lea    0xf22(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%rdi
call   1050 <printf@plt>
lea    0xf57(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%rdi
call   1050 <printf@plt>
lea    0xf8d(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <printf@plt>
ret

LLVM IR (-O0):
@.str = [29 x i8] c"<hr size=\221\22 width=\22100%%\22>\0A\00"
@.str.1 = [34 x i8] c"<font color=\22red\22>Warning</font>\0A\00"
@.str.2 = [11 x i8] c"<br></br>\0A\00"
@.str.3 = [67 x i8] c"<p>You have uploaded a PGP key which is of a version less than 4.\0A\00"
@.str.4 = [71 x i8] c"PGP keys before version 4 have a number of serious weaknesses in them\0A\00"
@.str.5 = [73 x i8] c"which could allow your key, your digitial signatures, or your encrypted\0A\00"
@.str.6 = [74 x i8] c"communications, to be more easily compromised. CryptNET recommends that\0A\00"
@.str.7 = [61 x i8] c"you revoke all keys which are of a version less than 4.</p>\0A\00"
define void @chk_key_version(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp eq i32 %4, 4
br i1 %5, label %6, label %7
6: ; preds = %1
br label %32
7: ; preds = %1
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = icmp eq i32 %9, 3
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i8, i8* %2
%13 = zext i8 %12 to i32
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %31
15: ; preds = %11, %7
%16 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%17 = call i8* @gettext(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @printf(i8* %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%20 = call i8* @gettext(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @printf(i8* %20)
%22 = call i8* @gettext(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 @printf(i8* %22)
%24 = call i8* @gettext(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.5, i64 0, i64 0))
%25 = call i32 @printf(i8* %24)
%26 = call i8* @gettext(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.6, i64 0, i64 0))
%27 = call i32 @printf(i8* %26)
%28 = call i8* @gettext(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0))
%29 = call i32 @printf(i8* %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %15, %11
br label %32
32: ; preds = %6, %31
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"<hr size=\221\22 width=\22100%%\22>\0A\00"
@.str.1 = [34 x i8] c"<font color=\22red\22>Warning</font>\0A\00"
@.str.3 = [67 x i8] c"<p>You have uploaded a PGP key which is of a version less than 4.\0A\00"
@.str.4 = [71 x i8] c"PGP keys before version 4 have a number of serious weaknesses in them\0A\00"
@.str.5 = [73 x i8] c"which could allow your key, your digitial signatures, or your encrypted\0A\00"
@.str.6 = [74 x i8] c"communications, to be more easily compromised. CryptNET recommends that\0A\00"
@.str.7 = [61 x i8] c"you revoke all keys which are of a version less than 4.</p>\0A\00"
@str = [10 x i8] c"<br></br>\00"
define void @chk_key_version(i8 zeroext %0) {
%2 = icmp ne i8 %0, 4
%3 = and i8 %0, -2
%4 = icmp eq i8 %3, 2
%5 = and i1 %2, %4
br i1 %5, label %6, label %22
6: ; preds = %1
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%8 = tail call i8* @gettext(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @printf(i8* dereferenceable(1) %8)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%11 = tail call i8* @gettext(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i32 @printf(i8* dereferenceable(1) %11)
%13 = tail call i8* @gettext(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.4, i64 0, i64 0))
%14 = tail call i32 @printf(i8* dereferenceable(1) %13)
%15 = tail call i8* @gettext(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.5, i64 0, i64 0))
%16 = tail call i32 @printf(i8* dereferenceable(1) %15)
%17 = tail call i8* @gettext(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.6, i64 0, i64 0))
%18 = tail call i32 @printf(i8* dereferenceable(1) %17)
%19 = tail call i8* @gettext(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0))
%20 = tail call i32 @printf(i8* dereferenceable(1) %19)
%21 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %6, %1
ret void
}