#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 */
struct assembler {
  int dummy;
};

/* Variables and functions */
scalar_t__ construct_tokens(struct assembler *);
scalar_t__ pass1(struct assembler *);
scalar_t__ pass2(struct assembler *);
int asm_parse(struct assembler *a) {
  if (construct_tokens(a) < 0) {
    return -1;
  }
  if (pass1(a) < 0) {
    return -1;
  }
  if (pass2(a) < 0) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<asm_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <construct_tokens@plt>
cmp    $0x0,%rax
jge    115b <asm_parse+0x2b>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a0 <asm_parse+0x70>
mov    -0x10(%rbp),%rdi
call   1050 <pass1@plt>
cmp    $0x0,%rax
jge    117a <asm_parse+0x4a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a0 <asm_parse+0x70>
mov    -0x10(%rbp),%rdi
call   1040 <pass2@plt>
cmp    $0x0,%rax
jge    1199 <asm_parse+0x69>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a0 <asm_parse+0x70>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asm_parse>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <construct_tokens@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
js     1162 <asm_parse+0x32>
mov    %r14,%rdi
call   1050 <pass1@plt>
test   %rax,%rax
js     1162 <asm_parse+0x32>
mov    %r14,%rdi
call   1040 <pass2@plt>
mov    %rax,%rbx
sar    $0x3f,%rbx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.assembler = type { i32 }
define i32 @asm_parse(%struct.assembler* %0) {
%2 = alloca i32
%3 = alloca %struct.assembler*
store %struct.assembler* %0, %struct.assembler** %3
%4 = load %struct.assembler*, %struct.assembler** %3
%5 = call i64 @construct_tokens(%struct.assembler* %4)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %19
8: ; preds = %1
%9 = load %struct.assembler*, %struct.assembler** %3
%10 = call i64 @pass1(%struct.assembler* %9)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 -1, i32* %2
br label %19
13: ; preds = %8
%14 = load %struct.assembler*, %struct.assembler** %3
%15 = call i64 @pass2(%struct.assembler* %14)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 -1, i32* %2
br label %19
18: ; preds = %13
store i32 0, i32* %2
br label %19
19: ; preds = %18, %17, %12, %7
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
%struct.assembler = type { i32 }
define i32 @asm_parse(%struct.assembler* %0) {
%2 = tail call i64 @construct_tokens(%struct.assembler* %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i64 @pass1(%struct.assembler* %0)
%6 = icmp slt i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = tail call i64 @pass2(%struct.assembler* %0)
%9 = ashr i64 %8, 63
%10 = trunc i64 %9 to i32
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ -1, %1 ], [ -1, %4 ], [ %10, %7 ]
ret i32 %12
}