#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*/ Write_number_to_7segdisplay(int);
scalar_t__ initialize_all_gpios();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ usleep(int);
void start_downcounting(int delay_value_ms) {
  int i = 9;
  if (initialize_all_gpios() < 0) {
    printf("Error: GPIO init failed !\n");
  } else {
    printf("DOWN COUNTING.......\n");
    while (1) {
      for (i = 9; i >= 0; i--) {
        Write_number_to_7segdisplay(i);
        usleep(delay_value_ms * 1000);
      }
    }
  }
}


x86 assembly (clang, -O0):
<start_downcounting>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x9,-0x8(%rbp)
mov    $0x0,%al
call   1040 <initialize_all_gpios@plt>
cmp    $0x0,%rax
jge    1174 <start_downcounting+0x34>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
jmp    11b8 <start_downcounting+0x78>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x9,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     11b3 <start_downcounting+0x73>
mov    -0x8(%rbp),%edi
call   1050 <Write_number_to_7segdisplay@plt>
imul   $0x3e8,-0x4(%rbp),%edi
call   1060 <usleep@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1187 <start_downcounting+0x47>
jmp    1180 <start_downcounting+0x40>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_downcounting>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <initialize_all_gpios@plt>
test   %rax,%rax
js     121c <start_downcounting+0xdc>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
imul   $0x3e8,%ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x9,%edi
call   1050 <Write_number_to_7segdisplay@plt>
mov    %ebx,%edi
call   1060 <usleep@plt>
mov    $0x8,%edi
call   1050 <Write_number_to_7segdisplay@plt>
mov    %ebx,%edi
call   1060 <usleep@plt>
mov    $0x7,%edi
call   1050 <Write_number_to_7segdisplay@plt>
mov    %ebx,%edi
call   1060 <usleep@plt>
mov    $0x6,%edi
call   1050 <Write_number_to_7segdisplay@plt>
mov    %ebx,%edi
call   1060 <usleep@plt>
mov    $0x5,%edi
call   1050 <Write_number_to_7segdisplay@plt>
mov    %ebx,%edi
call   1060 <usleep@plt>
mov    $0x4,%edi
call   1050 <Write_number_to_7segdisplay@plt>
mov    %ebx,%edi
call   1060 <usleep@plt>
mov    $0x3,%edi
call   1050 <Write_number_to_7segdisplay@plt>
mov    %ebx,%edi
call   1060 <usleep@plt>
mov    $0x2,%edi
call   1050 <Write_number_to_7segdisplay@plt>
mov    %ebx,%edi
call   1060 <usleep@plt>
mov    $0x1,%edi
call   1050 <Write_number_to_7segdisplay@plt>
mov    %ebx,%edi
call   1060 <usleep@plt>
xor    %edi,%edi
call   1050 <Write_number_to_7segdisplay@plt>
mov    %ebx,%edi
call   1060 <usleep@plt>
jmp    1170 <start_downcounting+0x30>
lea    0xdf2(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Error: GPIO init failed !\0A\00"
@.str.1 = [22 x i8] c"DOWN COUNTING.......\0A\00"
define void @start_downcounting(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 9, i32* %3
%4 = call i64 (...) @initialize_all_gpios()
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %24
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %23
store i32 9, i32* %3
br label %11
11: ; preds = %20, %10
%12 = load i32, i32* %3
%13 = icmp sge i32 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %11
%15 = load i32, i32* %3
%16 = call i32 @Write_number_to_7segdisplay(i32 %15)
%17 = load i32, i32* %2
%18 = mul nsw i32 %17, 1000
%19 = call i32 @usleep(i32 %18)
br label %20
20: ; preds = %14
%21 = load i32, i32* %3
%22 = add nsw i32 %21, -1
store i32 %22, i32* %3
br label %11
23: ; preds = %11
br label %10
24: ; preds = %6
ret void
}

LLVM IR (-O2):
@str = [21 x i8] c"DOWN COUNTING.......\00"
@str.2 = [26 x i8] c"Error: GPIO init failed !\00"
define void @start_downcounting(i32 %0) {
%2 = tail call i64 (...) @initialize_all_gpios()
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.2, i64 0, i64 0))
ret void
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%8 = mul nsw i32 %0, 1000
br label %9
9: ; preds = %9, %6
%10 = tail call i32 @Write_number_to_7segdisplay(i32 9)
%11 = tail call i32 @usleep(i32 %8)
%12 = tail call i32 @Write_number_to_7segdisplay(i32 8)
%13 = tail call i32 @usleep(i32 %8)
%14 = tail call i32 @Write_number_to_7segdisplay(i32 7)
%15 = tail call i32 @usleep(i32 %8)
%16 = tail call i32 @Write_number_to_7segdisplay(i32 6)
%17 = tail call i32 @usleep(i32 %8)
%18 = tail call i32 @Write_number_to_7segdisplay(i32 5)
%19 = tail call i32 @usleep(i32 %8)
%20 = tail call i32 @Write_number_to_7segdisplay(i32 4)
%21 = tail call i32 @usleep(i32 %8)
%22 = tail call i32 @Write_number_to_7segdisplay(i32 3)
%23 = tail call i32 @usleep(i32 %8)
%24 = tail call i32 @Write_number_to_7segdisplay(i32 2)
%25 = tail call i32 @usleep(i32 %8)
%26 = tail call i32 @Write_number_to_7segdisplay(i32 1)
%27 = tail call i32 @usleep(i32 %8)
%28 = tail call i32 @Write_number_to_7segdisplay(i32 0)
%29 = tail call i32 @usleep(i32 %8)
br label %9
}