#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 foo(int, int);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  int i;
  int list[] = {0, 2, 4, 6, 8};
  const char *str = "Hello";
  const char *p = str + 6;
  struct Car {
    unsigned int year;
    unsigned int mileage;
    struct Engine {
      int MPG;
      float displacement;
    } engine;
  } car;
  car.year = 2014;
  car.mileage = 888;
  car.engine.MPG = 30;
  car.engine.displacement = 3.3;
  printf("car: year:%d, disp.:%2.1f\n", car.year, car.engine.displacement);
  for (i = list[0]; i < argc; ++i)
    printf("arg[%i]=%s\n", i, argv[i]);
  sleep(argc);
  i = foo(argc, 2);
  printf("hello :%d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebe(%rip),%eax
mov    %eax,-0x20(%rbp)
lea    0xeb8(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x40(%rbp)
movl   $0x7de,-0x50(%rbp)
movl   $0x378,-0x4c(%rbp)
movl   $0x1e,-0x48(%rbp)
movss  0xe67(%rip),%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x50(%rbp),%esi
movss  -0x44(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe79(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f5 <main+0xc5>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11be <main+0x8e>
mov    -0x8(%rbp),%edi
call   1050 <sleep@plt>
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1040 <foo@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %edi,%r14d
lea    0xec3(%rip),%rdi
movsd  0xeb3(%rip),%xmm0
mov    $0x7de,%esi
mov    $0x1,%al
call   1030 <printf@plt>
test   %r14d,%r14d
jle    1189 <main+0x59>
mov    %r14d,%ebx
lea    0xebb(%rip),%r15
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%r12,%rbp,8),%rdx
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1170 <main+0x40>
mov    %r14d,%edi
call   1050 <sleep@plt>
mov    %r14d,%edi
mov    $0x2,%esi
call   1040 <foo@plt>
lea    0xe8a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.Car = type { i32, i32, %struct.Engine }
%struct.Engine = type { i32, float }
@__const.main.list = [5 x i32] [i32 0, i32 2, i32 4, i32 6, i32 8]
@.str = [6 x i8] c"Hello\00"
@.str.1 = [27 x i8] c"car: year:%d, disp.:%2.1f\0A\00"
@.str.2 = [12 x i8] c"arg[%i]=%s\0A\00"
@.str.3 = [11 x i8] c"hello :%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [5 x i32]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca %struct.Car
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [5 x i32]* %7 to i8*
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %8
%12 = load i8*, i8** %8
%13 = getelementptr inbounds i8, i8* %12, i64 6
store i8* %13, i8** %9
%14 = getelementptr inbounds %struct.Car, %struct.Car* %10, i32 0, i32 0
store i32 2014, i32* %14
%15 = getelementptr inbounds %struct.Car, %struct.Car* %10, i32 0, i32 1
store i32 888, i32* %15
%16 = getelementptr inbounds %struct.Car, %struct.Car* %10, i32 0, i32 2
%17 = getelementptr inbounds %struct.Engine, %struct.Engine* %16, i32 0, i32 0
store i32 30, i32* %17
%18 = getelementptr inbounds %struct.Car, %struct.Car* %10, i32 0, i32 2
%19 = getelementptr inbounds %struct.Engine, %struct.Engine* %18, i32 0, i32 1
store float 0x400A666660000000, float* %19
%20 = getelementptr inbounds %struct.Car, %struct.Car* %10, i32 0, i32 0
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.Car, %struct.Car* %10, i32 0, i32 2
%23 = getelementptr inbounds %struct.Engine, %struct.Engine* %22, i32 0, i32 1
%24 = load float, float* %23
%25 = fpext float %24 to double
%26 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %21, double %25)
%27 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 0
%28 = load i32, i32* %27
store i32 %28, i32* %6
br label %29
29: ; preds = %41, %2
%30 = load i32, i32* %6
%31 = load i32, i32* %4
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %44
33: ; preds = %29
%34 = load i32, i32* %6
%35 = load i8**, i8*** %5
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %35, i64 %37
%39 = load i8*, i8** %38
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %34, i8* %39)
br label %41
41: ; preds = %33
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
br label %29
44: ; preds = %29
%45 = load i32, i32* %4
%46 = call i32 @sleep(i32 %45)
%47 = load i32, i32* %4
%48 = call i32 @foo(i32 %47, i32 2)
store i32 %48, i32* %6
%49 = load i32, i32* %6
%50 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %49)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [27 x i8] c"car: year:%d, disp.:%2.1f\0A\00"
@.str.2 = [12 x i8] c"arg[%i]=%s\0A\00"
@.str.3 = [11 x i8] c"hello :%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 2014, double 0x400A666660000000)
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %15
5: ; preds = %2
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %13, %7 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = trunc i64 %8 to i32
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %11, i8* %10)
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %15, label %7
15: ; preds = %7, %2
%16 = tail call i32 @sleep(i32 %0)
%17 = tail call i32 @foo(i32 %0, i32 2)
%18 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %17)
ret i32 0
}