#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fullAdder(int *, int *, int *, int *);
int /*<<< orphan*/ printf(char *);
void adder(int *a, int *b, int *c, int index) {
  if (index == 0) {
    if (*c == 1) {
      printf("Error at 'adder'!! Overflow!!\n");
      exit(1);
    }
    return;
  } else {
    fullAdder(a, b, c, a);
    adder(--a, --b, c, --index);
  }
}


x86 assembly (clang, -O0):
<adder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1189 <adder+0x49>
mov    -0x18(%rbp),%rax
cmpl   $0x1,(%rax)
jne    1184 <adder+0x44>
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    11c8 <adder+0x88>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
call   1030 <fullAdder@plt>
mov    -0x8(%rbp),%rdi
add    $0xfffffffffffffffc,%rdi
mov    %rdi,-0x8(%rbp)
mov    -0x10(%rbp),%rsi
add    $0xfffffffffffffffc,%rsi
mov    %rsi,-0x10(%rbp)
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
call   1050 <adder@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adder>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
test   %ecx,%ecx
je     116f <adder+0x3f>
mov    %ecx,%r15d
mov    %rsi,%rbx
mov    %rdi,%rbp
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
call   1030 <fullAdder@plt>
add    $0xfffffffffffffffc,%rbp
add    $0xfffffffffffffffc,%rbx
add    $0xffffffff,%r15d
jne    1150 <adder+0x20>
cmpl   $0x1,(%r14)
je     1180 <adder+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe79(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Error at 'adder'!! Overflow!!\0A\00"
define void @adder(i32* %0, i32* %1, i32* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %4
%12 = load i32*, i32** %7
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %11
br label %32
19: ; preds = %4
%20 = load i32*, i32** %5
%21 = load i32*, i32** %6
%22 = load i32*, i32** %7
%23 = load i32*, i32** %5
%24 = call i32 @fullAdder(i32* %20, i32* %21, i32* %22, i32* %23)
%25 = load i32*, i32** %5
%26 = getelementptr inbounds i32, i32* %25, i32 -1
store i32* %26, i32** %5
%27 = load i32*, i32** %6
%28 = getelementptr inbounds i32, i32* %27, i32 -1
store i32* %28, i32** %6
%29 = load i32*, i32** %7
%30 = load i32, i32* %8
%31 = add nsw i32 %30, -1
store i32 %31, i32* %8
br label %32
32: ; preds = %18, %19
ret void
}

LLVM IR (-O2):
@str = [30 x i8] c"Error at 'adder'!! Overflow!!\00"
define void @adder(i32* %0, i32* %1, i32* %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %6, label %12
6: ; preds = %12, %4
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %4, %12
%13 = phi i32 [ %19, %12 ], [ %3, %4 ]
%14 = phi i32* [ %18, %12 ], [ %1, %4 ]
%15 = phi i32* [ %17, %12 ], [ %0, %4 ]
%16 = tail call i32 @fullAdder(i32* %15, i32* %14, i32* %2, i32* %15)
%17 = getelementptr inbounds i32, i32* %15, i64 -1
%18 = getelementptr inbounds i32, i32* %14, i64 -1
%19 = add nsw i32 %13, -1
%20 = icmp eq i32 %19, 0
br i1 %20, label %6, label %12
21: ; preds = %6
ret void
}