#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__ isalpha(char);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int main(void) {
  unsigned char c = '\xdf';
  printf("isalpha('\\xdf') in default C locale returned %d\n", !!isalpha(c));
  setlocale(LC_CTYPE, "de_DE.iso88591");
  printf("isalpha('\\xdf') in ISO-8859-1 locale returned %d\n", !!isalpha(c));
  int i = 0;
  char str[] = "I Love My Country!!";
  while (str[i]) {
    if (isalpha(str[i]))
      printf("character %c is alphabetic\n", str[i]);
    else
      printf("character %c is not alphabetic\n", str[i]);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0xdf,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
lea    0xe9d(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
lea    0xeb6(%rip),%rsi
call   1050 <setlocale@plt>
movsbl -0x5(%rbp),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
lea    0xea0(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    0xefa(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xef7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xef5(%rip),%eax
mov    %eax,-0x10(%rbp)
movslq -0xc(%rbp),%rax
cmpb   $0x0,-0x20(%rbp,%rax,1)
je     1232 <main+0x102>
movslq -0xc(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
je     120f <main+0xdf>
movslq -0xc(%rbp),%rax
lea    0xe72(%rip),%rdi
movsbl -0x20(%rbp,%rax,1),%esi
call   1030 <printf@plt>
jmp    1224 <main+0xf4>
movslq -0xc(%rbp),%rax
lea    0xe74(%rip),%rdi
movsbl -0x20(%rbp,%rax,1),%esi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ce <main+0x9e>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0xffffffdf,%edi
call   1040 <isalpha@plt>
xor    %esi,%esi
test   %rax,%rax
setne  %sil
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
call   1050 <setlocale@plt>
mov    $0xffffffdf,%edi
call   1040 <isalpha@plt>
xor    %esi,%esi
test   %rax,%rax
setne  %sil
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %ebx,%ebx
lea    0xf1c(%rip),%r14
lea    0xef3(%rip),%r15
lea    0xed0(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rbx,%r14,1),%ebp
mov    %ebp,%edi
call   1040 <isalpha@plt>
test   %rax,%rax
mov    %r12,%rdi
cmove  %r15,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x13,%rbx
jne    11b0 <main+0x80>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"isalpha('\\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"isalpha('\\xdf') in ISO-8859-1 locale returned %d\0A\00"
@__const.main.str = [20 x i8] c"I Love My Country!!\00"
@.str.3 = [28 x i8] c"character %c is alphabetic\0A\00"
@.str.4 = [32 x i8] c"character %c is not alphabetic\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca [20 x i8]
store i32 0, i32* %1
store i8 -33, i8* %2
%5 = load i8, i8* %2
%6 = call i64 @isalpha(i8 signext %5)
%7 = icmp ne i64 %6, 0
%8 = xor i1 %7, true
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
%11 = trunc i32 %10 to i8
%12 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8 signext %11)
%13 = load i32, i32* @LC_CTYPE
%14 = call i32 @setlocale(i32 %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%15 = load i8, i8* %2
%16 = call i64 @isalpha(i8 signext %15)
%17 = icmp ne i64 %16, 0
%18 = xor i1 %17, true
%19 = xor i1 %18, true
%20 = zext i1 %19 to i32
%21 = trunc i32 %20 to i8
%22 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8 signext %21)
store i32 0, i32* %3
%23 = bitcast [20 x i8]* %4 to i8*
br label %24
24: ; preds = %49, %0
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = icmp ne i8 %28, 0
br i1 %29, label %30, label %52
30: ; preds = %24
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = call i64 @isalpha(i8 signext %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %43
37: ; preds = %30
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8 signext %41)
br label %49
43: ; preds = %30
%44 = load i32, i32* %3
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8 signext %47)
br label %49
49: ; preds = %43, %37
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %24
52: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
@.str = [49 x i8] c"isalpha('\\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"isalpha('\\xdf') in ISO-8859-1 locale returned %d\0A\00"
@__const.main.str = [20 x i8] c"I Love My Country!!\00"
@.str.3 = [28 x i8] c"character %c is alphabetic\0A\00"
@.str.4 = [32 x i8] c"character %c is not alphabetic\0A\00"
define i32 @main() {
%1 = tail call i64 @isalpha(i8 signext -33)
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i8
%4 = tail call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8 signext %3)
%5 = load i32, i32* @LC_CTYPE
%6 = tail call i32 @setlocale(i32 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i64 @isalpha(i8 signext -33)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8 signext %9)
br label %11
11: ; preds = %0, %11
%12 = phi i64 [ 0, %0 ], [ %19, %11 ]
%13 = getelementptr inbounds [20 x i8], [20 x i8]* @__const.main.str, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = tail call i64 @isalpha(i8 signext %14)
%16 = icmp eq i64 %15, 0
%17 = select i1 %16, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0)
%18 = tail call i32 @printf(i8* %17, i8 signext %14)
%19 = add nuw nsw i64 %12, 1
%20 = icmp eq i64 %19, 19
br i1 %20, label %21, label %11
21: ; preds = %11
ret i32 0
}