#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 */
struct utsname {
  char *release;
};

/* Variables and functions */
int atoi(char *);
scalar_t__ isdigit(char);
scalar_t__ strncmp(char *, char *, int);
scalar_t__ uname(struct utsname *);
char *_error_hint(char *cipherName, char *cipherMode, size_t keyLength) {
  char *hint = "";
  char c, tmp[4] = {0};
  struct utsname uts;
  int i = 0, kernel_minor;
  if (uname(&uts) || strncmp(uts.release, "2.6.", 4))
    return hint;
  while (i < 3 && (c = uts.release[i + 4]))
    tmp[i++] = isdigit(c) ? c : '\0';
  kernel_minor = atoi(tmp);
  if (!strncmp(cipherMode, "xts", 3) && (keyLength != 256 && keyLength != 512))
    hint = ("Key size in XTS mode must be 256 or 512 bits.\n");
  else if (!strncmp(cipherMode, "xts", 3) && kernel_minor < 24)
    hint = ("Block mode XTS is available since kernel 2.6.24.\n");
  if (!strncmp(cipherMode, "lrw", 3) && (keyLength != 256 && keyLength != 512))
    hint = ("Key size in LRW mode must be 256 or 512 bits.\n");
  else if (!strncmp(cipherMode, "lrw", 3) && kernel_minor < 20)
    hint = ("Block mode LRW is available since kernel 2.6.20.\n");
  return hint;
}


x86 assembly (clang, -O0):
<_error_hint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    0xf63(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x2d(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
movl   $0x0,-0x3c(%rbp)
lea    -0x38(%rbp),%rdi
call   1050 <uname@plt>
cmp    $0x0,%rax
jne    11b8 <_error_hint+0x68>
mov    -0x38(%rbp),%rdi
lea    0xe5c(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11c5 <_error_hint+0x75>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1368 <_error_hint+0x218>
jmp    11ca <_error_hint+0x7a>
xor    %eax,%eax
cmpl   $0x3,-0x3c(%rbp)
mov    %al,-0x41(%rbp)
jge    11f8 <_error_hint+0xa8>
mov    -0x38(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x29(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    1208 <_error_hint+0xb8>
jmp    124c <_error_hint+0xfc>
movsbl -0x29(%rbp),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     1227 <_error_hint+0xd7>
movsbl -0x29(%rbp),%eax
mov    %eax,-0x48(%rbp)
jmp    1231 <_error_hint+0xe1>
xor    %eax,%eax
mov    %eax,-0x48(%rbp)
jmp    1231 <_error_hint+0xe1>
mov    -0x48(%rbp),%eax
mov    %al,%cl
mov    -0x3c(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x3c(%rbp)
cltq
mov    %cl,-0x2d(%rbp,%rax,1)
jmp    11ca <_error_hint+0x7a>
lea    -0x2d(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xda2(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    12a3 <_error_hint+0x153>
cmpq   $0x100,-0x20(%rbp)
je     12a3 <_error_hint+0x153>
cmpq   $0x200,-0x20(%rbp)
je     12a3 <_error_hint+0x153>
lea    0xd6f(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    12dc <_error_hint+0x18c>
mov    -0x18(%rbp),%rdi
lea    0xd57(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    12d7 <_error_hint+0x187>
cmpl   $0x18,-0x40(%rbp)
jge    12d7 <_error_hint+0x187>
lea    0xd65(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    12dc <_error_hint+0x18c>
mov    -0x18(%rbp),%rdi
lea    0xd83(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1327 <_error_hint+0x1d7>
cmpq   $0x100,-0x20(%rbp)
je     1327 <_error_hint+0x1d7>
cmpq   $0x200,-0x20(%rbp)
je     1327 <_error_hint+0x1d7>
lea    0xd50(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1360 <_error_hint+0x210>
mov    -0x18(%rbp),%rdi
lea    0xd38(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    135b <_error_hint+0x20b>
cmpl   $0x14,-0x40(%rbp)
jge    135b <_error_hint+0x20b>
lea    0xd46(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1360 <_error_hint+0x210>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_error_hint>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
movl   $0x0,0x4(%rsp)
lea    0x8(%rsp),%rdi
call   1050 <uname@plt>
lea    0xf63(%rip),%rbx
test   %rax,%rax
jne    128c <_error_hint+0x14c>
mov    0x8(%rsp),%rbp
lea    0xe80(%rip),%rsi
mov    %rbp,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    128c <_error_hint+0x14c>
mov    0x4(%rbp),%bl
test   %bl,%bl
je     11f1 <_error_hint+0xb1>
movsbl %bl,%edi
call   1040 <isdigit@plt>
xor    %r12d,%r12d
test   %rax,%rax
movzbl %bl,%eax
cmove  %r12d,%eax
mov    %al,0x4(%rsp)
mov    0x5(%rbp),%bl
test   %bl,%bl
je     11f1 <_error_hint+0xb1>
movsbl %bl,%edi
call   1040 <isdigit@plt>
test   %rax,%rax
movzbl %bl,%eax
cmove  %r12d,%eax
mov    %al,0x5(%rsp)
mov    0x6(%rbp),%bl
test   %bl,%bl
je     11f1 <_error_hint+0xb1>
movsbl %bl,%edi
call   1040 <isdigit@plt>
xor    %ecx,%ecx
test   %rax,%rax
movzbl %bl,%eax
cmove  %ecx,%eax
mov    %al,0x6(%rsp)
lea    0x4(%rsp),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
lea    0xe01(%rip),%rsi
mov    %r15,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     129c <_error_hint+0x15c>
lea    0xde4(%rip),%rsi
mov    %r15,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x18,%ebx
lea    0xe00(%rip),%rbp
lea    0xe8f(%rip),%rcx
cmovge %rcx,%rbp
test   %rax,%rax
cmovne %rcx,%rbp
lea    0xe19(%rip),%rsi
mov    %r15,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     12bf <_error_hint+0x17f>
lea    0xe00(%rip),%rsi
mov    %r15,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x14,%ebx
lea    0xe1c(%rip),%rbx
cmovge %rbp,%rbx
test   %rax,%rax
cmovne %rbp,%rbx
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x200,%r14
je     121a <_error_hint+0xda>
cmp    $0x100,%r14
je     121a <_error_hint+0xda>
lea    0xd4c(%rip),%rbp
jmp    124a <_error_hint+0x10a>
cmp    $0x200,%r14
je     1263 <_error_hint+0x123>
cmp    $0x100,%r14
je     1263 <_error_hint+0x123>
lea    0xd96(%rip),%rbx
jmp    128c <_error_hint+0x14c>

LLVM IR (-O0):
%struct.utsname = type { i8* }
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"2.6.\00"
@.str.2 = [4 x i8] c"xts\00"
@.str.3 = [47 x i8] c"Key size in XTS mode must be 256 or 512 bits.\0A\00"
@.str.4 = [50 x i8] c"Block mode XTS is available since kernel 2.6.24.\0A\00"
@.str.5 = [4 x i8] c"lrw\00"
@.str.6 = [47 x i8] c"Key size in LRW mode must be 256 or 512 bits.\0A\00"
@.str.7 = [50 x i8] c"Block mode LRW is available since kernel 2.6.20.\0A\00"
define i8* @_error_hint(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8
%10 = alloca [4 x i8]
%11 = alloca %struct.utsname
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %8
%14 = bitcast [4 x i8]* %10 to i8*
store i32 0, i32* %12
%15 = call i64 @uname(%struct.utsname* %11)
%16 = icmp ne i64 %15, 0
br i1 %16, label %22, label %17
17: ; preds = %3
%18 = getelementptr inbounds %struct.utsname, %struct.utsname* %11, i32 0, i32 0
%19 = load i8*, i8** %18
%20 = call i64 @strncmp(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %17, %3
%23 = load i8*, i8** %8
store i8* %23, i8** %4
br label %99
24: ; preds = %17
br label %25
25: ; preds = %48, %24
%26 = load i32, i32* %12
%27 = icmp slt i32 %26, 3
br i1 %27, label %28, label %38
28: ; preds = %25
%29 = getelementptr inbounds %struct.utsname, %struct.utsname* %11, i32 0, i32 0
%30 = load i8*, i8** %29
%31 = load i32, i32* %12
%32 = add nsw i32 %31, 4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %30, i64 %33
%35 = load i8, i8* %34
store i8 %35, i8* %9
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 0
br label %38
38: ; preds = %28, %25
%39 = phi i1 [ false, %25 ], [ %37, %28 ]
br i1 %39, label %40, label %55
40: ; preds = %38
%41 = load i8, i8* %9
%42 = call i64 @isdigit(i8 signext %41)
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = load i8, i8* %9
%46 = sext i8 %45 to i32
br label %48
47: ; preds = %40
br label %48
48: ; preds = %47, %44
%49 = phi i32 [ %46, %44 ], [ 0, %47 ]
%50 = trunc i32 %49 to i8
%51 = load i32, i32* %12
%52 = add nsw i32 %51, 1
store i32 %52, i32* %12
%53 = sext i32 %51 to i64
%54 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 %53
store i8 %50, i8* %54
br label %25
55: ; preds = %38
%56 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%57 = call i32 @atoi(i8* %56)
store i32 %57, i32* %13
%58 = load i8*, i8** %6
%59 = call i64 @strncmp(i8* %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%60 = icmp ne i64 %59, 0
br i1 %60, label %68, label %61
61: ; preds = %55
%62 = load i64, i64* %7
%63 = icmp ne i64 %62, 256
br i1 %63, label %64, label %68
64: ; preds = %61
%65 = load i64, i64* %7
%66 = icmp ne i64 %65, 512
br i1 %66, label %67, label %68
67: ; preds = %64
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8** %8
br label %77
68: ; preds = %64, %61, %55
%69 = load i8*, i8** %6
%70 = call i64 @strncmp(i8* %69, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%71 = icmp ne i64 %70, 0
br i1 %71, label %76, label %72
72: ; preds = %68
%73 = load i32, i32* %13
%74 = icmp slt i32 %73, 24
br i1 %74, label %75, label %76
75: ; preds = %72
store i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0), i8** %8
br label %76
76: ; preds = %75, %72, %68
br label %77
77: ; preds = %76, %67
%78 = load i8*, i8** %6
%79 = call i64 @strncmp(i8* %78, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%80 = icmp ne i64 %79, 0
br i1 %80, label %88, label %81
81: ; preds = %77
%82 = load i64, i64* %7
%83 = icmp ne i64 %82, 256
br i1 %83, label %84, label %88
84: ; preds = %81
%85 = load i64, i64* %7
%86 = icmp ne i64 %85, 512
br i1 %86, label %87, label %88
87: ; preds = %84
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i8** %8
br label %97
88: ; preds = %84, %81, %77
%89 = load i8*, i8** %6
%90 = call i64 @strncmp(i8* %89, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%91 = icmp ne i64 %90, 0
br i1 %91, label %96, label %92
92: ; preds = %88
%93 = load i32, i32* %13
%94 = icmp slt i32 %93, 20
br i1 %94, label %95, label %96
95: ; preds = %92
store i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0), i8** %8
br label %96
96: ; preds = %95, %92, %88
br label %97
97: ; preds = %96, %87
%98 = load i8*, i8** %8
store i8* %98, i8** %4
br label %99
99: ; preds = %97, %22
%100 = load i8*, i8** %4
ret i8* %100
}

LLVM IR (-O2):
%struct.utsname = type { i8* }
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"2.6.\00"
@.str.2 = [4 x i8] c"xts\00"
@.str.3 = [47 x i8] c"Key size in XTS mode must be 256 or 512 bits.\0A\00"
@.str.4 = [50 x i8] c"Block mode XTS is available since kernel 2.6.24.\0A\00"
@.str.5 = [4 x i8] c"lrw\00"
@.str.6 = [47 x i8] c"Key size in LRW mode must be 256 or 512 bits.\0A\00"
@.str.7 = [50 x i8] c"Block mode LRW is available since kernel 2.6.20.\0A\00"
define i8* @_error_hint(i8* nocapture readnone %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to [4 x i8]*
%6 = alloca %struct.utsname
%7 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%8 = bitcast %struct.utsname* %6 to i8*
%9 = call i64 @uname(%struct.utsname* %6)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %65
11: ; preds = %3
%12 = getelementptr inbounds %struct.utsname, %struct.utsname* %6, i64 0, i32 0
%13 = load i8*, i8** %12
%14 = tail call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %65
16: ; preds = %11
%17 = getelementptr inbounds i8, i8* %13, i64 4
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %41, label %20
20: ; preds = %16
%21 = tail call i64 @isdigit(i8 signext %18)
%22 = icmp eq i64 %21, 0
%23 = select i1 %22, i8 0, i8 %18
%24 = bitcast i32* %4 to i8*
store i8 %23, i8* %24
%25 = getelementptr inbounds i8, i8* %13, i64 5
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 0
br i1 %27, label %41, label %28
28: ; preds = %20
%29 = tail call i64 @isdigit(i8 signext %26)
%30 = icmp eq i64 %29, 0
%31 = select i1 %30, i8 0, i8 %26
%32 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 1
store i8 %31, i8* %32
%33 = getelementptr inbounds i8, i8* %13, i64 6
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 0
br i1 %35, label %41, label %36
36: ; preds = %28
%37 = tail call i64 @isdigit(i8 signext %34)
%38 = icmp eq i64 %37, 0
%39 = select i1 %38, i8 0, i8 %34
%40 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 2
store i8 %39, i8* %40
br label %41
41: ; preds = %36, %28, %20, %16
%42 = call i32 @atoi(i8* %7)
%43 = tail call i64 @strncmp(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%44 = freeze i64 %43
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %41
switch i64 %2, label %53 [
i64 512, label %47
i64 256, label %47
]
47: ; preds = %46, %46, %41
%48 = tail call i64 @strncmp(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%49 = icmp eq i64 %48, 0
%50 = icmp slt i32 %42, 24
%51 = select i1 %49, i1 %50, i1 false
%52 = select i1 %51, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
br label %53
53: ; preds = %47, %46
%54 = phi i8* [ getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), %46 ], [ %52, %47 ]
%55 = tail call i64 @strncmp(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%56 = freeze i64 %55
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %59
58: ; preds = %53
switch i64 %2, label %65 [
i64 512, label %59
i64 256, label %59
]
59: ; preds = %58, %58, %53
%60 = tail call i64 @strncmp(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%61 = icmp eq i64 %60, 0
%62 = icmp slt i32 %42, 20
%63 = select i1 %61, i1 %62, i1 false
%64 = select i1 %63, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0), i8* %54
br label %65
65: ; preds = %59, %58, %3, %11
%66 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %11 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), %58 ], [ %64, %59 ]
ret i8* %66
}