#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*/ add(char *, int, char *, int, char *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int strlen(char *);
int main(int argc, char *argv[]) {
  char *int1, *int2, *res;
  int len1, len2, len;
  if (argc < 3) {
    printf("\nERROR : give input numbers too\n");
    return -1;
  }
  int1 = argv[1];
  int2 = argv[2];
  len1 = strlen(int1);
  len2 = strlen(int2);
  len = len1 > len2 ? len1 : len2;
  res = (char *)malloc(len + 1);
  if (len1 >= len2)
    add(int1, len1, int2, len2, res, len);
  else
    add(int2, len2, int1, len1, res, len);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1178 <main+0x38>
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1228 <main+0xe8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jle    11bf <main+0x7f>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    11c5 <main+0x85>
mov    -0x30(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edi
add    $0x1,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jl     1206 <main+0xc6>
mov    -0x18(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x34(%rbp),%r9d
call   1030 <add@plt>
jmp    1221 <main+0xe1>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x34(%rbp),%r9d
call   1030 <add@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x2,%edi
jg     1160 <main+0x20>
lea    0xeac(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
jmp    11b8 <main+0x78>
mov    0x8(%rsi),%r14
mov    0x10(%rsi),%r15
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %eax,%r12d
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
cmp    %eax,%r12d
mov    %eax,%ebx
cmovg  %r12d,%ebx
lea    0x1(%rbx),%edi
call   1060 <malloc@plt>
cmp    %ebp,%r12d
jge    11a0 <main+0x60>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %r12d,%ecx
jmp    11ab <main+0x6b>
mov    %r14,%rdi
mov    %r12d,%esi
mov    %r15,%rdx
mov    %ebp,%ecx
mov    %rax,%r8
mov    %ebx,%r9d
call   1030 <add@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"\0AERROR : give input numbers too\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %60
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
store i8* %19, i8** %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
store i8* %22, i8** %7
%23 = load i8*, i8** %6
%24 = call i32 @strlen(i8* %23)
store i32 %24, i32* %9
%25 = load i8*, i8** %7
%26 = call i32 @strlen(i8* %25)
store i32 %26, i32* %10
%27 = load i32, i32* %9
%28 = load i32, i32* %10
%29 = icmp sgt i32 %27, %28
br i1 %29, label %30, label %32
30: ; preds = %16
%31 = load i32, i32* %9
br label %34
32: ; preds = %16
%33 = load i32, i32* %10
br label %34
34: ; preds = %32, %30
%35 = phi i32 [ %31, %30 ], [ %33, %32 ]
store i32 %35, i32* %11
%36 = load i32, i32* %11
%37 = add nsw i32 %36, 1
%38 = call i64 @malloc(i32 %37)
%39 = inttoptr i64 %38 to i8*
store i8* %39, i8** %8
%40 = load i32, i32* %9
%41 = load i32, i32* %10
%42 = icmp sge i32 %40, %41
br i1 %42, label %43, label %51
43: ; preds = %34
%44 = load i8*, i8** %6
%45 = load i32, i32* %9
%46 = load i8*, i8** %7
%47 = load i32, i32* %10
%48 = load i8*, i8** %8
%49 = load i32, i32* %11
%50 = call i32 @add(i8* %44, i32 %45, i8* %46, i32 %47, i8* %48, i32 %49)
br label %59
51: ; preds = %34
%52 = load i8*, i8** %7
%53 = load i32, i32* %10
%54 = load i8*, i8** %6
%55 = load i32, i32* %9
%56 = load i8*, i8** %8
%57 = load i32, i32* %11
%58 = call i32 @add(i8* %52, i32 %53, i8* %54, i32 %55, i8* %56, i32 %57)
br label %59
59: ; preds = %51, %43
store i32 0, i32* %3
br label %60
60: ; preds = %59, %14
%61 = load i32, i32* %3
ret i32 %61
}

LLVM IR (-O2):
@str = [32 x i8] c"\0AERROR : give input numbers too\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %23
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = tail call i32 @strlen(i8* %8)
%12 = tail call i32 @strlen(i8* %10)
%13 = icmp sgt i32 %11, %12
%14 = select i1 %13, i32 %11, i32 %12
%15 = add nsw i32 %14, 1
%16 = tail call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to i8*
%18 = icmp slt i32 %11, %12
br i1 %18, label %21, label %19
19: ; preds = %6
%20 = tail call i32 @add(i8* %8, i32 %11, i8* %10, i32 %12, i8* %17, i32 %14)
br label %23
21: ; preds = %6
%22 = tail call i32 @add(i8* %10, i32 %12, i8* %8, i32 %11, i8* %17, i32 %14)
br label %23
23: ; preds = %19, %21, %4
%24 = phi i32 [ -1, %4 ], [ 0, %21 ], [ 0, %19 ]
ret i32 %24
}