#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 countlength(unsigned long);
int /*<<< orphan*/ myitoaa(unsigned long, char *);
int mystrlen(char *);
int /*<<< orphan*/ write(int, char *, int);
void getminute(unsigned long minute) {
  int len = countlength(minute);
  char top[len + 1];
  myitoaa(minute, top);
  if (minute == 0) {
    write(1, "00 ", 3);
    return;
  }
  if (len == 1) {
    write(1, "0", 1);
  }
  write(1, top, mystrlen(top));
  write(1, " ", 1);
}


x86 assembly (clang, -O0):
<getminute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <countlength@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x30(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <myitoaa@plt>
cmpq   $0x0,-0x8(%rbp)
jne    11b7 <getminute+0x77>
mov    $0x1,%edi
lea    0xe5f(%rip),%rsi
mov    $0x3,%edx
call   1030 <write@plt>
movl   $0x1,-0x24(%rbp)
jmp    1207 <getminute+0xc7>
cmpl   $0x1,-0xc(%rbp)
jne    11d4 <getminute+0x94>
mov    $0x1,%edx
lea    0xe37(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    -0x30(%rbp),%rdi
call   1050 <mystrlen@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edx
lea    0xe09(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getminute>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1060 <countlength@plt>
mov    %eax,%r14d
lea    0x1(%r14),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <myitoaa@plt>
test   %r15,%r15
je     11c0 <getminute+0x80>
cmp    $0x1,%r14d
jne    1196 <getminute+0x56>
lea    0xe7d(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %rbx,%rdi
call   1050 <mystrlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xe4e(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
jmp    11d1 <getminute+0x91>
lea    0xe39(%rip),%rsi
mov    $0x1,%edi
mov    $0x3,%edx
call   1030 <write@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"00 \00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c" \00"
define void @getminute(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i64 %0, i64* %2
%7 = load i64, i64* %2
%8 = call i32 @countlength(i64 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %4
%13 = alloca i8, i64 %11
store i64 %11, i64* %5
%14 = load i64, i64* %2
%15 = call i32 @myitoaa(i64 %14, i8* %13)
%16 = load i64, i64* %2
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %1
%19 = call i32 @write(i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
store i32 1, i32* %6
br label %29
20: ; preds = %1
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %25
25: ; preds = %23, %20
%26 = call i32 @mystrlen(i8* %13)
%27 = call i32 @write(i32 1, i8* %13, i32 %26)
%28 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
store i32 0, i32* %6
br label %29
29: ; preds = %25, %18
%30 = load i8*, i8** %4
%31 = load i32, i32* %6
switch i32 %31, label %33 [
i32 0, label %32
i32 1, label %32
]
32: ; preds = %29, %29
ret void
33: ; preds = %29
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"00 \00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c" \00"
define void @getminute(i64 %0) {
%2 = tail call i32 @countlength(i64 %0)
%3 = add nsw i32 %2, 1
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = call i32 @myitoaa(i64 %0, i8* %5)
%7 = icmp eq i64 %0, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @write(i32 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
br label %18
10: ; preds = %1
%11 = icmp eq i32 %2, 1
br i1 %11, label %12, label %14
12: ; preds = %10
%13 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %14
14: ; preds = %12, %10
%15 = call i32 @mystrlen(i8* %5)
%16 = call i32 @write(i32 1, i8* %5, i32 %15)
%17 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %18
18: ; preds = %14, %8
ret void
}