#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*/ exit(int);
int *plusOne(int *, int, int *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int h1[] = {9};
  int h2[] = {8};
  int x;
  int *r1 = plusOne(h1, 1, &x);
  if (!(x == 2)) {
    printf("assert fail: %s\n", "carry");
    exit(-1);
  };
  if (!(r1[0] == 1)) {
    printf("assert fail: %s\n", "r1[0]");
    exit(-1);
  };
  if (!(r1[1] == 0)) {
    printf("assert fail: %s\n", "r1[1]");
    exit(-1);
  };
  printf("everything is fine!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb4(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    0xeaf(%rip),%eax
mov    %eax,-0x18(%rbp)
lea    -0x14(%rbp),%rdi
mov    $0x1,%esi
lea    -0x1c(%rbp),%rdx
call   1040 <plusOne@plt>
mov    %rax,-0x28(%rbp)
cmpl   $0x2,-0x1c(%rbp)
je     1197 <main+0x67>
lea    0xe89(%rip),%rdi
lea    0xe93(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x28(%rbp),%rax
cmpl   $0x1,(%rax)
je     11c3 <main+0x93>
lea    0xe5d(%rip),%rdi
lea    0xe6d(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x28(%rbp),%rax
cmpl   $0x0,0x4(%rax)
je     11f0 <main+0xc0>
lea    0xe30(%rip),%rdi
lea    0xe46(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x9,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rdx
mov    $0x1,%esi
call   1050 <plusOne@plt>
cmpl   $0x2,(%rsp)
jne    117c <main+0x3c>
cmpl   $0x1,(%rax)
jne    118c <main+0x4c>
cmpl   $0x0,0x4(%rax)
jne    119c <main+0x5c>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe7d(%rip),%rdi
lea    0xe87(%rip),%rsi
jmp    11aa <main+0x6a>
lea    0xe6d(%rip),%rdi
lea    0xe7d(%rip),%rsi
jmp    11aa <main+0x6a>
lea    0xe5d(%rip),%rdi
lea    0xe73(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@__const.main.h1 = [1 x i32] [i32 9]
@__const.main.h2 = [1 x i32] [i32 8]
@.str = [17 x i8] c"assert fail: %s\0A\00"
@.str.1 = [6 x i8] c"carry\00"
@.str.2 = [6 x i8] c"r1[0]\00"
@.str.3 = [6 x i8] c"r1[1]\00"
@.str.4 = [21 x i8] c"everything is fine!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1 x i32]
%7 = alloca [1 x i32]
%8 = alloca i32
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [1 x i32]* %6 to i8*
%11 = bitcast [1 x i32]* %7 to i8*
%12 = getelementptr inbounds [1 x i32], [1 x i32]* %6, i64 0, i64 0
%13 = call i32* @plusOne(i32* %12, i32 1, i32* %8)
store i32* %13, i32** %9
%14 = load i32, i32* %8
%15 = icmp eq i32 %14, 2
br i1 %15, label %19, label %16
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %2
%20 = load i32*, i32** %9
%21 = getelementptr inbounds i32, i32* %20, i64 0
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 1
br i1 %23, label %27, label %24
24: ; preds = %19
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 @exit(i32 -1)
unreachable
27: ; preds = %19
%28 = load i32*, i32** %9
%29 = getelementptr inbounds i32, i32* %28, i64 1
%30 = load i32, i32* %29
%31 = icmp eq i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %27
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%34 = call i32 @exit(i32 -1)
unreachable
35: ; preds = %27
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"assert fail: %s\0A\00"
@.str.1 = [6 x i8] c"carry\00"
@.str.2 = [6 x i8] c"r1[0]\00"
@.str.3 = [6 x i8] c"r1[1]\00"
@str = [20 x i8] c"everything is fine!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1 x i32]
%4 = alloca i32
%5 = bitcast [1 x i32]* %3 to i8*
%6 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 0
store i32 9, i32* %6
%7 = bitcast i32* %4 to i8*
%8 = call i32* @plusOne(i32* %6, i32 1, i32* %4)
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 2
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @exit(i32 -1)
unreachable
14: ; preds = %2
%15 = load i32, i32* %8
%16 = icmp eq i32 %15, 1
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @exit(i32 -1)
unreachable
20: ; preds = %14
%21 = getelementptr inbounds i32, i32* %8, i64 1
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %20
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 @exit(i32 -1)
unreachable
27: ; preds = %20
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret i32 0
}