#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 atol(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int libcall(int, int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int retval = 0;
  if (argc != 2) {
    retval = libcall(argc, argc);
  } else {
    retval = libcall(atol(argv[1]), 1) * libcall(atol(argv[1]), 2);
  }
  fprintf(stderr, "main returning %d\n", retval);
  return retval;
}


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)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     116a <main+0x3a>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <libcall@plt>
mov    %eax,-0x14(%rbp)
jmp    11aa <main+0x7a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1040 <libcall@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %eax,%edi
mov    $0x2,%esi
call   1040 <libcall@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe43(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    116e <main+0x3e>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <atol@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1040 <libcall@plt>
mov    %eax,%ebp
mov    0x8(%rbx),%rdi
call   1050 <atol@plt>
mov    %eax,%edi
mov    $0x2,%esi
call   1040 <libcall@plt>
mov    %eax,%ebx
imul   %ebp,%ebx
jmp    1177 <main+0x47>
mov    %edi,%esi
call   1040 <libcall@plt>
mov    %eax,%ebx
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
lea    0xe79(%rip),%rsi
mov    %ebx,%edx
call   1030 <fprintf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"main returning %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 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i32, i32* %4
%12 = call i32 @libcall(i32 %10, i32 %11)
store i32 %12, i32* %6
br label %25
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atol(i8* %16)
%18 = call i32 @libcall(i32 %17, i32 1)
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atol(i8* %21)
%23 = call i32 @libcall(i32 %22, i32 2)
%24 = mul nsw i32 %18, %23
store i32 %24, i32* %6
br label %25
25: ; preds = %13, %9
%26 = load i32, i32* @stderr
%27 = load i32, i32* %6
%28 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %6
ret i32 %29
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"main returning %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @libcall(i32 %0, i32 %0)
br label %15
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atol(i8* %8)
%10 = tail call i32 @libcall(i32 %9, i32 1)
%11 = load i8*, i8** %7
%12 = tail call i32 @atol(i8* %11)
%13 = tail call i32 @libcall(i32 %12, i32 2)
%14 = mul nsw i32 %13, %10
br label %15
15: ; preds = %6, %4
%16 = phi i32 [ %5, %4 ], [ %14, %6 ]
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i32 %16
}