#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 */
typedef int uint32_t;

/* Variables and functions */
int iso_8859_read_from_code_page(uint32_t *code_page, char *string,
                                 uint32_t *code_point) {
  if ((string[0] & 0x80) == 0) {
    code_point[0] = (uint32_t)string[0];
    return 1;
  } else if (((unsigned char)string[0]) >= 0xA0) {
    code_point[0] = code_page[(((unsigned char)string[0]) & 0xFF) - 0xA0];
    if (code_point[0] == 0x0)
      return 0;
    else
      return 1;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<iso_8859_read_from_code_page>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    113e <iso_8859_read_from_code_page+0x3e>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    119f <iso_8859_read_from_code_page+0x9f>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xa0,%eax
jl     1198 <iso_8859_read_from_code_page+0x98>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movzbl (%rcx),%ecx
and    $0xff,%ecx
sub    $0xa0,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jne    118c <iso_8859_read_from_code_page+0x8c>
movl   $0x0,-0x4(%rbp)
jmp    119f <iso_8859_read_from_code_page+0x9f>
movl   $0x1,-0x4(%rbp)
jmp    119f <iso_8859_read_from_code_page+0x9f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iso_8859_read_from_code_page>:
movsbl (%rsi),%ecx
test   $0x80,%cl
jne    1110 <iso_8859_read_from_code_page+0x10>
mov    %ecx,(%rdx)
mov    $0x1,%eax
ret
xor    %eax,%eax
cmp    $0xa0,%cl
jb     112a <iso_8859_read_from_code_page+0x2a>
movzbl %cl,%eax
mov    -0x280(%rdi,%rax,4),%ecx
mov    %ecx,(%rdx)
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
ret

LLVM IR (-O0):
define i32 @iso_8859_read_from_code_page(i32* %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32*
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
%8 = load i8*, i8** %6
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = and i32 %11, 128
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %3
%15 = load i8*, i8** %6
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = load i32*, i32** %7
%20 = getelementptr inbounds i32, i32* %19, i64 0
store i32 %18, i32* %20
store i32 1, i32* %4
br label %47
21: ; preds = %3
%22 = load i8*, i8** %6
%23 = getelementptr inbounds i8, i8* %22, i64 0
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = icmp sge i32 %25, 160
br i1 %26, label %27, label %46
27: ; preds = %21
%28 = load i32*, i32** %5
%29 = load i8*, i8** %6
%30 = getelementptr inbounds i8, i8* %29, i64 0
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = and i32 %32, 255
%34 = sub nsw i32 %33, 160
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %28, i64 %35
%37 = load i32, i32* %36
%38 = load i32*, i32** %7
%39 = getelementptr inbounds i32, i32* %38, i64 0
store i32 %37, i32* %39
%40 = load i32*, i32** %7
%41 = getelementptr inbounds i32, i32* %40, i64 0
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %27
store i32 0, i32* %4
br label %47
45: ; preds = %27
store i32 1, i32* %4
br label %47
46: ; preds = %21
store i32 0, i32* %4
br label %47
47: ; preds = %46, %45, %44, %14
%48 = load i32, i32* %4
ret i32 %48
}

LLVM IR (-O2):
define i32 @iso_8859_read_from_code_page(i32* nocapture %0, i8* nocapture %1, i32* nocapture writeonly %2) {
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = and i32 %5, 128
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %3
store i32 %5, i32* %2
br label %18
9: ; preds = %3
%10 = icmp ugt i8 %4, -97
br i1 %10, label %11, label %18
11: ; preds = %9
%12 = zext i8 %4 to i64
%13 = add nsw i64 %12, -160
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %14
store i32 %15, i32* %2
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %9, %11, %8
%19 = phi i32 [ 1, %8 ], [ %17, %11 ], [ 0, %9 ]
ret i32 %19
}