#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 */
scalar_t__ a1();
scalar_t__ a2();
scalar_t__ b1();
scalar_t__ b2();
char *basename(char *);
int /*<<< orphan*/ printf(char *, char *, int);
int main(int argc, char *argv[]) {
  int i = 0;
  i += a1() + a2();
  i += b1() + b2();
  printf("%s: %d\n", basename(argv[0]), i);
  return i;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <a1@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1070 <a2@plt>
mov    -0x28(%rbp),%rcx
add    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1080 <b1@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1060 <b2@plt>
mov    -0x20(%rbp),%rcx
add    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <basename@plt>
mov    %rax,%rsi
mov    -0x14(%rbp),%edx
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
xor    %eax,%eax
call   1040 <a1@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1070 <a2@plt>
mov    %rax,%r12
xor    %eax,%eax
call   1080 <b1@plt>
mov    %rax,%r13
xor    %eax,%eax
call   1060 <b2@plt>
mov    %rax,%rbx
add    %r15d,%r12d
add    %r12d,%r13d
add    %r13d,%ebx
mov    (%r14),%rdi
call   1050 <basename@plt>
lea    0xe54(%rip),%rdi
mov    %rax,%rsi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%s: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = call i64 (...) @a1()
%8 = call i64 (...) @a2()
%9 = add nsw i64 %7, %8
%10 = load i32, i32* %6
%11 = sext i32 %10 to i64
%12 = add nsw i64 %11, %9
%13 = trunc i64 %12 to i32
store i32 %13, i32* %6
%14 = call i64 (...) @b1()
%15 = call i64 (...) @b2()
%16 = add nsw i64 %14, %15
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = add nsw i64 %18, %16
%20 = trunc i64 %19 to i32
store i32 %20, i32* %6
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i8* @basename(i8* %23)
%25 = load i32, i32* %6
%26 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %24, i32 %25)
%27 = load i32, i32* %6
ret i32 %27
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 (...) @a1()
%4 = tail call i64 (...) @a2()
%5 = tail call i64 (...) @b1()
%6 = tail call i64 (...) @b2()
%7 = add i64 %4, %3
%8 = add i64 %7, %5
%9 = add i64 %8, %6
%10 = trunc i64 %9 to i32
%11 = load i8*, i8** %1
%12 = tail call i8* @basename(i8* %11)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %10)
ret i32 %10
}