#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 parse_token(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int test_parse_token(char *keyword, int op) {
  int result;
  printf("   parse_token( '%s', 'not_needed', 0')", keyword);
  result = parse_token(keyword, "not_needed", 0);
  printf(" = '%i' ", result);
  if (result == op) {
    printf("passed\n");
    return (0);
  }
  printf("failed\n");
  return (1);
}


x86 assembly (clang, -O0):
<test_parse_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xedc(%rip),%rsi
xor    %edx,%edx
call   1040 <parse_token@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    118d <test_parse_token+0x6d>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a2 <test_parse_token+0x82>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_parse_token>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xebf(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
call   1050 <parse_token@plt>
mov    %eax,%ebx
lea    0xece(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %ebp,%ebp
cmp    %r14d,%ebx
setne  %bpl
lea    0xec5(%rip),%rax
lea    0xeb7(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c" parse_token( '%s', 'not_needed', 0')\00"
@.str.1 = [11 x i8] c"not_needed\00"
@.str.2 = [9 x i8] c" = '%i' \00"
@.str.3 = [8 x i8] c"passed\0A\00"
@.str.4 = [8 x i8] c"failed\0A\00"
define i32 @test_parse_token(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %4
%10 = call i32 @parse_token(i8* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 0)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %6
%14 = load i32, i32* %5
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %20
18: ; preds = %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %20
20: ; preds = %18, %16
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [40 x i8] c" parse_token( '%s', 'not_needed', 0')\00"
@.str.1 = [11 x i8] c"not_needed\00"
@.str.2 = [9 x i8] c" = '%i' \00"
@str = [7 x i8] c"failed\00"
@str.5 = [7 x i8] c"passed\00"
define i32 @test_parse_token(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @parse_token(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%6 = icmp eq i32 %4, %1
%7 = select i1 %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0)
%8 = xor i1 %6, true
%9 = zext i1 %8 to i32
%10 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret i32 %9
}