#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*/ sprintf(char *, char *, int);
int system(char *);
int run_tests(int secs) {
  int ret;
  char buf[255];
  sprintf(buf, "./inconsistency-check -t %i", secs);
  ret = system(buf);
  if (ret)
    return ret;
  ret = system("./nanosleep");
  return ret;
}


x86 assembly (clang, -O0):
<run_tests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xec1(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x110(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1168 <run_tests+0x48>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117d <run_tests+0x5d>
lea    0xead(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_tests>:
push   %rbx
sub    $0x100,%rsp
mov    %edi,%edx
lea    0xecf(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
test   %eax,%eax
je     1151 <run_tests+0x31>
add    $0x100,%rsp
pop    %rbx
ret
lea    0xec4(%rip),%rdi
add    $0x100,%rsp
pop    %rbx
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"./inconsistency-check -t %i\00"
@.str.1 = [12 x i8] c"./nanosleep\00"
define i32 @run_tests(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [255 x i8]
store i32 %0, i32* %3
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%10 = call i32 @system(i8* %9)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %1
%14 = load i32, i32* %4
store i32 %14, i32* %2
br label %18
15: ; preds = %1
%16 = call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i32 %16, i32* %4
%17 = load i32, i32* %4
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %13
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [28 x i8] c"./inconsistency-check -t %i\00"
@.str.1 = [12 x i8] c"./nanosleep\00"
define i32 @run_tests(i32 %0) {
%2 = alloca [255 x i8]
%3 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = call i32 @system(i8* %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %1, %7
%10 = phi i32 [ %8, %7 ], [ %5, %1 ]
ret i32 %10
}