#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*/ check_float(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rand_float();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main(int argc, char const *argv[]) {
  srand((unsigned)time(NULL));
  int i;
  for (int i = 0; i < 100000; i++) {
    if (!check_float(rand_float())) {
      printf("失敗\n");
      return 0;
    }
  }
  printf("成功\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x186a0,-0x18(%rbp)
jge    11cc <main+0x7c>
mov    $0x0,%al
call   1040 <rand_float@plt>
mov    %eax,%edi
call   1030 <check_float@plt>
cmp    $0x0,%eax
jne    11b9 <main+0x69>
lea    0xe58(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11df <main+0x8f>
jmp    11be <main+0x6e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117d <main+0x2d>
lea    0xe35(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    $0x186a0,%ebp
lea    0xe99(%rip),%rbx
lea    0xe8b(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1050 <rand_float@plt>
mov    %eax,%edi
call   1030 <check_float@plt>
test   %eax,%eax
je     119a <main+0x4a>
add    $0xffffffff,%ebp
jne    1180 <main+0x30>
mov    %r14,%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\E5\A4\B1\E6\95\97\0A\00"
@.str.1 = [8 x i8] c"\E6\88\90\E5\8A\9F\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i64 @time(i32* null)
%9 = trunc i64 %8 to i32
%10 = call i32 @srand(i32 %9)
store i32 0, i32* %7
br label %11
11: ; preds = %21, %2
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 100000
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = call i32 (...) @rand_float()
%16 = call i32 @check_float(i32 %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %14
%19 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %26
20: ; preds = %14
br label %21
21: ; preds = %20
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
store i32 %23, i32* %7
br label %11
24: ; preds = %11
%25 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %26
26: ; preds = %24, %18
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@str = [7 x i8] c"\E6\88\90\E5\8A\9F\00"
@str.2 = [7 x i8] c"\E5\A4\B1\E6\95\97\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @time(i32* null)
%4 = trunc i64 %3 to i32
%5 = tail call i32 @srand(i32 %4)
br label %9
6: ; preds = %9
%7 = add nuw nsw i32 %10, 1
%8 = icmp eq i32 %7, 100000
br i1 %8, label %14, label %9
9: ; preds = %2, %6
%10 = phi i32 [ 0, %2 ], [ %7, %6 ]
%11 = tail call i32 (...) @rand_float()
%12 = tail call i32 @check_float(i32 %11)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %6
14: ; preds = %6, %9
%15 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.2, i64 0, i64 0), %9 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0), %6 ]
%16 = tail call i32 @puts(i8* dereferenceable(1) %15)
ret i32 0
}