#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*/ LC_CTYPE;
scalar_t__ isalnum(char);
int /*<<< orphan*/ printf(char *, int, ...);
scalar_t__ setlocale(int /*<<< orphan*/, char *);
int main() {
  unsigned char c = '\xdf';
  printf("isalnum('\\xdf') in default C locale returned %d\n", c, !!isalnum(c));
  if (setlocale(LC_CTYPE, "de_DE.iso88591"))
    printf("isalnum('\\xdf') in ISO-8859-1 locale returned %d\n", !!isalnum(c));
  if (setlocale(LC_CTYPE, "en_US.UTF-8"))
    printf("isalnum('\\xdf') in UTF-8 locale returned %d\n", !!isalnum(c));
  int var1 = 'd';
  int var2 = '2';
  int var3 = '\t';
  int var4 = ' ';
  if (isalnum(var1)) {
    printf("var1 = |%c| 是字母数字\n", var1);
  } else {
    printf("var1 = |%c| 不是字母数字\n", var1);
  }
  if (isalnum(var2)) {
    printf("var2 = |%c| 是字母数字\n", var2);
  } else {
    printf("var2 = |%c| 不是字母数字\n", var2);
  }
  if (isalnum(var3)) {
    printf("var3 = |%c| 是字母数字\n", var3);
  } else {
    printf("var3 = |%c| 不是字母数字\n", var3);
  }
  if (isalnum(var4)) {
    printf("var4 = |%c| 是字母数字\n", var4);
  } else {
    printf("var4 = |%c| 不是字母数字\n", var4);
  }
  int i;
  char str[] = "c3po...";
  i = 0;
  while (isalnum(str[i]))
    i++;
  printf("The first %d characters are alphanumeric.\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0xdf,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
mov    %eax,-0x28(%rbp)
movsbl -0x5(%rbp),%edi
call   1040 <isalnum@plt>
mov    -0x28(%rbp),%esi
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edx
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
lea    0xead(%rip),%rsi
call   1050 <setlocale@plt>
cmp    $0x0,%rax
je     11ba <main+0x8a>
movsbl -0x5(%rbp),%edi
call   1040 <isalnum@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
lea    0xea8(%rip),%rsi
call   1050 <setlocale@plt>
cmp    $0x0,%rax
je     1200 <main+0xd0>
movsbl -0x5(%rbp),%edi
call   1040 <isalnum@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x64,-0xc(%rbp)
movl   $0x32,-0x10(%rbp)
movl   $0x9,-0x14(%rbp)
movl   $0x20,-0x18(%rbp)
mov    -0xc(%rbp),%eax
movsbl %al,%edi
call   1040 <isalnum@plt>
cmp    $0x0,%rax
je     1247 <main+0x117>
mov    -0xc(%rbp),%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1258 <main+0x128>
mov    -0xc(%rbp),%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
movsbl %al,%edi
call   1040 <isalnum@plt>
cmp    $0x0,%rax
je     1283 <main+0x153>
mov    -0x10(%rbp),%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1294 <main+0x164>
mov    -0x10(%rbp),%esi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
movsbl %al,%edi
call   1040 <isalnum@plt>
cmp    $0x0,%rax
je     12bf <main+0x18f>
mov    -0x14(%rbp),%esi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d0 <main+0x1a0>
mov    -0x14(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
movsbl %al,%edi
call   1040 <isalnum@plt>
cmp    $0x0,%rax
je     12fb <main+0x1cb>
mov    -0x18(%rbp),%esi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130c <main+0x1dc>
mov    -0x18(%rbp),%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xe8c(%rip),%rax
mov    %rax,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
movsbl -0x24(%rbp,%rax,1),%edi
call   1040 <isalnum@plt>
cmp    $0x0,%rax
je     1344 <main+0x214>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    131e <main+0x1ee>
mov    -0x1c(%rbp),%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xffffffdf,%edi
call   1040 <isalnum@plt>
xor    %edx,%edx
test   %rax,%rax
setne  %dl
lea    0xeb3(%rip),%rdi
mov    $0xdf,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e88(%rip),%rbx
mov    (%rbx),%edi
lea    0xec8(%rip),%rsi
call   1050 <setlocale@plt>
test   %rax,%rax
je     1194 <main+0x64>
mov    $0xffffffdf,%edi
call   1040 <isalnum@plt>
xor    %esi,%esi
test   %rax,%rax
setne  %sil
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%edi
lea    0xed5(%rip),%rsi
call   1050 <setlocale@plt>
test   %rax,%rax
je     11c8 <main+0x98>
mov    $0xffffffdf,%edi
call   1040 <isalnum@plt>
xor    %esi,%esi
test   %rax,%rax
setne  %sil
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x64,%edi
call   1040 <isalnum@plt>
test   %rax,%rax
lea    0xeec(%rip),%rax
lea    0xec8(%rip),%rdi
cmove  %rax,%rdi
xor    %ebx,%ebx
mov    $0x64,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x32,%edi
call   1040 <isalnum@plt>
test   %rax,%rax
lea    0xefc(%rip),%rax
lea    0xed8(%rip),%rdi
cmove  %rax,%rdi
mov    $0x32,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x9,%edi
call   1040 <isalnum@plt>
test   %rax,%rax
lea    0xf0e(%rip),%rax
lea    0xeea(%rip),%rdi
cmove  %rax,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x20,%edi
call   1040 <isalnum@plt>
test   %rax,%rax
lea    0xf20(%rip),%rax
lea    0xefc(%rip),%rdi
cmove  %rax,%rdi
mov    $0x20,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf22(%rip),%r14
nopl   (%rax)
movsbl (%rbx,%r14,1),%edi
call   1040 <isalnum@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1280 <main+0x150>
add    $0xffffffff,%ebx
lea    0xf0a(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [49 x i8] c"isalnum('\\xdf') in default C locale returned %d\0A\00"
@LC_CTYPE = global i32 0
@.str.1 = [15 x i8] c"de_DE.iso88591\00"
@.str.2 = [50 x i8] c"isalnum('\\xdf') in ISO-8859-1 locale returned %d\0A\00"
@.str.3 = [12 x i8] c"en_US.UTF-8\00"
@.str.4 = [45 x i8] c"isalnum('\\xdf') in UTF-8 locale returned %d\0A\00"
@.str.5 = [29 x i8] c"var1 = |%c| \E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.6 = [32 x i8] c"var1 = |%c| \E4\B8\8D\E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.7 = [29 x i8] c"var2 = |%c| \E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.8 = [32 x i8] c"var2 = |%c| \E4\B8\8D\E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.9 = [29 x i8] c"var3 = |%c| \E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.10 = [32 x i8] c"var3 = |%c| \E4\B8\8D\E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.11 = [29 x i8] c"var4 = |%c| \E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.12 = [32 x i8] c"var4 = |%c| \E4\B8\8D\E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@__const.main.str = [8 x i8] c"c3po...\00"
@.str.13 = [43 x i8] c"The first %d characters are alphanumeric.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [8 x i8]
store i32 0, i32* %1
store i8 -33, i8* %2
%9 = load i8, i8* %2
%10 = zext i8 %9 to i32
%11 = load i8, i8* %2
%12 = call i64 @isalnum(i8 signext %11)
%13 = icmp ne i64 %12, 0
%14 = xor i1 %13, true
%15 = xor i1 %14, true
%16 = zext i1 %15 to i32
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %16)
%18 = load i32, i32* @LC_CTYPE
%19 = call i64 @setlocale(i32 %18, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %0
%22 = load i8, i8* %2
%23 = call i64 @isalnum(i8 signext %22)
%24 = icmp ne i64 %23, 0
%25 = xor i1 %24, true
%26 = xor i1 %25, true
%27 = zext i1 %26 to i32
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %21, %0
%30 = load i32, i32* @LC_CTYPE
%31 = call i64 @setlocale(i32 %30, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %41
33: ; preds = %29
%34 = load i8, i8* %2
%35 = call i64 @isalnum(i8 signext %34)
%36 = icmp ne i64 %35, 0
%37 = xor i1 %36, true
%38 = xor i1 %37, true
%39 = zext i1 %38 to i32
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %33, %29
store i32 100, i32* %3
store i32 50, i32* %4
store i32 9, i32* %5
store i32 32, i32* %6
%42 = load i32, i32* %3
%43 = trunc i32 %42 to i8
%44 = call i64 @isalnum(i8 signext %43)
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %41
%47 = load i32, i32* %3
%48 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %47)
br label %52
49: ; preds = %41
%50 = load i32, i32* %3
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %49, %46
%53 = load i32, i32* %4
%54 = trunc i32 %53 to i8
%55 = call i64 @isalnum(i8 signext %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %52
%58 = load i32, i32* %4
%59 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i32 %58)
br label %63
60: ; preds = %52
%61 = load i32, i32* %4
%62 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %60, %57
%64 = load i32, i32* %5
%65 = trunc i32 %64 to i8
%66 = call i64 @isalnum(i8 signext %65)
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %63
%69 = load i32, i32* %5
%70 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i32 %69)
br label %74
71: ; preds = %63
%72 = load i32, i32* %5
%73 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0), i32 %72)
br label %74
74: ; preds = %71, %68
%75 = load i32, i32* %6
%76 = trunc i32 %75 to i8
%77 = call i64 @isalnum(i8 signext %76)
%78 = icmp ne i64 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %74
%80 = load i32, i32* %6
%81 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i32 %80)
br label %85
82: ; preds = %74
%83 = load i32, i32* %6
%84 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), i32 %83)
br label %85
85: ; preds = %82, %79
%86 = bitcast [8 x i8]* %8 to i8*
store i32 0, i32* %7
br label %87
87: ; preds = %94, %85
%88 = load i32, i32* %7
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 %89
%91 = load i8, i8* %90
%92 = call i64 @isalnum(i8 signext %91)
%93 = icmp ne i64 %92, 0
br i1 %93, label %94, label %97
94: ; preds = %87
%95 = load i32, i32* %7
%96 = add nsw i32 %95, 1
store i32 %96, i32* %7
br label %87
97: ; preds = %87
%98 = load i32, i32* %7
%99 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.13, i64 0, i64 0), i32 %98)
ret i32 0
}

LLVM IR (-O2):
@.str = [49 x i8] c"isalnum('\\xdf') in default C locale returned %d\0A\00"
@LC_CTYPE = global i32 0
@.str.1 = [15 x i8] c"de_DE.iso88591\00"
@.str.2 = [50 x i8] c"isalnum('\\xdf') in ISO-8859-1 locale returned %d\0A\00"
@.str.3 = [12 x i8] c"en_US.UTF-8\00"
@.str.4 = [45 x i8] c"isalnum('\\xdf') in UTF-8 locale returned %d\0A\00"
@.str.5 = [29 x i8] c"var1 = |%c| \E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.6 = [32 x i8] c"var1 = |%c| \E4\B8\8D\E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.7 = [29 x i8] c"var2 = |%c| \E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.8 = [32 x i8] c"var2 = |%c| \E4\B8\8D\E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.9 = [29 x i8] c"var3 = |%c| \E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.10 = [32 x i8] c"var3 = |%c| \E4\B8\8D\E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.11 = [29 x i8] c"var4 = |%c| \E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@.str.12 = [32 x i8] c"var4 = |%c| \E4\B8\8D\E6\98\AF\E5\AD\97\E6\AF\8D\E6\95\B0\E5\AD\97\0A\00"
@__const.main.str = [8 x i8] c"c3po...\00"
@.str.13 = [43 x i8] c"The first %d characters are alphanumeric.\0A\00"
define i32 @main() {
%1 = tail call i64 @isalnum(i8 signext -33)
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 223, i32 %3)
%5 = load i32, i32* @LC_CTYPE
%6 = tail call i64 @setlocale(i32 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %0
%9 = tail call i64 @isalnum(i8 signext -33)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %8, %0
%14 = load i32, i32* @LC_CTYPE
%15 = tail call i64 @setlocale(i32 %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %22, label %17
17: ; preds = %13
%18 = tail call i64 @isalnum(i8 signext -33)
%19 = icmp ne i64 %18, 0
%20 = zext i1 %19 to i32
%21 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %17, %13
%23 = tail call i64 @isalnum(i8 signext 100)
%24 = icmp eq i64 %23, 0
%25 = select i1 %24, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0)
%26 = tail call i32 (i8*, i32, ...) @printf(i8* %25, i32 100)
%27 = tail call i64 @isalnum(i8 signext 50)
%28 = icmp eq i64 %27, 0
%29 = select i1 %28, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0)
%30 = tail call i32 (i8*, i32, ...) @printf(i8* %29, i32 50)
%31 = tail call i64 @isalnum(i8 signext 9)
%32 = icmp eq i64 %31, 0
%33 = select i1 %32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0)
%34 = tail call i32 (i8*, i32, ...) @printf(i8* %33, i32 9)
%35 = tail call i64 @isalnum(i8 signext 32)
%36 = icmp eq i64 %35, 0
%37 = select i1 %36, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0)
%38 = tail call i32 (i8*, i32, ...) @printf(i8* %37, i32 32)
br label %39
39: ; preds = %39, %22
%40 = phi i64 [ %45, %39 ], [ 0, %22 ]
%41 = getelementptr inbounds [8 x i8], [8 x i8]* @__const.main.str, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = tail call i64 @isalnum(i8 signext %42)
%44 = icmp eq i64 %43, 0
%45 = add nuw i64 %40, 1
br i1 %44, label %46, label %39
46: ; preds = %39
%47 = trunc i64 %40 to i32
%48 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.13, i64 0, i64 0), i32 %47)
ret i32 0
}