#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*/ printf(char *, ...);
int /*<<< orphan*/ v_task1();
int /*<<< orphan*/ v_task2(int);
int /*<<< orphan*/ v_task3(int, int *);
int /*<<< orphan*/ v_task4(int, int *);
int c_main(void) {
  int i = 0, o = 0;
  printf("Hello from c_main()\n");
  v_task1();
  i = 1;
  v_task2(i);
  i = 1;
  v_task3(i, &o);
  printf("------ Call Task3 output = %d\n", o);
  i = 0;
  v_task4(i, &o);
  printf("------ Call Task3 output = %d\n", o);
  return (0);
}


x86 assembly (clang, -O0):
<c_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <v_task1@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1070 <v_task2@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1050 <v_task3@plt>
mov    -0x8(%rbp),%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1060 <v_task4@plt>
mov    -0x8(%rbp),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_main>:
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <v_task1@plt>
mov    $0x1,%edi
call   1080 <v_task2@plt>
lea    0x4(%rsp),%r14
mov    $0x1,%edi
mov    %r14,%rsi
call   1060 <v_task3@plt>
mov    0x4(%rsp),%esi
lea    0xe5a(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <v_task4@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Hello from c_main()\0A\00"
@.str.1 = [31 x i8] c"------ Call Task3 output = %d\0A\00"
define i32 @c_main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @v_task1()
store i32 1, i32* %1
%5 = load i32, i32* %1
%6 = call i32 @v_task2(i32 %5)
store i32 1, i32* %1
%7 = load i32, i32* %1
%8 = call i32 @v_task3(i32 %7, i32* %2)
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %9)
store i32 0, i32* %1
%11 = load i32, i32* %1
%12 = call i32 @v_task4(i32 %11, i32* %2)
%13 = load i32, i32* %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [31 x i8] c"------ Call Task3 output = %d\0A\00"
@str = [20 x i8] c"Hello from c_main()\00"
define i32 @c_main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @v_task1()
%5 = tail call i32 @v_task2(i32 1)
%6 = call i32 @v_task3(i32 1, i32* %1)
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 @v_task4(i32 0, i32* %1)
%10 = load i32, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}