#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 *pad_front(char *, int /*<<< orphan*/, size_t, size_t);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char **);
char *skip_padding(char *);
size_t strlen(char *);
int /*<<< orphan*/ sum_setun(char *, char *, size_t);
int main() {
  char *a = 0, *b = 0;
  scanf("%ms", &a);
  scanf("%ms", &b);
  size_t a_length = strlen(a), b_length = strlen(b),
         length = (((a_length) > (b_length)) ? (a_length) : (b_length)) + 1;
  a = pad_front(a, '0', a_length, length);
  b = pad_front(b, '0', b_length, length);
  sum_setun(a, b, length);
  printf("%s\n", skip_padding(a));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xe7a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1080 <scanf@plt>
lea    0xe6a(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jbe    11d4 <main+0x74>
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    11dc <main+0x7c>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    $0x30,%esi
call   1030 <pad_front@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    $0x30,%esi
call   1030 <pad_front@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1070 <sum_setun@plt>
mov    -0x10(%rbp),%rdi
call   1060 <skip_padding@plt>
mov    %rax,%rsi
lea    0xdc4(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xe7c(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1080 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1080 <scanf@plt>
mov    0x8(%rsp),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rax,%r12
mov    0x10(%rsp),%rdi
call   1040 <strlen@plt>
mov    %rax,%r15
cmp    %rax,%r12
mov    %rax,%rbx
cmova  %r12,%rbx
add    $0x1,%rbx
mov    %r14,%rdi
mov    $0x30,%esi
mov    %r12,%rdx
mov    %rbx,%rcx
call   1030 <pad_front@plt>
mov    %rax,0x8(%rsp)
mov    0x10(%rsp),%rdi
mov    $0x30,%esi
mov    %r15,%rdx
mov    %rbx,%rcx
call   1030 <pad_front@plt>
mov    %rax,0x10(%rsp)
mov    0x8(%rsp),%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1070 <sum_setun@plt>
mov    0x8(%rsp),%rdi
call   1060 <skip_padding@plt>
lea    0xde8(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ms\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i32 0, i32* %1
store i8* null, i8** %2
store i8* null, i8** %3
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2)
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %3)
%9 = load i8*, i8** %2
%10 = call i64 @strlen(i8* %9)
store i64 %10, i64* %4
%11 = load i8*, i8** %3
%12 = call i64 @strlen(i8* %11)
store i64 %12, i64* %5
%13 = load i64, i64* %4
%14 = load i64, i64* %5
%15 = icmp ugt i64 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = load i64, i64* %4
br label %20
18: ; preds = %0
%19 = load i64, i64* %5
br label %20
20: ; preds = %18, %16
%21 = phi i64 [ %17, %16 ], [ %19, %18 ]
%22 = add i64 %21, 1
store i64 %22, i64* %6
%23 = load i8*, i8** %2
%24 = load i64, i64* %4
%25 = load i64, i64* %6
%26 = call i8* @pad_front(i8* %23, i32 48, i64 %24, i64 %25)
store i8* %26, i8** %2
%27 = load i8*, i8** %3
%28 = load i64, i64* %5
%29 = load i64, i64* %6
%30 = call i8* @pad_front(i8* %27, i32 48, i64 %28, i64 %29)
store i8* %30, i8** %3
%31 = load i8*, i8** %2
%32 = load i8*, i8** %3
%33 = load i64, i64* %6
%34 = call i32 @sum_setun(i8* %31, i8* %32, i64 %33)
%35 = load i8*, i8** %2
%36 = call i8* @skip_padding(i8* %35)
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ms\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%4 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1)
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2)
%7 = load i8*, i8** %1
%8 = call i64 @strlen(i8* dereferenceable(1) %7)
%9 = load i8*, i8** %2
%10 = call i64 @strlen(i8* dereferenceable(1) %9)
%11 = icmp ugt i64 %8, %10
%12 = select i1 %11, i64 %8, i64 %10
%13 = add i64 %12, 1
%14 = call i8* @pad_front(i8* %7, i32 48, i64 %8, i64 %13)
store i8* %14, i8** %1
%15 = load i8*, i8** %2
%16 = call i8* @pad_front(i8* %15, i32 48, i64 %10, i64 %13)
store i8* %16, i8** %2
%17 = load i8*, i8** %1
%18 = call i32 @sum_setun(i8* %17, i8* %16, i64 %13)
%19 = load i8*, i8** %1
%20 = call i8* @skip_padding(i8* %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %20)
ret i32 0
}