#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 main(int argc, char **argv) {
  printf("Como o programa foi chamado: %s\n", argv[0]);
  if (argc > 1)
    for (int i = 1; i < argc; i++)
      printf("Olá %s!\n", argv[i]);
  else {
    printf("Olá mundo!\n");
    printf("Por gentileza, informe algum argumento via linha de comando.\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)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jle    1185 <main+0x75>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1180 <main+0x70>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114c <main+0x3c>
jmp    11a1 <main+0x91>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
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   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%ebp
mov    (%rsi),%rsi
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%ebp
jl     1169 <main+0x49>
mov    %ebp,%ebp
mov    $0x1,%ebx
lea    0xed1(%rip),%r14
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <main+0x30>
jmp    1181 <main+0x61>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Como o programa foi chamado: %s\0A\00"
@.str.1 = [10 x i8] c"Ol\C3\A1 %s!\0A\00"
@.str.2 = [13 x i8] c"Ol\C3\A1 mundo!\0A\00"
@.str.3 = [62 x i8] c"Por gentileza, informe algum argumento via linha de comando.\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 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %29
13: ; preds = %2
store i32 1, i32* %6
br label %14
14: ; preds = %25, %13
%15 = load i32, i32* %6
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %28
18: ; preds = %14
%19 = load i8**, i8*** %5
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %18
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %14
28: ; preds = %14
br label %32
29: ; preds = %2
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %29, %28
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Como o programa foi chamado: %s\0A\00"
@.str.1 = [10 x i8] c"Ol\C3\A1 %s!\0A\00"
@str = [12 x i8] c"Ol\C3\A1 mundo!\00"
@str.4 = [61 x i8] c"Por gentileza, informe algum argumento via linha de comando.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %15
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 1, %6 ], [ %13, %8 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %18, label %8
15: ; preds = %2
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.4, i64 0, i64 0))
br label %18
18: ; preds = %8, %15
ret i32 0
}