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

/* Variables and functions */
int /*<<< orphan*/ ExpectedTypeError1(void *, char const *, int, char const *);
struct FunctionDefinition *FindFunction(void *, char const *);
char *GetArgumentTypeName(int /*<<< orphan*/);
int /*<<< orphan*/ GetNthRestriction(struct FunctionDefinition *, int);
void ExpectedTypeError2(void *theEnv, const char *functionName, int whichArg) {
  struct FunctionDefinition *theFunction;
  const char *theType;
  theFunction = FindFunction(theEnv, functionName);
  if (theFunction == NULL)
    return;
  theType = GetArgumentTypeName(GetNthRestriction(theFunction, whichArg));
  ExpectedTypeError1(theEnv, functionName, whichArg, theType);
}


x86 assembly (clang, -O0):
<ExpectedTypeError2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <FindFunction@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1174 <ExpectedTypeError2+0x34>
jmp    119f <ExpectedTypeError2+0x5f>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <GetNthRestriction@plt>
mov    %eax,%edi
call   1040 <GetArgumentTypeName@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   1060 <ExpectedTypeError1@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExpectedTypeError2>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <FindFunction@plt>
test   %rax,%rax
je     117e <ExpectedTypeError2+0x3e>
mov    %rax,%rdi
mov    %r14d,%esi
call   1050 <GetNthRestriction@plt>
mov    %eax,%edi
call   1040 <GetArgumentTypeName@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
mov    %rax,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <ExpectedTypeError1@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.FunctionDefinition = type { i32 }
define void @ExpectedTypeError2(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca %struct.FunctionDefinition*
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call %struct.FunctionDefinition* @FindFunction(i8* %9, i8* %10)
store %struct.FunctionDefinition* %11, %struct.FunctionDefinition** %7
%12 = load %struct.FunctionDefinition*, %struct.FunctionDefinition** %7
%13 = icmp eq %struct.FunctionDefinition* %12, null
br i1 %13, label %14, label %15
14: ; preds = %3
br label %25
15: ; preds = %3
%16 = load %struct.FunctionDefinition*, %struct.FunctionDefinition** %7
%17 = load i32, i32* %6
%18 = call i32 @GetNthRestriction(%struct.FunctionDefinition* %16, i32 %17)
%19 = call i8* @GetArgumentTypeName(i32 %18)
store i8* %19, i8** %8
%20 = load i8*, i8** %4
%21 = load i8*, i8** %5
%22 = load i32, i32* %6
%23 = load i8*, i8** %8
%24 = call i32 @ExpectedTypeError1(i8* %20, i8* %21, i32 %22, i8* %23)
br label %25
25: ; preds = %15, %14
ret void
}

LLVM IR (-O2):
%struct.FunctionDefinition = type { i32 }
define void @ExpectedTypeError2(i8* %0, i8* %1, i32 %2) {
%4 = tail call %struct.FunctionDefinition* @FindFunction(i8* %0, i8* %1)
%5 = icmp eq %struct.FunctionDefinition* %4, null
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i32 @GetNthRestriction(%struct.FunctionDefinition* %4, i32 %2)
%8 = tail call i8* @GetArgumentTypeName(i32 %7)
%9 = tail call i32 @ExpectedTypeError1(i8* %0, i8* %1, i32 %2, i8* %8)
br label %10
10: ; preds = %3, %6
ret void
}