#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 */
char *convertIntToRomanNumeralString(int);
scalar_t__ goodInput(char *, char *, int *, int *);
int /*<<< orphan*/ showSumExceedsMaximumValueMessage();
char *add(char *a, char *b) {
  int termA, termB;
  if (goodInput(a, b, &termA, &termB)) {
    int sum = termA + termB;
    if (sum < 4000)
      return convertIntToRomanNumeralString(sum);
  }
  showSumExceedsMaximumValueMessage();
  return NULL;
}


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1040 <goodInput@plt>
cmp    $0x0,%rax
je     118b <add+0x5b>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0xfa0,-0x24(%rbp)
jge    1186 <add+0x56>
mov    -0x24(%rbp),%edi
call   1030 <convertIntToRomanNumeralString@plt>
mov    %rax,-0x8(%rbp)
jmp    119a <add+0x6a>
jmp    118b <add+0x5b>
mov    $0x0,%al
call   1050 <showSumExceedsMaximumValueMessage@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1040 <goodInput@plt>
test   %rax,%rax
je     1163 <add+0x33>
mov    0x8(%rsp),%edi
add    0xc(%rsp),%edi
cmp    $0xf9f,%edi
jg     1163 <add+0x33>
call   1030 <convertIntToRomanNumeralString@plt>
mov    %rax,%rbx
jmp    116c <add+0x3c>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <showSumExceedsMaximumValueMessage@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @add(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call i64 @goodInput(i8* %9, i8* %10, i32* %6, i32* %7)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %23
13: ; preds = %2
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = add nsw i32 %14, %15
store i32 %16, i32* %8
%17 = load i32, i32* %8
%18 = icmp slt i32 %17, 4000
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = load i32, i32* %8
%21 = call i8* @convertIntToRomanNumeralString(i32 %20)
store i8* %21, i8** %3
br label %25
22: ; preds = %13
br label %23
23: ; preds = %22, %2
%24 = call i32 (...) @showSumExceedsMaximumValueMessage()
store i8* null, i8** %3
br label %25
25: ; preds = %23, %19
%26 = load i8*, i8** %3
ret i8* %26
}

LLVM IR (-O2):
define i8* @add(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i64 @goodInput(i8* %0, i8* %1, i32* %3, i32* %4)
%8 = icmp eq i64 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %2
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = add nsw i32 %11, %10
%13 = icmp slt i32 %12, 4000
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = call i8* @convertIntToRomanNumeralString(i32 %12)
br label %18
16: ; preds = %9, %2
%17 = call i32 (...) @showSumExceedsMaximumValueMessage()
br label %18
18: ; preds = %14, %16
%19 = phi i8* [ null, %16 ], [ %15, %14 ]
ret i8* %19
}