#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 EXIT_SUCCESS;
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strlen(char *);
int strncmp(char *, char *, int /*<<< orphan*/);
float strtof(char *, int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  char buffer[0x20];
  char *exitword = "stop";
  float celsius, fahrenheit;
  while (0x01) {
    memset(buffer, 0x00, 0x20);
    printf("\n");
    printf("Type 'stop' at any point to exit the program.");
    printf("\n");
    printf("Please input a temperature in Celsius (type '%s' to stop): ",
           exitword);
    if (fgets(buffer, 0x20 - 0x01, stdin) == NULL) {
      fprintf(stderr, "Unable to read user input\n");
      fprintf(stderr, "Please try again\n");
      continue;
    }
    if (strncmp(buffer, exitword, strlen(exitword)) == 0x00) {
      printf("Good bye!\n");
      printf("\n");
      break;
    }
    if ((celsius = strtof(buffer, NULL)) == 0) {
      fprintf(stderr,
              "Unable to convert user input to floating point number.\n");
      fprintf(stderr, "Please try again,\n");
      continue;
    }
    fahrenheit = (1.8 * celsius) + 32;
    printf("temperature in Fahrenheit: %f\n", fahrenheit);
  }
  return EXIT_SUCCESS;
}


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)
lea    0xe83(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1070 <memset@plt>
lea    0xf0d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    0x2e00(%rip),%rax
mov    (%rax),%edx
mov    $0x1f,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    122d <main+0xbd>
mov    0x2dd3(%rip),%rax
mov    (%rax),%edi
lea    0xe71(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
lea    0xe77(%rip),%rsi
call   1090 <fprintf@plt>
jmp    1191 <main+0x21>
lea    -0x30(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    127f <main+0x10f>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1318 <main+0x1a8>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <strtof@plt>
movss  %xmm0,-0x3c(%rbp)
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    12d2 <main+0x162>
jp     12d2 <main+0x162>
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
lea    0xe04(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2d19(%rip),%rax
mov    (%rax),%edi
lea    0xe27(%rip),%rsi
call   1090 <fprintf@plt>
jmp    1191 <main+0x21>
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd1d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd19(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf6(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    1191 <main+0x21>
mov    0x2cb1(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsp,%rbx
lea    0xe71(%rip),%r14
lea    0xe98(%rip),%r15
lea    0xe5e(%rip),%r12
mov    0x2e2b(%rip),%r13
mov    0x2e14(%rip),%rbp
jmp    11ee <main+0x5e>
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%rbp),%edi
lea    0xea9(%rip),%rsi
call   10b0 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xeb5(%rip),%rsi
call   10b0 <fprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1090 <memset@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x1f,%esi
call   10a0 <fgets@plt>
test   %rax,%rax
je     11d0 <main+0x40>
mov    %r12,%rdi
call   1060 <strlen@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     12bf <main+0x12f>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <strtof@plt>
ucomiss 0xda8(%rip),%xmm0
jne    1290 <main+0x100>
jp     1290 <main+0x100>
mov    0x0(%rbp),%edi
lea    0xe3a(%rip),%rsi
call   10b0 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xe63(%rip),%rsi
call   10b0 <fprintf@plt>
jmp    11ee <main+0x5e>
nop
cvtss2sd %xmm0,%xmm0
mulsd  0xd64(%rip),%xmm0
addsd  0xd64(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe48(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
jmp    11ee <main+0x5e>
lea    0xe54(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2cf4(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"stop\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [46 x i8] c"Type 'stop' at any point to exit the program.\00"
@.str.3 = [60 x i8] c"Please input a temperature in Celsius (type '%s' to stop): \00"
@stdin = global i32 0
@stderr = global i32 0
@.str.4 = [27 x i8] c"Unable to read user input\0A\00"
@.str.5 = [18 x i8] c"Please try again\0A\00"
@.str.6 = [11 x i8] c"Good bye!\0A\00"
@.str.7 = [56 x i8] c"Unable to convert user input to floating point number.\0A\00"
@.str.8 = [19 x i8] c"Please try again,\0A\00"
@.str.9 = [31 x i8] c"temperature in Fahrenheit: %f\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [32 x i8]
%7 = alloca i8*
%8 = alloca float
%9 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %7
br label %10
10: ; preds = %2, %22, %41, %46
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%12 = call i32 @memset(i8* %11, i32 0, i32 32)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = load i8*, i8** %7
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%19 = load i32, i32* @stdin
%20 = call i32* @fgets(i8* %18, i32 31, i32 %19)
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %27
22: ; preds = %10
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %10
27: ; preds = %10
%28 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%29 = load i8*, i8** %7
%30 = load i8*, i8** %7
%31 = call i32 @strlen(i8* %30)
%32 = call i32 @strncmp(i8* %28, i8* %29, i32 %31)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %27
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %54
37: ; preds = %27
%38 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%39 = call float @strtof(i8* %38, i32* null)
store float %39, float* %8
%40 = fcmp oeq float %39, 0.000000e+00
br i1 %40, label %41, label %46
41: ; preds = %37
%42 = load i32, i32* @stderr
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0))
%44 = load i32, i32* @stderr
%45 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
br label %10
46: ; preds = %37
%47 = load float, float* %8
%48 = fpext float %47 to double
%49 = call double @llvm.fmuladd.f64(double 1.800000e+00, double %48, double 3.200000e+01)
%50 = fptrunc double %49 to float
store float %50, float* %9
%51 = load float, float* %9
%52 = fpext float %51 to double
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), double %52)
br label %10
54: ; preds = %34
%55 = load i32, i32* @EXIT_SUCCESS
ret i32 %55
}

LLVM IR (-O2):
@.str = [5 x i8] c"stop\00"
@.str.2 = [46 x i8] c"Type 'stop' at any point to exit the program.\00"
@.str.3 = [60 x i8] c"Please input a temperature in Celsius (type '%s' to stop): \00"
@stdin = global i32 0
@stderr = global i32 0
@.str.4 = [27 x i8] c"Unable to read user input\0A\00"
@.str.5 = [18 x i8] c"Please try again\0A\00"
@.str.7 = [56 x i8] c"Unable to convert user input to floating point number.\0A\00"
@.str.8 = [19 x i8] c"Please try again,\0A\00"
@.str.9 = [31 x i8] c"temperature in Fahrenheit: %f\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [10 x i8] c"Good bye!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %19, %2
%6 = call i32 @memset(i8* %4, i32 0, i32 32)
%7 = call i32 @putchar(i32 10)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @putchar(i32 10)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @stdin
%12 = call i32* @fgets(i8* %4, i32 31, i32 %11)
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %20
14: ; preds = %5
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %19
19: ; preds = %14, %31, %36
br label %5
20: ; preds = %5
%21 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%26 = call i32 @putchar(i32 10)
%27 = load i32, i32* @EXIT_SUCCESS
ret i32 %27
28: ; preds = %20
%29 = call float @strtof(i8* nocapture %4, i32* null)
%30 = fcmp oeq float %29, 0.000000e+00
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0))
%34 = load i32, i32* @stderr
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
br label %19
36: ; preds = %28
%37 = fpext float %29 to double
%38 = call double @llvm.fmuladd.f64(double %37, double 1.800000e+00, double 3.200000e+01)
%39 = fptrunc double %38 to float
%40 = fpext float %39 to double
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), double %40)
br label %19
}