#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*/ look_up_glyph_name_in_the_agl(char const *, unsigned int *,
                                                 unsigned int *);
unsigned int *malloc(int);
unsigned int *match_agl(const char *name) {
  unsigned int *unicode_string;
  unsigned int unicode1;
  unsigned int unicode2;
  unicode_string = NULL;
  look_up_glyph_name_in_the_agl(name, &unicode1, &unicode2);
  if (unicode2 != 0) {
    unicode_string = malloc(3 * sizeof(*unicode_string));
    unicode_string[0] = 2;
    unicode_string[1] = unicode1;
    unicode_string[2] = unicode2;
  } else if (unicode1 != 0) {
    unicode_string = malloc(2 * sizeof(*unicode_string));
    unicode_string[0] = 1;
    unicode_string[1] = unicode1;
  }
  return unicode_string;
}


x86 assembly (clang, -O0):
<match_agl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <look_up_glyph_name_in_the_agl@plt>
cmpl   $0x0,-0x18(%rbp)
je     1180 <match_agl+0x60>
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
jmp    11b1 <match_agl+0x91>
cmpl   $0x0,-0x14(%rbp)
je     11ac <match_agl+0x8c>
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
jmp    11b1 <match_agl+0x91>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_agl>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1030 <look_up_glyph_name_in_the_agl@plt>
mov    0xc(%rsp),%ebx
test   %ebx,%ebx
je     1158 <match_agl+0x38>
mov    $0xc,%edi
call   1040 <malloc@plt>
movl   $0x2,(%rax)
mov    0x8(%rsp),%ecx
mov    %ecx,0x4(%rax)
mov    %ebx,0x8(%rax)
jmp    1177 <match_agl+0x57>
mov    0x8(%rsp),%ebx
test   %ebx,%ebx
je     1175 <match_agl+0x55>
mov    $0x8,%edi
call   1040 <malloc@plt>
movl   $0x1,(%rax)
mov    %ebx,0x4(%rax)
jmp    1177 <match_agl+0x57>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32* @match_agl(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32* null, i32** %3
%6 = load i8*, i8** %2
%7 = call i32 @look_up_glyph_name_in_the_agl(i8* %6, i32* %4, i32* %5)
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %1
%11 = call i32* @malloc(i32 12)
store i32* %11, i32** %3
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 0
store i32 2, i32* %13
%14 = load i32, i32* %4
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 1
store i32 %14, i32* %16
%17 = load i32, i32* %5
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 2
store i32 %17, i32* %19
br label %31
20: ; preds = %1
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %30
23: ; preds = %20
%24 = call i32* @malloc(i32 8)
store i32* %24, i32** %3
%25 = load i32*, i32** %3
%26 = getelementptr inbounds i32, i32* %25, i64 0
store i32 1, i32* %26
%27 = load i32, i32* %4
%28 = load i32*, i32** %3
%29 = getelementptr inbounds i32, i32* %28, i64 1
store i32 %27, i32* %29
br label %30
30: ; preds = %23, %20
br label %31
31: ; preds = %30, %10
%32 = load i32*, i32** %3
ret i32* %32
}

LLVM IR (-O2):
define noalias i32* @match_agl(i8* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = call i32 @look_up_glyph_name_in_the_agl(i8* %0, i32* %2, i32* %3)
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %1
%10 = call i32* @malloc(i32 12)
store i32 2, i32* %10
%11 = load i32, i32* %2
%12 = getelementptr inbounds i32, i32* %10, i64 1
store i32 %11, i32* %12
%13 = getelementptr inbounds i32, i32* %10, i64 2
store i32 %7, i32* %13
br label %20
14: ; preds = %1
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = call i32* @malloc(i32 8)
store i32 1, i32* %18
%19 = getelementptr inbounds i32, i32* %18, i64 1
store i32 %15, i32* %19
br label %20
20: ; preds = %14, %17, %9
%21 = phi i32* [ %10, %9 ], [ %18, %17 ], [ null, %14 ]
ret i32* %21
}