#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*/ full_adder(char, char, char, char *, char *);
void addition(char *a, char *b, char *s) {
  char cin[5 + 2] = "000000";
  for (int i = 5 - 1; i >= 0; i--)
    full_adder(a[i], b[i], cin[i + 1], &s[i], &cin[i]);
}


x86 assembly (clang, -O0):
<addition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0xed6(%rip),%eax
mov    %eax,-0x1f(%rbp)
mov    0xed0(%rip),%ax
mov    %ax,-0x1b(%rbp)
mov    0xec8(%rip),%al
mov    %al,-0x19(%rbp)
movl   $0x4,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jl     11a8 <addition+0x98>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,1),%sil
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x1f(%rbp,%rax,1),%al
mov    -0x18(%rbp),%rcx
movslq -0x24(%rbp),%rdi
add    %rdi,%rcx
movslq -0x24(%rbp),%rdi
lea    -0x1f(%rbp),%r8
add    %rdi,%r8
movsbl %sil,%edi
movsbl %dl,%esi
movsbl %al,%edx
call   1030 <full_adder@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1148 <addition+0x38>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addition>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movl   $0x303030,0x3(%rsp)
movl   $0x30303030,(%rsp)
lea    0x3(%rsp),%r12
movsbl 0x4(%rdi),%edi
movsbl 0x4(%rsi),%esi
lea    0x4(%rdx),%rcx
lea    0x4(%rsp),%r8
mov    $0x30,%edx
call   1030 <full_adder@plt>
movsbl 0x3(%rbx),%edi
movsbl 0x3(%r15),%esi
movsbl 0x4(%rsp),%edx
lea    0x3(%r14),%rcx
mov    %r12,%r8
call   1030 <full_adder@plt>
movsbl 0x2(%rbx),%edi
movsbl 0x2(%r15),%esi
movsbl 0x3(%rsp),%edx
lea    0x2(%r14),%rcx
lea    0x2(%rsp),%r8
call   1030 <full_adder@plt>
movsbl 0x1(%rbx),%edi
movsbl 0x1(%r15),%esi
movsbl 0x2(%rsp),%edx
lea    0x1(%r14),%rcx
lea    0x1(%rsp),%r8
call   1030 <full_adder@plt>
movsbl (%rbx),%edi
movsbl (%r15),%esi
movsbl 0x1(%rsp),%edx
mov    %rsp,%r8
mov    %r14,%rcx
call   1030 <full_adder@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.addition.cin = [7 x i8] c"000000\00"
define void @addition(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [7 x i8]
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = bitcast [7 x i8]* %7 to i8*
store i32 4, i32* %8
br label %10
10: ; preds = %37, %3
%11 = load i32, i32* %8
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %40
13: ; preds = %10
%14 = load i8*, i8** %4
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = load i8*, i8** %5
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = load i32, i32* %8
%25 = add nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = load i8*, i8** %6
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [7 x i8], [7 x i8]* %7, i64 0, i64 %34
%36 = call i32 @full_adder(i8 signext %18, i8 signext %23, i8 signext %28, i8* %32, i8* %35)
br label %37
37: ; preds = %13
%38 = load i32, i32* %8
%39 = add nsw i32 %38, -1
store i32 %39, i32* %8
br label %10
40: ; preds = %10
ret void
}

LLVM IR (-O2):
@__const.addition.cin = [7 x i8] c"000000\00"
define void @addition(i8* nocapture %0, i8* nocapture %1, i8* %2) {
%4 = alloca [7 x i8]
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%6 = getelementptr inbounds i8, i8* %0, i64 4
%7 = load i8, i8* %6
%8 = getelementptr inbounds i8, i8* %1, i64 4
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %2, i64 4
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 4
%12 = call i32 @full_adder(i8 signext %7, i8 signext %9, i8 signext 48, i8* %10, i8* %11)
%13 = getelementptr inbounds i8, i8* %0, i64 3
%14 = load i8, i8* %13
%15 = getelementptr inbounds i8, i8* %1, i64 3
%16 = load i8, i8* %15
%17 = load i8, i8* %11
%18 = getelementptr inbounds i8, i8* %2, i64 3
%19 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 3
%20 = call i32 @full_adder(i8 signext %14, i8 signext %16, i8 signext %17, i8* %18, i8* %19)
%21 = getelementptr inbounds i8, i8* %0, i64 2
%22 = load i8, i8* %21
%23 = getelementptr inbounds i8, i8* %1, i64 2
%24 = load i8, i8* %23
%25 = load i8, i8* %19
%26 = getelementptr inbounds i8, i8* %2, i64 2
%27 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 2
%28 = call i32 @full_adder(i8 signext %22, i8 signext %24, i8 signext %25, i8* %26, i8* %27)
%29 = getelementptr inbounds i8, i8* %0, i64 1
%30 = load i8, i8* %29
%31 = getelementptr inbounds i8, i8* %1, i64 1
%32 = load i8, i8* %31
%33 = load i8, i8* %27
%34 = getelementptr inbounds i8, i8* %2, i64 1
%35 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 1
%36 = call i32 @full_adder(i8 signext %30, i8 signext %32, i8 signext %33, i8* %34, i8* %35)
%37 = load i8, i8* %0
%38 = load i8, i8* %1
%39 = load i8, i8* %35
%40 = call i32 @full_adder(i8 signext %37, i8 signext %38, i8 signext %39, i8* %2, i8* %5)
ret void
}