#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, float);
char *h(int x, float y, char z) {
  char *a = (char *)malloc(sizeof(char) * x + 1);
  int i;
  for (i = 0; i < x; i++) {
    y += y;
    printf("%f\n", y);
    a[i] = z;
  }
  a[i] = '\0';
  return a;
}


x86 assembly (clang, -O0):
<h>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x0,%rax
add    $0x1,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119c <h+0x7c>
movss  -0x8(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
mov    -0x9(%rbp),%dl
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1154 <h+0x34>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<h>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r15d
movss  %xmm0,0xc(%rsp)
mov    %edi,%r14d
lea    0x1(%r14),%edi
call   1040 <malloc@plt>
mov    %rax,%r12
test   %r14d,%r14d
jle    118d <h+0x6d>
mov    %r14d,%ebp
xor    %ebx,%ebx
lea    0xeab(%rip),%r14
movss  0xc(%rsp),%xmm0
nopl   0x0(%rax,%rax,1)
addss  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r14,%rdi
movss  0xc(%rsp),%xmm0
call   1030 <printf@plt>
movss  0xc(%rsp),%xmm0
mov    %r15b,(%r12,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <h+0x40>
jmp    118f <h+0x6f>
xor    %ebp,%ebp
movb   $0x0,(%r12,%rbp,1)
mov    %r12,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
define i8* @h(i32 %0, float %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca float
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %4
store float %1, float* %5
store i8 %2, i8* %6
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = mul i64 1, %10
%12 = add i64 %11, 1
%13 = trunc i64 %12 to i32
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %7
store i32 0, i32* %8
br label %16
16: ; preds = %31, %3
%17 = load i32, i32* %8
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %34
20: ; preds = %16
%21 = load float, float* %5
%22 = load float, float* %5
%23 = fadd float %22, %21
store float %23, float* %5
%24 = load float, float* %5
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %24)
%26 = load i8, i8* %6
%27 = load i8*, i8** %7
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
store i8 %26, i8* %30
br label %31
31: ; preds = %20
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %16
34: ; preds = %16
%35 = load i8*, i8** %7
%36 = load i32, i32* %8
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
store i8 0, i8* %38
%39 = load i8*, i8** %7
ret i8* %39
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i8* @h(i32 %0, float %1, i8 signext %2) {
%4 = add i32 %0, 1
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %20
8: ; preds = %3
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %16, %10 ]
%12 = phi float [ %1, %8 ], [ %13, %10 ]
%13 = fadd float %12, %12
%14 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %13)
%15 = getelementptr inbounds i8, i8* %6, i64 %11
store i8 %2, i8* %15
%16 = add nuw nsw i64 %11, 1
%17 = icmp eq i64 %16, %9
br i1 %17, label %18, label %10
18: ; preds = %10
%19 = zext i32 %0 to i64
br label %20
20: ; preds = %3, %18
%21 = phi i64 [ %19, %18 ], [ 0, %3 ]
%22 = getelementptr inbounds i8, i8* %6, i64 %21
store i8 0, i8* %22
ret i8* %6
}