#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 */
scalar_t__ commit_queue(int);
int disp_queue();
int increment_revision();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ save_commit_message(char const *, int);
void commit_task(const char *message) {
  int fcount;
  int rev;
  printf("Committing queue...\n");
  fcount = disp_queue();
  if (fcount <= 0) {
    printf("  ERR: no files queued\n");
    return;
  }
  rev = increment_revision();
  if (commit_queue(rev) == 0) {
    printf("  commit completed\n");
    if (message != NULL)
      save_commit_message(message, rev);
  } else
    printf("  ERR: commit failed\n");
}


x86 assembly (clang, -O0):
<commit_task>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <disp_queue@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     118d <commit_task+0x3d>
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
jmp    11dd <commit_task+0x8d>
mov    $0x0,%al
call   1070 <increment_revision@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <commit_queue@plt>
cmp    $0x0,%rax
jne    11d1 <commit_task+0x81>
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
cmpq   $0x0,-0x8(%rbp)
je     11cc <commit_task+0x7c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1060 <save_commit_message@plt>
jmp    11dd <commit_task+0x8d>
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<commit_task>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <disp_queue@plt>
test   %eax,%eax
jle    118b <commit_task+0x3b>
xor    %eax,%eax
call   1070 <increment_revision@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1040 <commit_queue@plt>
test   %rax,%rax
je     119d <commit_task+0x4d>
lea    0xe8b(%rip),%rdi
jmp    1192 <commit_task+0x42>
lea    0xeaa(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <puts@plt>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
test   %rbx,%rbx
je     11be <commit_task+0x6e>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <save_commit_message@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Committing queue...\0A\00"
@.str.1 = [24 x i8] c" ERR: no files queued\0A\00"
@.str.2 = [20 x i8] c" commit completed\0A\00"
@.str.3 = [22 x i8] c" ERR: commit failed\0A\00"
define void @commit_task(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @disp_queue()
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %27
11: ; preds = %1
%12 = call i32 (...) @increment_revision()
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = call i64 @commit_queue(i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %11
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%18 = load i8*, i8** %2
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i8*, i8** %2
%22 = load i32, i32* %4
%23 = call i32 @save_commit_message(i8* %21, i32 %22)
br label %24
24: ; preds = %20, %16
br label %27
25: ; preds = %11
%26 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %9, %25, %24
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c"Committing queue...\00"
@str.4 = [21 x i8] c" ERR: commit failed\00"
@str.5 = [19 x i8] c" commit completed\00"
@str.6 = [23 x i8] c" ERR: no files queued\00"
define void @commit_task(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @disp_queue()
%4 = icmp slt i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.6, i64 0, i64 0))
br label %18
7: ; preds = %1
%8 = tail call i32 (...) @increment_revision()
%9 = tail call i64 @commit_queue(i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.5, i64 0, i64 0))
%13 = icmp eq i8* %0, null
br i1 %13, label %18, label %14
14: ; preds = %11
%15 = tail call i32 @save_commit_message(i8* %0, i32 %8)
br label %18
16: ; preds = %7
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.4, i64 0, i64 0))
br label %18
18: ; preds = %16, %14, %11, %5
ret void
}