#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 bar();
int /*<<< orphan*/ bundled_version(int *, int *, int *);
int foo();
int /*<<< orphan*/ foo_bar(int *, int *);
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char const *argv[]) {
  int major, minor, version;
  int f, b, i;
  bundled_version(&major, &minor, &version);
  printf("libbundled version: %d.%d.%d\n", major, minor, version);
  for (i = 0; i < 5; ++i) {
    printf("foo: %d\n", foo());
  }
  for (i = 0; i < 5; ++i) {
    printf("bar: %d\n", bar());
  }
  for (i = 0; i < 5; ++i) {
    foo_bar(&f, &b);
    printf("foo bar: %d,%d\n", f, b);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1060 <bundled_version@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    11c4 <main+0x74>
mov    $0x0,%al
call   1050 <foo@plt>
mov    %eax,%esi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1195 <main+0x45>
movl   $0x0,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    11fa <main+0xaa>
mov    $0x0,%al
call   1030 <bar@plt>
mov    %eax,%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11cb <main+0x7b>
movl   $0x0,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    123a <main+0xea>
lea    -0x20(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1070 <foo_bar@plt>
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1201 <main+0xb1>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0x1c(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x14(%rsp),%rdx
call   1060 <bundled_version@plt>
mov    0x1c(%rsp),%esi
mov    0x18(%rsp),%edx
mov    0x14(%rsp),%ecx
lea    0xe80(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <foo@plt>
lea    0xe89(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <foo@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <foo@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <foo@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <foo@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <bar@plt>
lea    0xe2c(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <foo_bar@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
lea    0xdb9(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <foo_bar@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <foo_bar@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <foo_bar@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <foo_bar@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [30 x i8] c"libbundled version: %d.%d.%d\0A\00"
@.str.1 = [9 x i8] c"foo: %d\0A\00"
@.str.2 = [9 x i8] c"bar: %d\0A\00"
@.str.3 = [16 x i8] c"foo bar: %d,%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 @bundled_version(i32* %6, i32* %7, i32* %8)
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
store i32 0, i32* %11
br label %17
17: ; preds = %23, %2
%18 = load i32, i32* %11
%19 = icmp slt i32 %18, 5
br i1 %19, label %20, label %26
20: ; preds = %17
%21 = call i32 (...) @foo()
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %20
%24 = load i32, i32* %11
%25 = add nsw i32 %24, 1
store i32 %25, i32* %11
br label %17
26: ; preds = %17
store i32 0, i32* %11
br label %27
27: ; preds = %33, %26
%28 = load i32, i32* %11
%29 = icmp slt i32 %28, 5
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = call i32 (...) @bar()
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %30
%34 = load i32, i32* %11
%35 = add nsw i32 %34, 1
store i32 %35, i32* %11
br label %27
36: ; preds = %27
store i32 0, i32* %11
br label %37
37: ; preds = %45, %36
%38 = load i32, i32* %11
%39 = icmp slt i32 %38, 5
br i1 %39, label %40, label %48
40: ; preds = %37
%41 = call i32 @foo_bar(i32* %9, i32* %10)
%42 = load i32, i32* %9
%43 = load i32, i32* %10
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %42, i32 %43)
br label %45
45: ; preds = %40
%46 = load i32, i32* %11
%47 = add nsw i32 %46, 1
store i32 %47, i32* %11
br label %37
48: ; preds = %37
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"libbundled version: %d.%d.%d\0A\00"
@.str.1 = [9 x i8] c"foo: %d\0A\00"
@.str.2 = [9 x i8] c"bar: %d\0A\00"
@.str.3 = [16 x i8] c"foo bar: %d,%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = call i32 @bundled_version(i32* %3, i32* %4, i32* %5)
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15, i32 %16)
%18 = call i32 (...) @foo()
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = call i32 (...) @foo()
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i32 (...) @foo()
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = call i32 (...) @foo()
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = call i32 (...) @foo()
%27 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = call i32 (...) @bar()
%29 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%30 = call i32 (...) @bar()
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = call i32 (...) @bar()
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = call i32 (...) @bar()
%35 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %34)
%36 = call i32 (...) @bar()
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %36)
%38 = call i32 @foo_bar(i32* %6, i32* %7)
%39 = load i32, i32* %6
%40 = load i32, i32* %7
%41 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %39, i32 %40)
%42 = call i32 @foo_bar(i32* %6, i32* %7)
%43 = load i32, i32* %6
%44 = load i32, i32* %7
%45 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %43, i32 %44)
%46 = call i32 @foo_bar(i32* %6, i32* %7)
%47 = load i32, i32* %6
%48 = load i32, i32* %7
%49 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %47, i32 %48)
%50 = call i32 @foo_bar(i32* %6, i32* %7)
%51 = load i32, i32* %6
%52 = load i32, i32* %7
%53 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %51, i32 %52)
%54 = call i32 @foo_bar(i32* %6, i32* %7)
%55 = load i32, i32* %6
%56 = load i32, i32* %7
%57 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %55, i32 %56)
ret i32 0
}