#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 */
char *get_date();
char *hostname();
int my_process_id();
int /*<<< orphan*/ printf(char *, ...);
char *username();
void print_banner(int argc, char **argv) {
  int i;
  printf("----- %s %s, %s -----\n", "Iterate", "4", "November 2009");
  printf("Process %d was started by %s on %s,\n%s", my_process_id(), username(),
         hostname(), get_date());
  printf("The command was \"");
  for (i = 0; i < argc; i++)
    printf("%s%s", argv[i], (i < argc - 1 ? " " : ""));
  printf("\".\n");
}


x86 assembly (clang, -O0):
<print_banner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xeaa(%rip),%rsi
lea    0xeab(%rip),%rdx
lea    0xea6(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <my_process_id@plt>
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   1050 <username@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1060 <hostname@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1070 <get_date@plt>
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    %rax,%r8
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    122b <print_banner+0xdb>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x14(%rbp),%ecx
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
lea    0xe14(%rip),%rdx
lea    0xe64(%rip),%rax
cmp    %edi,%ecx
cmovl  %rax,%rdx
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11da <print_banner+0x8a>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_banner>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,(%rsp)
mov    %edi,%r14d
lea    0xe87(%rip),%rdi
lea    0xe97(%rip),%rsi
lea    0xe98(%rip),%rdx
lea    0xe93(%rip),%rcx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <my_process_id@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   1060 <username@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1070 <hostname@plt>
mov    %rax,%rbp
xor    %eax,%eax
call   1080 <get_date@plt>
lea    0xe6e(%rip),%rdi
mov    %r12d,%esi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14d,%r14d
jle    1235 <print_banner+0xd5>
lea    -0x1(%r14),%ebp
mov    %r14d,%ebx
lea    0xe78(%rip),%r12
lea    0xe1a(%rip),%r13
lea    0xe65(%rip),%r14
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
mov    (%rsp),%rax
mov    (%rax,%r15,8),%rsi
cmp    %rbp,%r15
mov    %r13,%rdx
cmovb  %r12,%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15
cmp    %r15,%rbx
jne    1210 <print_banner+0xb0>
lea    0xe33(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"----- %s %s, %s -----\0A\00"
@.str.1 = [8 x i8] c"Iterate\00"
@.str.2 = [2 x i8] c"4\00"
@.str.3 = [14 x i8] c"November 2009\00"
@.str.4 = [39 x i8] c"Process %d was started by %s on %s,\0A%s\00"
@.str.5 = [18 x i8] c"The command was \22\00"
@.str.6 = [5 x i8] c"%s%s\00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [1 x i8] zeroinitializer
@.str.9 = [4 x i8] c"\22.\0A\00"
define void @print_banner(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 (...) @my_process_id()
%8 = call i8* (...) @username()
%9 = call i8* (...) @hostname()
%10 = call i8* (...) @get_date()
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %7, i8* %8, i8* %9, i8* %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %5
br label %13
13: ; preds = %30, %2
%14 = load i32, i32* %5
%15 = load i32, i32* %3
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %33
17: ; preds = %13
%18 = load i8**, i8*** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = load i32, i32* %5
%24 = load i32, i32* %3
%25 = sub nsw i32 %24, 1
%26 = icmp slt i32 %23, %25
%27 = zext i1 %26 to i64
%28 = select i1 %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %22, i8* %28)
br label %30
30: ; preds = %17
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %13
33: ; preds = %13
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"----- %s %s, %s -----\0A\00"
@.str.1 = [8 x i8] c"Iterate\00"
@.str.2 = [2 x i8] c"4\00"
@.str.3 = [14 x i8] c"November 2009\00"
@.str.4 = [39 x i8] c"Process %d was started by %s on %s,\0A%s\00"
@.str.5 = [18 x i8] c"The command was \22\00"
@.str.6 = [5 x i8] c"%s%s\00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [1 x i8] zeroinitializer
@str = [3 x i8] c"\22.\00"
define void @print_banner(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 (...) @my_process_id()
%5 = tail call i8* (...) @username()
%6 = tail call i8* (...) @hostname()
%7 = tail call i8* (...) @get_date()
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %4, i8* %5, i8* %6, i8* %7)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%10 = icmp sgt i32 %0, 0
br i1 %10, label %11, label %24
11: ; preds = %2
%12 = add nsw i32 %0, -1
%13 = zext i32 %12 to i64
%14 = zext i32 %0 to i64
br label %15
15: ; preds = %11, %15
%16 = phi i64 [ 0, %11 ], [ %22, %15 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = icmp ult i64 %16, %13
%20 = select i1 %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %18, i8* %20)
%22 = add nuw nsw i64 %16, 1
%23 = icmp eq i64 %22, %14
br i1 %23, label %24, label %15
24: ; preds = %15, %2
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}