#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 add(int, int);
int atoi(char *);
int /*<<< orphan*/ printargs(int, char **);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  printargs(argc, argv);
  if (argc != 3) {
    printf("specify two numbers to add\n");
    return -1;
  }
  int a = atoi(argv[1]);
  int b = atoi(argv[2]);
  printf("adding %d + %d = %d\n", a, b, add(a, b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <printargs@plt>
cmpl   $0x3,-0x8(%rbp)
je     1186 <main+0x46>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11da <main+0x9a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <add@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
call   1050 <printargs@plt>
cmp    $0x3,%ebp
jne    119d <main+0x4d>
mov    0x8(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
mov    %r14d,%edi
mov    %eax,%esi
call   1030 <add@plt>
lea    0xe75(%rip),%rdi
xor    %ebx,%ebx
mov    %r14d,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11ae <main+0x5e>
lea    0xe71(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"specify two numbers to add\0A\00"
@.str.1 = [21 x i8] c"adding %d + %d = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @printargs(i32 %8, i8** %9)
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %30
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %7
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = call i32 @add(i32 %26, i32 %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %24, i32 %25, i32 %28)
store i32 0, i32* %3
br label %30
30: ; preds = %15, %13
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"adding %d + %d = %d\0A\00"
@str = [27 x i8] c"specify two numbers to add\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @printargs(i32 %0, i8** %1)
%4 = icmp eq i32 %0, 3
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %16
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = tail call i32 @add(i32 %10, i32 %13)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %13, i32 %14)
br label %16
16: ; preds = %7, %5
%17 = phi i32 [ -1, %5 ], [ 0, %7 ]
ret i32 %17
}