#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 EXIT_SUCCESS;
int add(int, int);
int modulo(int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int summand1 = 23;
  int summand2 = 42;
  int sum = add(summand1, summand2);
  printf("%d + %d = %d\n", summand1, summand2, sum);
  int dividend = 8;
  int divisor = 3;
  int mod = modulo(dividend, divisor);
  printf("%d mod %d = %d\n", dividend, divisor, mod);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x17,-0x8(%rbp)
movl   $0x2a,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <add@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
movl   $0x8,-0x14(%rbp)
movl   $0x3,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <modulo@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x17,%edi
mov    $0x2a,%esi
call   1030 <add@plt>
lea    0xeb9(%rip),%rdi
mov    $0x17,%esi
mov    $0x2a,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
mov    $0x8,%edi
mov    $0x3,%esi
call   1050 <modulo@plt>
lea    0xea0(%rip),%rdi
mov    $0x8,%esi
mov    $0x3,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%d + %d = %d\0A\00"
@.str.1 = [16 x i8] c"%d mod %d = %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 23, i32* %2
store i32 42, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @add(i32 %8, i32 %9)
store i32 %10, i32* %4
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12, i32 %13)
store i32 8, i32* %5
store i32 3, i32* %6
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = call i32 @modulo(i32 %15, i32 %16)
store i32 %17, i32* %7
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %19, i32 %20)
%22 = load i32, i32* @EXIT_SUCCESS
ret i32 %22
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d + %d = %d\0A\00"
@.str.1 = [16 x i8] c"%d mod %d = %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @add(i32 23, i32 42)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 23, i32 42, i32 %1)
%3 = tail call i32 @modulo(i32 8, i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 3, i32 %3)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}