#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 bugs = 100;
  double bug_rate = 1.2;
  printf("You have %d bugs at the imaginary rate of %f.\n", bugs, bug_rate);
  long universe_of_defects = 1L * 1024L * 1024L * 1024L * 1024L * 1024L * 1024;
  unsigned long too_big = universe_of_defects;
  too_big *= 1023;
  printf("Too big: %lu \n", too_big);
  printf("The entire universe has %ld bugs.\n", universe_of_defects);
  printf("The entire universe has %.10e bugs.\n", (double)universe_of_defects);
  double expected_bugs = bugs * bug_rate;
  printf("You are expected to have %f bugs. \n", expected_bugs);
  double part_of_universe = expected_bugs / universe_of_defects;
  printf("That is only a %e portion of the universe.\n", part_of_universe);
  char nul_byte = '\0';
  int care_percentage = bugs * nul_byte;
  printf("Which means you should care %d%%.\n", care_percentage);
  printf("\nPrinting out that nul_byte variable too with %%c and %%s.: \n");
  printf("Nulbyte with %%c = %c\n", nul_byte);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
movsd  0xed2(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
lea    0xec6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movabs $0x1000000000000000,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
imul   $0x3ff,-0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2sdq -0x18(%rbp),%xmm0
lea    0xecd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xed0(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
cvtsi2sdq -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xecd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movb   $0x0,-0x31(%rbp)
mov    -0x8(%rbp),%eax
movsbl -0x31(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%esi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x31(%rbp),%esi
lea    0xf18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf08(%rip),%rdi
movsd  0xee0(%rip),%xmm0
mov    $0x64,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf1c(%rip),%rdi
movabs $0xf000000000000000,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf13(%rip),%rdi
movabs $0x1000000000000000,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf1e(%rip),%rdi
movsd  0xe9d(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf2d(%rip),%rdi
movsd  0xe8f(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf3b(%rip),%rdi
movsd  0xe81(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf51(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf64(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf94(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"You have %d bugs at the imaginary rate of %f.\0A\00"
@.str.1 = [15 x i8] c"Too big: %lu \0A\00"
@.str.2 = [35 x i8] c"The entire universe has %ld bugs.\0A\00"
@.str.3 = [37 x i8] c"The entire universe has %.10e bugs.\0A\00"
@.str.4 = [36 x i8] c"You are expected to have %f bugs. \0A\00"
@.str.5 = [44 x i8] c"That is only a %e portion of the universe.\0A\00"
@.str.6 = [35 x i8] c"Which means you should care %d%%.\0A\00"
@.str.7 = [62 x i8] c"\0APrinting out that nul_byte variable too with %%c and %%s.: \0A\00"
@.str.8 = [23 x i8] c"Nulbyte with %%c = %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca i64
%5 = alloca i64
%6 = alloca double
%7 = alloca double
%8 = alloca i8
%9 = alloca i32
store i32 0, i32* %1
store i32 100, i32* %2
store double 1.200000e+00, double* %3
%10 = load i32, i32* %2
%11 = load double, double* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %10, double %11)
store i64 1152921504606846976, i64* %4
%13 = load i64, i64* %4
store i64 %13, i64* %5
%14 = load i64, i64* %5
%15 = mul i64 %14, 1023
store i64 %15, i64* %5
%16 = load i64, i64* %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i64 %16)
%18 = load i64, i64* %4
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i64 %18)
%20 = load i64, i64* %4
%21 = sitofp i64 %20 to double
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), double %21)
%23 = load i32, i32* %2
%24 = sitofp i32 %23 to double
%25 = load double, double* %3
%26 = fmul double %24, %25
store double %26, double* %6
%27 = load double, double* %6
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), double %27)
%29 = load double, double* %6
%30 = load i64, i64* %4
%31 = sitofp i64 %30 to double
%32 = fdiv double %29, %31
store double %32, double* %7
%33 = load double, double* %7
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), double %33)
store i8 0, i8* %8
%35 = load i32, i32* %2
%36 = load i8, i8* %8
%37 = sext i8 %36 to i32
%38 = mul nsw i32 %35, %37
store i32 %38, i32* %9
%39 = load i32, i32* %9
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i32 %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.7, i64 0, i64 0))
%42 = load i8, i8* %8
%43 = sext i8 %42 to i32
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 %43)
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"You have %d bugs at the imaginary rate of %f.\0A\00"
@.str.1 = [15 x i8] c"Too big: %lu \0A\00"
@.str.2 = [35 x i8] c"The entire universe has %ld bugs.\0A\00"
@.str.3 = [37 x i8] c"The entire universe has %.10e bugs.\0A\00"
@.str.4 = [36 x i8] c"You are expected to have %f bugs. \0A\00"
@.str.5 = [44 x i8] c"That is only a %e portion of the universe.\0A\00"
@.str.6 = [35 x i8] c"Which means you should care %d%%.\0A\00"
@.str.7 = [62 x i8] c"\0APrinting out that nul_byte variable too with %%c and %%s.: \0A\00"
@.str.8 = [23 x i8] c"Nulbyte with %%c = %c\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 100, double 1.200000e+00)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i64 -1152921504606846976)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i64 1152921504606846976)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), double 0x43B0000000000000)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), double 1.200000e+02)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), double 0x3C9E000000000000)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i32 0)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.7, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 0)
ret i32 0
}