#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*/ c2f(double *, double *);
int /*<<< orphan*/ g2p(double *, double *);
int /*<<< orphan*/ m2f(double *, double *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  int numUnits, i = 0;
  double meters, grams, celcius, valueIn, valueOut;
  unsigned char unit;
  scanf("%d", &numUnits);
  while (i < numUnits) {
    scanf("%lf %c", &valueIn, &unit);
    switch (unit) {
    case 'm':
      m2f(&valueIn, &valueOut);
      printf("%.6lf %s\n", valueOut, "ft");
      break;
    case 'g':
      g2p(&valueIn, &valueOut);
      printf("%.6lf %s\n", valueOut, "lbs");
      break;
    case 'c':
      c2f(&valueIn, &valueOut);
      printf("%.6lf %s\n", valueOut, "f");
      break;
    default:
      printf("ERROR\n");
      break;
    }
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe93(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1271 <main+0x121>
lea    0xe78(%rip),%rdi
xor    %eax,%eax
lea    -0x30(%rbp),%rsi
lea    -0x39(%rbp),%rdx
call   1060 <scanf@plt>
movzbl -0x39(%rbp),%eax
mov    %eax,-0x40(%rbp)
sub    $0x63,%eax
je     1229 <main+0xd9>
jmp    11af <main+0x5f>
mov    -0x40(%rbp),%eax
sub    $0x67,%eax
je     11fd <main+0xad>
jmp    11c0 <main+0x70>
mov    -0x40(%rbp),%eax
sub    $0x6d,%eax
jne    1255 <main+0x105>
jmp    11d1 <main+0x81>
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1070 <m2f@plt>
movsd  -0x38(%rbp),%xmm0
lea    0xe20(%rip),%rdi
lea    0xe23(%rip),%rsi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1263 <main+0x113>
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1050 <g2p@plt>
movsd  -0x38(%rbp),%xmm0
lea    0xdf4(%rip),%rdi
lea    0xdfa(%rip),%rsi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1263 <main+0x113>
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1030 <c2f@plt>
movsd  -0x38(%rbp),%xmm0
lea    0xdc8(%rip),%rdi
lea    0xdd2(%rip),%rsi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1263 <main+0x113>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1178 <main+0x28>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe8b(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    124e <main+0xee>
lea    0xe70(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0x3(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0xe61(%rip),%r13
xor    %ebp,%ebp
jmp    11db <main+0x7b>
nopl   (%rax)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <g2p@plt>
movsd  0x8(%rsp),%xmm0
mov    %r13,%rdi
lea    0xe4c(%rip),%rsi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jge    124e <main+0xee>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1070 <scanf@plt>
movzbl 0x3(%rsp),%eax
cmp    $0x63,%al
je     1220 <main+0xc0>
cmp    $0x67,%al
je     11b0 <main+0x50>
cmp    $0x6d,%al
jne    1240 <main+0xe0>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1080 <m2f@plt>
movsd  0x8(%rsp),%xmm0
mov    %r13,%rdi
lea    0xdfd(%rip),%rsi
jmp    11cb <main+0x6b>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <c2f@plt>
movsd  0x8(%rsp),%xmm0
mov    %r13,%rdi
lea    0xde0(%rip),%rsi
jmp    11cb <main+0x6b>
nopl   (%rax)
lea    0xdd6(%rip),%rdi
call   1030 <puts@plt>
jmp    11d2 <main+0x72>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%lf %c\00"
@.str.2 = [10 x i8] c"%.6lf %s\0A\00"
@.str.3 = [3 x i8] c"ft\00"
@.str.4 = [4 x i8] c"lbs\00"
@.str.5 = [2 x i8] c"f\00"
@.str.6 = [7 x i8] c"ERROR\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %3
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %11
11: ; preds = %33, %0
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %36
15: ; preds = %11
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double* %7, i8* %9)
%17 = load i8, i8* %9
%18 = zext i8 %17 to i32
switch i32 %18, label %31 [
i32 109, label %19
i32 103, label %23
i32 99, label %27
]
19: ; preds = %15
%20 = call i32 @m2f(double* %7, double* %8)
%21 = load double, double* %8
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %33
23: ; preds = %15
%24 = call i32 @g2p(double* %7, double* %8)
%25 = load double, double* %8
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %33
27: ; preds = %15
%28 = call i32 @c2f(double* %7, double* %8)
%29 = load double, double* %8
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %33
31: ; preds = %15
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %33
33: ; preds = %31, %27, %23, %19
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %11
36: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%lf %c\00"
@.str.2 = [10 x i8] c"%.6lf %s\0A\00"
@.str.3 = [3 x i8] c"ft\00"
@.str.4 = [4 x i8] c"lbs\00"
@.str.5 = [2 x i8] c"f\00"
@str = [6 x i8] c"ERROR\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca i8
%5 = bitcast i32* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %33
11: ; preds = %0, %29
%12 = phi i32 [ %30, %29 ], [ 0, %0 ]
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double* %2, i8* %4)
%14 = load i8, i8* %4
switch i8 %14, label %27 [
i8 109, label %15
i8 103, label %19
i8 99, label %23
]
15: ; preds = %11
%16 = call i32 @m2f(double* %2, double* %3)
%17 = load double, double* %3
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %29
19: ; preds = %11
%20 = call i32 @g2p(double* %2, double* %3)
%21 = load double, double* %3
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %29
23: ; preds = %11
%24 = call i32 @c2f(double* %2, double* %3)
%25 = load double, double* %3
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %29
27: ; preds = %11
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %29
29: ; preds = %27, %23, %19, %15
%30 = add nuw nsw i32 %12, 1
%31 = load i32, i32* %1
%32 = icmp slt i32 %30, %31
br i1 %32, label %11, label %33
33: ; preds = %29, %0
ret i32 0
}