#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int sscanf(char *, char *, float *);
float getTicks(void) {
  int done = 0;
  char line[256];
  float result;
  while (!done) {
    printf("Enter the number of ticks per inch: ");
    gets(line);
    if (sscanf(line, "%f", &result) == 1)
      done = 1;
  };
  return result;
}


x86 assembly (clang, -O0):
<getTicks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1158 <getTicks+0x28>
jmp    119f <getTicks+0x6f>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
lea    -0x110(%rbp),%rdi
call   1040 <gets@plt>
lea    -0x110(%rbp),%rdi
lea    0xea7(%rip),%rsi
lea    -0x114(%rbp),%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    119a <getTicks+0x6a>
movl   $0x1,-0x4(%rbp)
jmp    1142 <getTicks+0x12>
movss  -0x114(%rbp),%xmm0
ff
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTicks>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x118,%rsp
lea    0xebb(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xed4(%rip),%r15
lea    0xc(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <gets@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1160 <getTicks+0x30>
movss  0xc(%rsp),%xmm0
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Enter the number of ticks per inch: \00"
@.str.1 = [3 x i8] c"%f\00"
define float @getTicks() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca float
store i32 0, i32* %1
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %1
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%11 = call i32 @gets(i8* %10)
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%13 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %16
15: ; preds = %8
store i32 1, i32* %1
br label %16
16: ; preds = %15, %8
br label %4
17: ; preds = %4
%18 = load float, float* %3
ret float %18
}

LLVM IR (-O2):
@.str = [37 x i8] c"Enter the number of ticks per inch: \00"
@.str.1 = [3 x i8] c"%f\00"
define float @getTicks() {
%1 = alloca [256 x i8]
%2 = alloca float
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = bitcast float* %2 to i8*
br label %5
5: ; preds = %0, %5
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @gets(i8* %3)
%8 = call i32 @sscanf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %5
10: ; preds = %5
%11 = load float, float* %2
ret float %11
}