#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 FOO1(double *, double *, double *);
int FOO2(double *, double *, double *);
scalar_t__ dumb_compare(char *, char *);
long triad(int len, char *str_arg, char *str_arg2, double *restrict a,
           double *restrict b, double *restrict c) {
  int i, bytes = 16;
  if (dumb_compare(str_arg, str_arg2) == 0) {
    bytes = FOO1(a, b, c);
  } else {
    bytes = FOO2(a, b, c);
  }
  return bytes;
}


x86 assembly (clang, -O0):
<triad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x10,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <dumb_compare@plt>
cmp    $0x0,%rax
jne    1186 <triad+0x56>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1050 <FOO1@plt>
mov    %eax,-0x38(%rbp)
jmp    119a <triad+0x6a>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1030 <FOO2@plt>
mov    %eax,-0x38(%rbp)
movslq -0x38(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<triad>:
push   %r15
push   %r14
push   %rbx
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1040 <dumb_compare@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
test   %rax,%rax
je     115e <triad+0x2e>
call   1030 <FOO2@plt>
jmp    1163 <triad+0x33>
call   1050 <FOO1@plt>
cltq
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @triad(i32 %0, i8* %1, i8* %2, double* noalias %3, double* noalias %4, double* noalias %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
store i32 16, i32* %14
%15 = load i8*, i8** %8
%16 = load i8*, i8** %9
%17 = call i64 @dumb_compare(i8* %15, i8* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %6
%20 = load double*, double** %10
%21 = load double*, double** %11
%22 = load double*, double** %12
%23 = call i32 @FOO1(double* %20, double* %21, double* %22)
store i32 %23, i32* %14
br label %29
24: ; preds = %6
%25 = load double*, double** %10
%26 = load double*, double** %11
%27 = load double*, double** %12
%28 = call i32 @FOO2(double* %25, double* %26, double* %27)
store i32 %28, i32* %14
br label %29
29: ; preds = %24, %19
%30 = load i32, i32* %14
%31 = sext i32 %30 to i64
ret i64 %31
}

LLVM IR (-O2):
define i64 @triad(i32 %0, i8* %1, i8* %2, double* noalias %3, double* noalias %4, double* noalias %5) {
%7 = tail call i64 @dumb_compare(i8* %1, i8* %2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @FOO1(double* %3, double* %4, double* %5)
br label %13
11: ; preds = %6
%12 = tail call i32 @FOO2(double* %3, double* %4, double* %5)
br label %13
13: ; preds = %11, %9
%14 = phi i32 [ %10, %9 ], [ %12, %11 ]
%15 = sext i32 %14 to i64
ret i64 %15
}