int main(argc, argv)
int argc;
char **argv;
{
  int value;
  printf("Welcome to GNU libtool cdemo!\n");
  value = hello();
  printf("hello returned: %i\n", value);
  if (value == 0xe110)
    printf("hello is ok!\n");
  if (foo() == 0xf00)
    printf("foo is ok!\n");
  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)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <hello@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xe110,-0x14(%rbp)
jne    118a <main+0x5a>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <foo@plt>
cmp    $0xf00,%eax
jne    11aa <main+0x7a>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <hello@plt>
mov    %eax,%ebx
lea    0xea3(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0xe110,%ebx
jne    117a <main+0x3a>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <foo@plt>
cmp    $0xf00,%eax
jne    1194 <main+0x54>
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Welcome to GNU libtool cdemo!\0A\00"
@.str.1 = [20 x i8] c"hello returned: %i\0A\00"
@.str.2 = [14 x i8] c"hello is ok!\0A\00"
@.str.3 = [12 x i8] c"foo is ok!\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
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @hello()
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, 57616
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %2
%16 = call i32 (...) @foo()
%17 = icmp eq i32 %16, 3840
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [20 x i8] c"hello returned: %i\0A\00"
@str = [30 x i8] c"Welcome to GNU libtool cdemo!\00"
@str.4 = [11 x i8] c"foo is ok!\00"
@str.5 = [13 x i8] c"hello is ok!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @hello()
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = icmp eq i32 %4, 57616
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.5, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
%10 = tail call i32 (...) @foo()
%11 = icmp eq i32 %10, 3840
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.4, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
ret i32 0
}