#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 *, char *, double);
int /*<<< orphan*/ scanf(char *, char *, double *, double *);
void recipe(int ingredients, double scale) {
  char names[ingredients][21];
  double percentage[ingredients];
  double migs = -1;
  for (int i = 0; i < ingredients; i++) {
    double g;
    scanf("%s %lf %lf", names[i], &g, percentage + i);
    if (percentage[i] == 100.0)
      migs = g * scale;
    percentage[i] /= 100.0;
  }
  for (int i = 0; i < ingredients; i++)
    printf("%s %.1lf\n", names[i], migs * percentage[i]);
}


x86 assembly (clang, -O0):
<recipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    (%rax,%rax,4),%rcx
lea    0xf(%rax,%rcx,4),%rdx
movabs $0x3ffffffff0,%rcx
and    %rcx,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movsd  0xe77(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    122f <recipe+0x10f>
mov    -0x50(%rbp),%rcx
mov    -0x58(%rbp),%rsi
movslq -0x34(%rbp),%rax
imul   $0x15,%rax,%rax
add    %rax,%rsi
movslq -0x34(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
lea    0xe4a(%rip),%rdi
lea    -0x40(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x50(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xe24(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1203 <recipe+0xe3>
jp     1203 <recipe+0xe3>
movsd  -0x40(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x50(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xdf0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1195 <recipe+0x75>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    127d <recipe+0x15d>
mov    -0x50(%rbp),%rax
mov    -0x58(%rbp),%rsi
movslq -0x44(%rbp),%rcx
imul   $0x15,%rcx,%rcx
add    %rcx,%rsi
movsd  -0x30(%rbp),%xmm0
movslq -0x44(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
lea    0xdb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1236 <recipe+0x116>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recipe>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %edi,%r12d
lea    (%r12,%r12,4),%rax
lea    (%r12,%rax,4),%rax
add    $0xf,%rax
movabs $0x3ffffffff0,%rcx
and    %rax,%rcx
mov    %rsp,%r13
sub    %rcx,%r13
mov    %r13,%rsp
mov    %rsp,%r15
lea    0xf(,%r12,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
test   %edi,%edi
jle    123c <recipe+0x11c>
mov    %edi,-0x2c(%rbp)
movsd  0xe82(%rip),%xmm2
mov    %r12,-0x48(%rbp)
mov    %r13,%rbx
mov    %r15,%r14
movsd  %xmm0,-0x50(%rbp)
nopl   (%rax)
movapd %xmm2,-0x40(%rbp)
lea    0xe74(%rip),%rdi
mov    %rbx,%rsi
lea    -0x58(%rbp),%rdx
mov    %r14,%rcx
call   1040 <scanf@plt>
movsd  -0x50(%rbp),%xmm0
movsd  (%r14),%xmm3
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm3,%xmm2
movsd  0xe3e(%rip),%xmm4
cmpeqsd %xmm4,%xmm2
andpd  %xmm2,%xmm1
andnpd -0x40(%rbp),%xmm2
orpd   %xmm1,%xmm2
divsd  %xmm4,%xmm3
movsd  %xmm3,(%r14)
add    $0x8,%r14
add    $0x15,%rbx
add    $0xffffffffffffffff,%r12
jne    1190 <recipe+0x70>
cmpl   $0x0,-0x2c(%rbp)
mov    -0x48(%rbp),%r12
jle    123c <recipe+0x11c>
xor    %ebx,%ebx
lea    0xe15(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
movapd %xmm2,-0x40(%rbp)
movsd  (%r15,%rbx,8),%xmm0
mulsd  %xmm2,%xmm0
mov    %r14,%rdi
mov    %r13,%rsi
call   1030 <printf@plt>
movapd -0x40(%rbp),%xmm2
add    $0x1,%rbx
add    $0x15,%r13
cmp    %rbx,%r12
jne    1210 <recipe+0xf0>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%s %lf %lf\00"
@.str.1 = [10 x i8] c"%s %.1lf\0A\00"
define void @recipe(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca double
%9 = alloca i32
%10 = alloca double
%11 = alloca i32
store i32 %0, i32* %3
store double %1, double* %4
%12 = load i32, i32* %3
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %5
%15 = alloca [21 x i8], i64 %13
store i64 %13, i64* %6
%16 = load i32, i32* %3
%17 = zext i32 %16 to i64
%18 = alloca double, i64 %17
store i64 %17, i64* %7
store double -1.000000e+00, double* %8
store i32 0, i32* %9
br label %19
19: ; preds = %47, %2
%20 = load i32, i32* %9
%21 = load i32, i32* %3
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %50
23: ; preds = %19
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [21 x i8], [21 x i8]* %15, i64 %25
%27 = getelementptr inbounds [21 x i8], [21 x i8]* %26, i64 0, i64 0
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %18, i64 %29
%31 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %27, double* %10, double* %30)
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %18, i64 %33
%35 = load double, double* %34
%36 = fcmp oeq double %35, 1.000000e+02
br i1 %36, label %37, label %41
37: ; preds = %23
%38 = load double, double* %10
%39 = load double, double* %4
%40 = fmul double %38, %39
store double %40, double* %8
br label %41
41: ; preds = %37, %23
%42 = load i32, i32* %9
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %18, i64 %43
%45 = load double, double* %44
%46 = fdiv double %45, 1.000000e+02
store double %46, double* %44
br label %47
47: ; preds = %41
%48 = load i32, i32* %9
%49 = add nsw i32 %48, 1
store i32 %49, i32* %9
br label %19
50: ; preds = %19
store i32 0, i32* %11
br label %51
51: ; preds = %67, %50
%52 = load i32, i32* %11
%53 = load i32, i32* %3
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %70
55: ; preds = %51
%56 = load i32, i32* %11
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [21 x i8], [21 x i8]* %15, i64 %57
%59 = getelementptr inbounds [21 x i8], [21 x i8]* %58, i64 0, i64 0
%60 = load double, double* %8
%61 = load i32, i32* %11
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %18, i64 %62
%64 = load double, double* %63
%65 = fmul double %60, %64
%66 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %59, double %65)
br label %67
67: ; preds = %55
%68 = load i32, i32* %11
%69 = add nsw i32 %68, 1
store i32 %69, i32* %11
br label %51
70: ; preds = %51
%71 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s %lf %lf\00"
@.str.1 = [10 x i8] c"%s %.1lf\0A\00"
define void @recipe(i32 %0, double %1) {
%3 = alloca double
%4 = zext i32 %0 to i64
%5 = alloca [21 x i8], i64 %4
%6 = alloca double, i64 %4
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %25
8: ; preds = %2
%9 = bitcast double* %3 to i8*
br label %11
10: ; preds = %11
br i1 %7, label %26, label %25
11: ; preds = %8, %11
%12 = phi i64 [ 0, %8 ], [ %23, %11 ]
%13 = phi double [ -1.000000e+00, %8 ], [ %21, %11 ]
%14 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 %12, i64 0
%15 = getelementptr inbounds double, double* %6, i64 %12
%16 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %14, double* %3, double* %15)
%17 = load double, double* %15
%18 = fcmp oeq double %17, 1.000000e+02
%19 = load double, double* %3
%20 = fmul double %19, %1
%21 = select i1 %18, double %20, double %13
%22 = fdiv double %17, 1.000000e+02
store double %22, double* %15
%23 = add nuw nsw i64 %12, 1
%24 = icmp eq i64 %23, %4
br i1 %24, label %10, label %11
25: ; preds = %26, %2, %10
ret void
26: ; preds = %10, %26
%27 = phi i64 [ %33, %26 ], [ 0, %10 ]
%28 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 %27, i64 0
%29 = getelementptr inbounds double, double* %6, i64 %27
%30 = load double, double* %29
%31 = fmul double %21, %30
%32 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %28, double %31)
%33 = add nuw nsw i64 %27, 1
%34 = icmp eq i64 %33, %4
br i1 %34, label %25, label %26
}