#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 /*<<< orphan*/ assert(int *);
int iso_8859_write_from_code_page(uint32_t *code_page, uint32_t code_point,
                                  char *string) {
  assert(code_page);
  if (code_point <= 0x7F) {
    string[0] = (char)code_point;
    return 1;
  } else {
    for (unsigned int k = 0; k < 0x60; k++) {
      if (code_page[k] == code_point) {
        string[0] = (char)(k + 0xA0);
        return 1;
      }
    }
    return 0;
  }
}


x86 assembly (clang, -O0):
<iso_8859_write_from_code_page>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
cmpl   $0x7f,-0x14(%rbp)
jg     114d <iso_8859_write_from_code_page+0x3d>
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11a7 <iso_8859_write_from_code_page+0x97>
movl   $0x0,-0x24(%rbp)
cmpl   $0x60,-0x24(%rbp)
jae    11a0 <iso_8859_write_from_code_page+0x90>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
jne    118d <iso_8859_write_from_code_page+0x7d>
mov    -0x24(%rbp),%eax
add    $0xa0,%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11a7 <iso_8859_write_from_code_page+0x97>
jmp    1192 <iso_8859_write_from_code_page+0x82>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1154 <iso_8859_write_from_code_page+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iso_8859_write_from_code_page>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <assert@plt>
cmp    $0x80,%ebp
jge    1133 <iso_8859_write_from_code_page+0x23>
mov    %bpl,(%r14)
mov    $0x1,%eax
jmp    11ad <iso_8859_write_from_code_page+0x9d>
cmp    %ebp,(%rbx)
jne    1140 <iso_8859_write_from_code_page+0x30>
mov    $0x1,%cl
mov    $0xa0,%dl
mov    %dl,(%r14)
jmp    11aa <iso_8859_write_from_code_page+0x9a>
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmp    %ebp,0x8(%rbx,%rax,4)
je     1182 <iso_8859_write_from_code_page+0x72>
cmp    %ebp,0xc(%rbx,%rax,4)
je     1188 <iso_8859_write_from_code_page+0x78>
cmp    %ebp,0x10(%rbx,%rax,4)
je     118e <iso_8859_write_from_code_page+0x7e>
cmp    $0x5b,%rax
je     119f <iso_8859_write_from_code_page+0x8f>
lea    0x4(%rax),%rdx
cmp    %ebp,0x14(%rbx,%rax,4)
mov    %rdx,%rax
jne    1150 <iso_8859_write_from_code_page+0x40>
cmp    $0x5f,%rdx
setb   %cl
add    $0x1,%rdx
jmp    1197 <iso_8859_write_from_code_page+0x87>
add    $0x2,%rax
jmp    1192 <iso_8859_write_from_code_page+0x82>
add    $0x3,%rax
jmp    1192 <iso_8859_write_from_code_page+0x82>
add    $0x4,%rax
mov    $0x1,%cl
mov    %rax,%rdx
add    $0xa0,%dl
mov    %dl,(%r14)
jmp    11aa <iso_8859_write_from_code_page+0x9a>
add    $0x4,%rax
cmp    $0x5f,%rax
setb   %cl
movzbl %cl,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @iso_8859_write_from_code_page(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%9 = load i32*, i32** %5
%10 = call i32 @assert(i32* %9)
%11 = load i32, i32* %6
%12 = icmp sle i32 %11, 127
br i1 %12, label %13, label %18
13: ; preds = %3
%14 = load i32, i32* %6
%15 = trunc i32 %14 to i8
%16 = load i8*, i8** %7
%17 = getelementptr inbounds i8, i8* %16, i64 0
store i8 %15, i8* %17
store i32 1, i32* %4
br label %41
18: ; preds = %3
store i32 0, i32* %8
br label %19
19: ; preds = %37, %18
%20 = load i32, i32* %8
%21 = icmp ult i32 %20, 96
br i1 %21, label %22, label %40
22: ; preds = %19
%23 = load i32*, i32** %5
%24 = load i32, i32* %8
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = load i32, i32* %6
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %36
30: ; preds = %22
%31 = load i32, i32* %8
%32 = add i32 %31, 160
%33 = trunc i32 %32 to i8
%34 = load i8*, i8** %7
%35 = getelementptr inbounds i8, i8* %34, i64 0
store i8 %33, i8* %35
store i32 1, i32* %4
br label %41
36: ; preds = %22
br label %37
37: ; preds = %36
%38 = load i32, i32* %8
%39 = add i32 %38, 1
store i32 %39, i32* %8
br label %19
40: ; preds = %19
store i32 0, i32* %4
br label %41
41: ; preds = %40, %30, %13
%42 = load i32, i32* %4
ret i32 %42
}

LLVM IR (-O2):
define i32 @iso_8859_write_from_code_page(i32* %0, i32 %1, i8* nocapture writeonly %2) {
%4 = tail call i32 @assert(i32* %0)
%5 = icmp slt i32 %1, 128
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = load i32, i32* %0
%8 = icmp eq i32 %7, %1
br i1 %8, label %35, label %38
9: ; preds = %3
%10 = trunc i32 %1 to i8
store i8 %10, i8* %2
br label %49
11: ; preds = %38
%12 = or i64 %39, 2
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, %1
br i1 %15, label %30, label %16
16: ; preds = %11
%17 = or i64 %39, 3
%18 = getelementptr inbounds i32, i32* %0, i64 %17
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, %1
br i1 %20, label %30, label %21
21: ; preds = %16
%22 = add nuw nsw i64 %39, 4
%23 = icmp eq i64 %22, 96
br i1 %23, label %44, label %24
24: ; preds = %21
%25 = getelementptr inbounds i32, i32* %0, i64 %22
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, %1
br i1 %27, label %28, label %38
28: ; preds = %24
%29 = icmp ult i64 %17, 95
br label %30
30: ; preds = %38, %11, %16, %28
%31 = phi i64 [ %22, %28 ], [ %17, %16 ], [ %12, %11 ], [ %40, %38 ]
%32 = phi i1 [ %29, %28 ], [ true, %16 ], [ true, %11 ], [ true, %38 ]
%33 = trunc i64 %31 to i8
%34 = add i8 %33, -96
br label %35
35: ; preds = %30, %6
%36 = phi i8 [ %34, %30 ], [ -96, %6 ]
%37 = phi i1 [ %32, %30 ], [ true, %6 ]
store i8 %36, i8* %2
br label %46
38: ; preds = %6, %24
%39 = phi i64 [ %22, %24 ], [ 0, %6 ]
%40 = or i64 %39, 1
%41 = getelementptr inbounds i32, i32* %0, i64 %40
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, %1
br i1 %43, label %30, label %11
44: ; preds = %21
%45 = icmp ult i64 %17, 95
br label %46
46: ; preds = %44, %35
%47 = phi i1 [ %37, %35 ], [ %45, %44 ]
%48 = zext i1 %47 to i32
br label %49
49: ; preds = %46, %9
%50 = phi i32 [ 1, %9 ], [ %48, %46 ]
ret i32 %50
}