#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 func1();
int func2();
int func3();
int func4();
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  if ((1 + 2 + 3 + 4) != (func1() + func2() + func3() + func4())) {
    printf("Arithmetic is fail.\n");
    return 1;
  }
  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    $0x0,%al
call   1040 <func1@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1070 <func2@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <func3@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1060 <func4@plt>
mov    -0x14(%rbp),%ecx
add    %eax,%ecx
mov    $0xa,%eax
cmp    %ecx,%eax
je     11c3 <main+0x73>
lea    0xe4e(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ca <main+0x7a>
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
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <func1@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1070 <func2@plt>
mov    %eax,%ebx
add    %ebp,%ebx
xor    %eax,%eax
call   1030 <func3@plt>
mov    %eax,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1060 <func4@plt>
add    %ebp,%eax
cmp    $0xa,%eax
je     1196 <main+0x46>
lea    0xe75(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Arithmetic is fail.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @func1()
%7 = call i32 (...) @func2()
%8 = add nsw i32 %6, %7
%9 = call i32 (...) @func3()
%10 = add nsw i32 %8, %9
%11 = call i32 (...) @func4()
%12 = add nsw i32 %10, %11
%13 = icmp ne i32 10, %12
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %17
16: ; preds = %2
store i32 0, i32* %3
br label %17
17: ; preds = %16, %14
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@str = [20 x i8] c"Arithmetic is fail.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @func1()
%4 = tail call i32 (...) @func2()
%5 = add nsw i32 %4, %3
%6 = tail call i32 (...) @func3()
%7 = add nsw i32 %5, %6
%8 = tail call i32 (...) @func4()
%9 = add nsw i32 %7, %8
%10 = icmp eq i32 %9, 10
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %2, %11
%14 = phi i32 [ 1, %11 ], [ 0, %2 ]
ret i32 %14
}