#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*/ puts(char *);
int main(int argc, const char **argv) {
  const char *p = (const char *)argv;
  char *s = "Hello\nWorld";
  unsigned i = 0;
  for (i = 14 - argc; i && p[i - 1] != '\n'; i--)
    ;
  puts(s);
  return i;
}


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)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xecb(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    $0xe,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x24(%rbp)
mov    %al,-0x25(%rbp)
je     1173 <main+0x63>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    1183 <main+0x73>
jmp    1196 <main+0x86>
jmp    1188 <main+0x78>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    114b <main+0x3b>
mov    -0x20(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %edi,%ebx
mov    $0xe,%eax
sub    %edi,%eax
add    $0xfffffff1,%ebx
add    $0xffffffffffffffff,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0xffffffffffffffff,%rax
je     1149 <main+0x39>
mov    %eax,%ecx
add    $0x1,%ebx
add    $0xffffffffffffffff,%rax
cmpb   $0xa,(%rsi,%rcx,1)
jne    1130 <main+0x20>
neg    %ebx
jmp    114b <main+0x3b>
xor    %ebx,%ebx
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Hello\0AWorld\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = bitcast i8** %9 to i8*
store i8* %10, i8** %6
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %7
store i32 0, i32* %8
%11 = load i32, i32* %4
%12 = sub nsw i32 14, %11
store i32 %12, i32* %8
br label %13
13: ; preds = %28, %2
%14 = load i32, i32* %8
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = load i8*, i8** %6
%18 = load i32, i32* %8
%19 = sub i32 %18, 1
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %17, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 10
br label %25
25: ; preds = %16, %13
%26 = phi i1 [ false, %13 ], [ %24, %16 ]
br i1 %26, label %27, label %31
27: ; preds = %25
br label %28
28: ; preds = %27
%29 = load i32, i32* %8
%30 = add i32 %29, -1
store i32 %30, i32* %8
br label %13
31: ; preds = %25
%32 = load i8*, i8** %7
%33 = call i32 @puts(i8* %32)
%34 = load i32, i32* %8
ret i32 %34
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hello\0AWorld\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = bitcast i8** %1 to i8*
%4 = sub i32 14, %0
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %9, %2
%7 = phi i64 [ %10, %9 ], [ %5, %2 ]
%8 = icmp eq i64 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %6
%10 = add nsw i64 %7, -1
%11 = and i64 %10, 4294967295
%12 = getelementptr inbounds i8, i8* %3, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 10
br i1 %14, label %15, label %6
15: ; preds = %9
%16 = trunc i64 %7 to i32
br label %17
17: ; preds = %6, %15
%18 = phi i32 [ %16, %15 ], [ 0, %6 ]
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 %18
}