#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 parse_ctx {
  int dummy;
};

/* Variables and functions */
scalar_t__ expr__parse(double *, struct parse_ctx *, char const **);
int /*<<< orphan*/ pr_debug(char *, char *, int, char *);
int test(struct parse_ctx *ctx, const char *e, double val2) {
  double val;
  if (expr__parse(&val, ctx, &e))
    do {
      if (!(0)) {
        pr_debug("FAILED %s:%d %s\n",
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/Stefan-Schmidt/"
                 "linux-wpan-next/refs/heads/ccid5/tools/perf/tests/expr.c",
                 11, "parse test failed");
        return -1;
      }
    } while (0);
  do {
    if (!(val == val2)) {
      pr_debug("FAILED %s:%d %s\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/Stefan-Schmidt/"
               "linux-wpan-next/refs/heads/ccid5/tools/perf/tests/expr.c",
               12, "unexpected value");
      return -1;
    }
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x28(%rbp),%rdi
lea    -0x18(%rbp),%rdx
call   1030 <expr__parse@plt>
cmp    $0x0,%rax
je     1180 <test+0x60>
jmp    1155 <test+0x35>
lea    0xea4(%rip),%rdi
lea    0xeae(%rip),%rsi
mov    $0xb,%edx
lea    0xf44(%rip),%rcx
call   1040 <pr_debug@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d7 <test+0xb7>
jmp    1185 <test+0x65>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jne    11a0 <test+0x80>
jp     11a0 <test+0x80>
jmp    11cb <test+0xab>
lea    0xe59(%rip),%rdi
lea    0xe63(%rip),%rsi
mov    $0xc,%edx
lea    0xf0b(%rip),%rcx
call   1040 <pr_debug@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d7 <test+0xb7>
jmp    11d0 <test+0xb0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
mov    %rdi,%rax
mov    %rsi,0x10(%rsp)
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rdx
mov    %rax,%rsi
call   1030 <expr__parse@plt>
test   %rax,%rax
je     116e <test+0x4e>
lea    0xeb1(%rip),%rdi
lea    0xebb(%rip),%rsi
lea    0xf56(%rip),%rcx
mov    $0xb,%edx
call   1040 <pr_debug@plt>
mov    $0xffffffff,%eax
jmp    117f <test+0x5f>
movsd  0x8(%rsp),%xmm0
xor    %eax,%eax
ucomisd (%rsp),%xmm0
jne    1184 <test+0x64>
jp     1184 <test+0x64>
add    $0x18,%rsp
ret
lea    0xe75(%rip),%rdi
lea    0xe7f(%rip),%rsi
lea    0xf2c(%rip),%rcx
mov    $0xc,%edx
jmp    1162 <test+0x42>

LLVM IR (-O0):
%struct.parse_ctx = type { i32 }
@.str = [17 x i8] c"FAILED %s:%d %s\0A\00"
@.str.1 = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Stefan-Schmidt/linux-wpan-next/refs/heads/ccid5/tools/perf/tests/expr.c\00"
@.str.2 = [18 x i8] c"parse test failed\00"
@.str.3 = [17 x i8] c"unexpected value\00"
define i32 @test(%struct.parse_ctx* %0, i8* %1, double %2) {
%4 = alloca i32
%5 = alloca %struct.parse_ctx*
%6 = alloca i8*
%7 = alloca double
%8 = alloca double
store %struct.parse_ctx* %0, %struct.parse_ctx** %5
store i8* %1, i8** %6
store double %2, double* %7
%9 = load %struct.parse_ctx*, %struct.parse_ctx** %5
%10 = call i64 @expr__parse(double* %8, %struct.parse_ctx* %9, i8** %6)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %3
br label %13
13: ; preds = %12
%14 = call i32 @pr_debug(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str.1, i64 0, i64 0), i32 11, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %4
br label %25
15: ; No predecessors!
br label %16
16: ; preds = %15, %3
br label %17
17: ; preds = %16
%18 = load double, double* %8
%19 = load double, double* %7
%20 = fcmp oeq double %18, %19
br i1 %20, label %23, label %21
21: ; preds = %17
%22 = call i32 @pr_debug(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str.1, i64 0, i64 0), i32 12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %4
br label %25
23: ; preds = %17
br label %24
24: ; preds = %23
store i32 0, i32* %4
br label %25
25: ; preds = %24, %21, %13
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
%struct.parse_ctx = type { i32 }
@.str = [17 x i8] c"FAILED %s:%d %s\0A\00"
@.str.1 = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Stefan-Schmidt/linux-wpan-next/refs/heads/ccid5/tools/perf/tests/expr.c\00"
@.str.2 = [18 x i8] c"parse test failed\00"
@.str.3 = [17 x i8] c"unexpected value\00"
define i32 @test(%struct.parse_ctx* %0, i8* %1, double %2) {
%4 = alloca i8*
%5 = alloca double
store i8* %1, i8** %4
%6 = bitcast double* %5 to i8*
%7 = call i64 @expr__parse(double* %5, %struct.parse_ctx* %0, i8** %4)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %3
%10 = call i32 @pr_debug(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str.1, i64 0, i64 0), i32 11, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %16
11: ; preds = %3
%12 = load double, double* %5
%13 = fcmp oeq double %12, %2
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = call i32 @pr_debug(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str.1, i64 0, i64 0), i32 12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %11, %14, %9
%17 = phi i32 [ -1, %9 ], [ -1, %14 ], [ 0, %11 ]
ret i32 %17
}