#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct TYPE_4__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct TYPE_3__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct itimerval {
  TYPE_2__ it_value;
  TYPE_1__ it_interval;
};
typedef int /*<<< orphan*/ intmax_t;

/* Variables and functions */
int /*<<< orphan*/ ITIMER_REAL;
scalar_t__ getitimer(int /*<<< orphan*/, struct itimerval *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/, int /*<<< orphan*/,
                          int /*<<< orphan*/, int /*<<< orphan*/, ...);
int /*<<< orphan*/ puts(char *);
scalar_t__ setitimer(int /*<<< orphan*/, struct itimerval *,
                     struct itimerval *);
int main(void) {
  struct {
    struct itimerval itv;
    uint32_t pad[4];
  } old = {.pad = {0xdeadbeef, 0xbadc0ded, 0xdeadbeef, 0xbadc0ded}},
    new = {.itv = {.it_interval = {0xc0de1, 0xc0de2},
                   .it_value = {0xc0de3, 0xc0de4}},
           .pad = {0xdeadbeef, 0xbadc0ded, 0xdeadbeef, 0xbadc0ded}};
  if (setitimer(ITIMER_REAL, &new.itv, &old.itv))
    return 77;
  printf("setitimer(ITIMER_REAL"
         ", {it_interval={%jd, %jd}, it_value={%jd, %jd}}"
         ", {it_interval={%jd, %jd}, it_value={%jd, %jd}}"
         ") = 0\n",
         (intmax_t) new.itv.it_interval.tv_sec,
         (intmax_t) new.itv.it_interval.tv_usec,
         (intmax_t) new.itv.it_value.tv_sec,
         (intmax_t) new.itv.it_value.tv_usec,
         (intmax_t)old.itv.it_interval.tv_sec,
         (intmax_t)old.itv.it_interval.tv_usec,
         (intmax_t)old.itv.it_value.tv_sec, (intmax_t)old.itv.it_value.tv_usec);
  if (getitimer(ITIMER_REAL, &old.itv))
    return 77;
  printf("getitimer(ITIMER_REAL"
         ", {it_interval={%jd, %jd}, it_value={%jd, %jd}}"
         ") = 0\n",
         (intmax_t)old.itv.it_interval.tv_sec,
         (intmax_t)old.itv.it_interval.tv_usec,
         (intmax_t)old.itv.it_value.tv_sec, (intmax_t)old.itv.it_value.tv_usec);
  puts("+++ exited with 0 +++");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1050 <memset@plt>
movl   $0xdeadbeef,-0x18(%rbp)
movl   $0xbadc0ded,-0x14(%rbp)
movl   $0xdeadbeef,-0x10(%rbp)
movl   $0xbadc0ded,-0xc(%rbp)
lea    -0x68(%rbp),%rdi
lea    0xe57(%rip),%rsi
mov    $0x30,%edx
call   1060 <memcpy@plt>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
lea    -0x68(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1070 <setitimer@plt>
cmp    $0x0,%rax
je     11df <main+0x7f>
movl   $0x4d,-0x4(%rbp)
jmp    128e <main+0x12e>
mov    -0x50(%rbp),%rax
mov    %eax,%esi
mov    -0x58(%rbp),%rax
mov    %eax,%edx
mov    -0x60(%rbp),%rax
mov    %eax,%ecx
mov    -0x68(%rbp),%rax
mov    %eax,%r8d
mov    -0x20(%rbp),%rax
mov    %eax,%r9d
mov    -0x28(%rbp),%rax
mov    %eax,%r11d
mov    -0x30(%rbp),%rax
mov    %eax,%r10d
mov    -0x38(%rbp),%rax
lea    0xe18(%rip),%rdi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%edi
lea    -0x38(%rbp),%rsi
call   1080 <getitimer@plt>
cmp    $0x0,%rax
je     1254 <main+0xf4>
movl   $0x4d,-0x4(%rbp)
jmp    128e <main+0x12e>
mov    -0x20(%rbp),%rax
mov    %eax,%esi
mov    -0x28(%rbp),%rax
mov    %eax,%edx
mov    -0x30(%rbp),%rax
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
mov    %eax,%r8d
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe73(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movaps 0xea4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movups 0xec8(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movups 0xeac(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xe90(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    0x2e54(%rip),%r14
mov    (%r14),%edi
lea    0x30(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <setitimer@plt>
mov    $0x4d,%ebx
test   %rax,%rax
jne    122a <main+0xea>
mov    0x18(%rsp),%r9d
mov    0x10(%rsp),%r10d
mov    (%rsp),%r11d
mov    0x8(%rsp),%r15d
sub    $0x8,%rsp
lea    0xe78(%rip),%rdi
mov    $0xc0de2,%esi
mov    $0xc0de1,%edx
mov    $0xc0de4,%ecx
mov    $0xc0de3,%r8d
xor    %eax,%eax
push   %r11
push   %r15
push   %r10
call   1040 <printf@plt>
add    $0x20,%rsp
mov    (%r14),%edi
mov    %rsp,%rsi
call   1060 <getitimer@plt>
test   %rax,%rax
jne    122a <main+0xea>
mov    0x18(%rsp),%esi
mov    0x10(%rsp),%edx
mov    (%rsp),%r8d
mov    0x8(%rsp),%ecx
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.anon = type { %struct.itimerval, [4 x i32] }
%struct.itimerval = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@__const.main.new = %struct.anon { %struct.itimerval { %struct.TYPE_4__ { i64 789987, i64 789988 }, %struct.TYPE_3__ { i64 789985, i64 789986 } }, [4 x i32] [i32 -559038737, i32 -1159983635, i32 -559038737, i32 -1159983635] }
@ITIMER_REAL = global i32 0
@.str = [122 x i8] c"setitimer(ITIMER_REAL, {it_interval={%jd, %jd}, it_value={%jd, %jd}}, {it_interval={%jd, %jd}, it_value={%jd, %jd}}) = 0\0A\00"
@.str.1 = [75 x i8] c"getitimer(ITIMER_REAL, {it_interval={%jd, %jd}, it_value={%jd, %jd}}) = 0\0A\00"
@.str.2 = [22 x i8] c"+++ exited with 0 +++\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.anon
%3 = alloca %struct.anon
store i32 0, i32* %1
%4 = bitcast %struct.anon* %2 to i8*
%5 = bitcast i8* %4 to %struct.anon*
%6 = getelementptr inbounds %struct.anon, %struct.anon* %5, i32 0, i32 1
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i32 0, i32 0
store i32 -559038737, i32* %7
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i32 0, i32 1
store i32 -1159983635, i32* %8
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i32 0, i32 2
store i32 -559038737, i32* %9
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i32 0, i32 3
store i32 -1159983635, i32* %10
%11 = bitcast %struct.anon* %3 to i8*
%12 = load i32, i32* @ITIMER_REAL
%13 = getelementptr inbounds %struct.anon, %struct.anon* %3, i32 0, i32 0
%14 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%15 = call i64 @setitimer(i32 %12, %struct.itimerval* %13, %struct.itimerval* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %0
store i32 77, i32* %1
br label %88
18: ; preds = %0
%19 = getelementptr inbounds %struct.anon, %struct.anon* %3, i32 0, i32 0
%20 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %19, i32 0, i32 1
%21 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %20, i32 0, i32 1
%22 = load i64, i64* %21
%23 = trunc i64 %22 to i32
%24 = getelementptr inbounds %struct.anon, %struct.anon* %3, i32 0, i32 0
%25 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %24, i32 0, i32 1
%26 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %25, i32 0, i32 0
%27 = load i64, i64* %26
%28 = trunc i64 %27 to i32
%29 = getelementptr inbounds %struct.anon, %struct.anon* %3, i32 0, i32 0
%30 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %29, i32 0, i32 0
%31 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %30, i32 0, i32 1
%32 = load i64, i64* %31
%33 = trunc i64 %32 to i32
%34 = getelementptr inbounds %struct.anon, %struct.anon* %3, i32 0, i32 0
%35 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %34, i32 0, i32 0
%36 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %35, i32 0, i32 0
%37 = load i64, i64* %36
%38 = trunc i64 %37 to i32
%39 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%40 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %39, i32 0, i32 1
%41 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %40, i32 0, i32 1
%42 = load i64, i64* %41
%43 = trunc i64 %42 to i32
%44 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%45 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %44, i32 0, i32 1
%46 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %45, i32 0, i32 0
%47 = load i64, i64* %46
%48 = trunc i64 %47 to i32
%49 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%50 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %49, i32 0, i32 0
%51 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %50, i32 0, i32 1
%52 = load i64, i64* %51
%53 = trunc i64 %52 to i32
%54 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%55 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %54, i32 0, i32 0
%56 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %55, i32 0, i32 0
%57 = load i64, i64* %56
%58 = trunc i64 %57 to i32
%59 = call i32 (i8*, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([122 x i8], [122 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %28, i32 %33, i32 %38, i32 %43, i32 %48, i32 %53, i32 %58)
%60 = load i32, i32* @ITIMER_REAL
%61 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%62 = call i64 @getitimer(i32 %60, %struct.itimerval* %61)
%63 = icmp ne i64 %62, 0
br i1 %63, label %64, label %65
64: ; preds = %18
store i32 77, i32* %1
br label %88
65: ; preds = %18
%66 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%67 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %66, i32 0, i32 1
%68 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %67, i32 0, i32 1
%69 = load i64, i64* %68
%70 = trunc i64 %69 to i32
%71 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%72 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %71, i32 0, i32 1
%73 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %72, i32 0, i32 0
%74 = load i64, i64* %73
%75 = trunc i64 %74 to i32
%76 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%77 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %76, i32 0, i32 0
%78 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %77, i32 0, i32 1
%79 = load i64, i64* %78
%80 = trunc i64 %79 to i32
%81 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
%82 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %81, i32 0, i32 0
%83 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %82, i32 0, i32 0
%84 = load i64, i64* %83
%85 = trunc i64 %84 to i32
%86 = call i32 (i8*, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0), i32 %70, i32 %75, i32 %80, i32 %85)
%87 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %88
88: ; preds = %65, %64, %17
%89 = load i32, i32* %1
ret i32 %89
}

LLVM IR (-O2):
%struct.anon = type { %struct.itimerval, [4 x i32] }
%struct.itimerval = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@__const.main.new = %struct.anon { %struct.itimerval { %struct.TYPE_4__ { i64 789987, i64 789988 }, %struct.TYPE_3__ { i64 789985, i64 789986 } }, [4 x i32] [i32 -559038737, i32 -1159983635, i32 -559038737, i32 -1159983635] }
@ITIMER_REAL = global i32 0
@.str = [122 x i8] c"setitimer(ITIMER_REAL, {it_interval={%jd, %jd}, it_value={%jd, %jd}}, {it_interval={%jd, %jd}, it_value={%jd, %jd}}) = 0\0A\00"
@.str.1 = [75 x i8] c"getitimer(ITIMER_REAL, {it_interval={%jd, %jd}, it_value={%jd, %jd}}) = 0\0A\00"
@.str.2 = [22 x i8] c"+++ exited with 0 +++\00"
define i32 @main() {
%1 = alloca %struct.anon
%2 = alloca %struct.anon
%3 = bitcast %struct.anon* %1 to i8*
%4 = getelementptr inbounds %struct.anon, %struct.anon* %1, i64 0, i32 1, i64 0
%5 = bitcast i32* %4 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -1159983635, i32 -559038737, i32 -1159983635>, <4 x i32>* %5
%6 = bitcast %struct.anon* %2 to i8*
%7 = load i32, i32* @ITIMER_REAL
%8 = getelementptr inbounds %struct.anon, %struct.anon* %2, i64 0, i32 0
%9 = getelementptr inbounds %struct.anon, %struct.anon* %1, i64 0, i32 0
%10 = call i64 @setitimer(i32 %7, %struct.itimerval* %8, %struct.itimerval* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %40
12: ; preds = %0
%13 = getelementptr inbounds %struct.anon, %struct.anon* %1, i64 0, i32 0, i32 1, i32 1
%14 = load i64, i64* %13
%15 = trunc i64 %14 to i32
%16 = getelementptr inbounds %struct.anon, %struct.anon* %1, i64 0, i32 0, i32 1, i32 0
%17 = load i64, i64* %16
%18 = trunc i64 %17 to i32
%19 = getelementptr inbounds %struct.anon, %struct.anon* %1, i64 0, i32 0, i32 0, i32 1
%20 = load i64, i64* %19
%21 = trunc i64 %20 to i32
%22 = getelementptr inbounds %struct.anon, %struct.anon* %1, i64 0, i32 0, i32 0, i32 0
%23 = load i64, i64* %22
%24 = trunc i64 %23 to i32
%25 = tail call i32 (i8*, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([122 x i8], [122 x i8]* @.str, i64 0, i64 0), i32 789986, i32 789985, i32 789988, i32 789987, i32 %15, i32 %18, i32 %21, i32 %24)
%26 = load i32, i32* @ITIMER_REAL
%27 = call i64 @getitimer(i32 %26, %struct.itimerval* %9)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %40
29: ; preds = %12
%30 = load i64, i64* %13
%31 = trunc i64 %30 to i32
%32 = load i64, i64* %16
%33 = trunc i64 %32 to i32
%34 = load i64, i64* %19
%35 = trunc i64 %34 to i32
%36 = load i64, i64* %22
%37 = trunc i64 %36 to i32
%38 = tail call i32 (i8*, i32, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0), i32 %31, i32 %33, i32 %35, i32 %37)
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %40
40: ; preds = %12, %0, %29
%41 = phi i32 [ 0, %29 ], [ 77, %0 ], [ 77, %12 ]
ret i32 %41
}