#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 setConfigTextValue(char *, char *);
int setDbVersion(int);
int upgrade4() {
  int status = setDbVersion(4);
  if (status == 0) {
    return 0;
  }
  status = setConfigTextValue("web.server_name", "");
  if (status == 0) {
    return 0;
  }
  status = setConfigTextValue("web.colour_dl", "#ff0000");
  if (status == 0) {
    return 0;
  }
  status = setConfigTextValue("web.colour_ul", "#00ff00");
  if (status == 0) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<upgrade4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1030 <setDbVersion@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    114b <upgrade4+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <upgrade4+0xb6>
lea    0xeae(%rip),%rdi
lea    0xecc(%rip),%rsi
call   1040 <setConfigTextValue@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1177 <upgrade4+0x57>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <upgrade4+0xb6>
lea    0xe92(%rip),%rdi
lea    0xe99(%rip),%rsi
call   1040 <setConfigTextValue@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11a3 <upgrade4+0x83>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <upgrade4+0xb6>
lea    0xe7c(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1040 <setConfigTextValue@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11cf <upgrade4+0xaf>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <upgrade4+0xb6>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<upgrade4>:
push   %rbx
mov    $0x4,%edi
call   1030 <setDbVersion@plt>
xor    %ebx,%ebx
test   %eax,%eax
je     1179 <upgrade4+0x59>
lea    0xec8(%rip),%rdi
lea    0xee6(%rip),%rsi
call   1040 <setConfigTextValue@plt>
test   %eax,%eax
je     1179 <upgrade4+0x59>
lea    0xec1(%rip),%rdi
lea    0xec8(%rip),%rsi
call   1040 <setConfigTextValue@plt>
test   %eax,%eax
je     1179 <upgrade4+0x59>
lea    0xec0(%rip),%rdi
lea    0xec7(%rip),%rsi
call   1040 <setConfigTextValue@plt>
xor    %ebx,%ebx
test   %eax,%eax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"web.server_name\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [14 x i8] c"web.colour_dl\00"
@.str.3 = [8 x i8] c"#ff0000\00"
@.str.4 = [14 x i8] c"web.colour_ul\00"
@.str.5 = [8 x i8] c"ff00\00"
define i32 @upgrade4() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @setDbVersion(i32 4)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 0, i32* %1
br label %23
7: ; preds = %0
%8 = call i32 @setConfigTextValue(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 0, i32* %1
br label %23
12: ; preds = %7
%13 = call i32 @setConfigTextValue(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 0, i32* %1
br label %23
17: ; preds = %12
%18 = call i32 @setConfigTextValue(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 0, i32* %1
br label %23
22: ; preds = %17
store i32 1, i32* %1
br label %23
23: ; preds = %22, %21, %16, %11, %6
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str = [16 x i8] c"web.server_name\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [14 x i8] c"web.colour_dl\00"
@.str.3 = [8 x i8] c"#ff0000\00"
@.str.4 = [14 x i8] c"web.colour_ul\00"
@.str.5 = [8 x i8] c"ff00\00"
define i32 @upgrade4() {
%1 = tail call i32 @setDbVersion(i32 4)
%2 = icmp eq i32 %1, 0
br i1 %2, label %13, label %3
3: ; preds = %0
%4 = tail call i32 @setConfigTextValue(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = tail call i32 @setConfigTextValue(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = tail call i32 @setConfigTextValue(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %9, %6, %3, %0
%14 = phi i32 [ 0, %0 ], [ 0, %3 ], [ 0, %6 ], [ %12, %9 ]
ret i32 %14
}